I use this script with ControlFreak chome plugin.
Last active
October 20, 2015 05:42
-
-
Save NigelThorne/59467154daf96f5d5a74 to your computer and use it in GitHub Desktop.
Zoom button for appear.in. Makes "enlarged" screen even bigger. click twice to get massive. (note: close chat area)
This file contains 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
/* knicked the Wait for load script from http://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists */ | |
/* https://gist.github.com/buu700/4200601 */ | |
(function ($) { | |
/** | |
* @function | |
* @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM | |
* @param {function} handler A function to execute at the time when the element is inserted | |
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation | |
* @example $(selector).waitUntilExists(function); | |
*/ | |
$.fn.waitUntilExists = function (handler, shouldRunHandlerOnce, isChild) { | |
var found = 'found'; | |
var $this = $(this.selector); | |
var $elements = $this.not(function () { return $(this).data(found); }).each(handler).data(found, true); | |
if (!isChild) | |
{ | |
(window.waitUntilExists_Intervals = window.waitUntilExists_Intervals || {})[this.selector] = | |
window.setInterval(function () { $this.waitUntilExists(handler, shouldRunHandlerOnce, true); }, 500) | |
; | |
} | |
else if (shouldRunHandlerOnce && $elements.length) | |
{ | |
window.clearInterval(window.waitUntilExists_Intervals[this.selector]); | |
} | |
return $this; | |
} | |
}(jQuery)); | |
$("div.top-bar-button.exit").waitUntilExists( function() { | |
var node = $( | |
"<div class='top-bar-button zoom' "+ | |
"title='Zoom in' ng-click='zoom_main_screen()'>"+ | |
"<i class='fa fa-sign-out icon'></i>"+ | |
"<p class='desc' ng-i18next=''>"+ | |
" <span>Zoom</span></p></div>"); | |
$("div.top-bar-button.exit").parent().append(node); | |
node.click(zoom_main_screen); | |
function zoom_main_screen(){ | |
var div = $("div.enlarged"); | |
var extra = "left: -40px; top: -80px; width: 110%; height: 140%; font-size: 20.4267pt; transition: left 0.3s ease-in, top 0.3s, width 0.3s, height 0.3s, font-size 0.3s;"; | |
var full = "left: 0px; top: -20px; width: 100%; height: 110%; font-size: 20.4267pt; transition: left 0.3s ease-in, top 0.3s, width 0.3s, height 0.3s, font-size 0.3s;"; | |
if(div.attr("style") == full){ | |
div.attr("style", extra); | |
} else { | |
div.attr("style", full); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment