Last active
August 29, 2015 14:04
-
-
Save gabrielmoreira/965e4b959cf16af24cce to your computer and use it in GitHub Desktop.
Android Skins for InVision
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name InVision-AndroidSkins | |
// @description InVision-AndroidSkins | |
// @include https://projects.invisionapp.com/* | |
// @version 1.0 | |
// ==/UserScript== | |
function applySkin(options) { | |
var skinCss = "#preview .mobileSkin.htcOne-portrait { background: url('" + options.backgroundImageUrl + "') no-repeat; height: " + options.skinHeight + "; } " | |
var viewportCss = "#preview .mobileSkin.htcOne-portrait.transparentStatusbar .mobileViewport { height: " + options.viewportHeight + "; } " | |
var css = skinCss + " " + viewportCss, | |
head = document.head || document.getElementsByTagName('head')[0], | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
if (style.styleSheet){ | |
style.styleSheet.cssText = css; | |
} else { | |
style.appendChild(document.createTextNode(css)); | |
} | |
head.appendChild(style); | |
} | |
applySkin({ | |
backgroundImageUrl: 'http://i.imgur.com/KAltFgo.png', | |
skinHeight: '762px', | |
viewportHeight: '568px' | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment