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
jasmineHelpers.simulateMouseEvent = function(selector, events) { | |
var targets = document.querySelectorAll(selector), | |
dispatch = []; | |
// Create our mouse events and push them onto our event array | |
for (var z in events){ | |
if(events.hasOwnProperty(z)){ | |
var evt = document.createEvent('MouseEvents'); | |
// Init event with sensible defaults | |
evt.initMouseEvent(events[z], true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); |
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
# Place the below code into a command within a new bundle, and set the output to 'Show as HTML' | |
#!/bin/bash | |
echo "<script>window.resizeTo(800,1000); window.location = '$TM_FILEPATH';</script>" |
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
# Edit proxy setup | |
alias proxyConf='mate ~/Git/hoxy/rules/rules.txt' | |
#Enable redirecting traffic through a local proxy | |
function proxyEnable() { | |
# Using configuring system preferences | |
echo "Enabling proxy..."; | |
networksetup -setwebproxy Ethernet 127.0.0.1 8080; | |
networksetup -setwebproxy Wi-Fi 127.0.0.1 8080; |
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
function simulateMouseClick(selector) { | |
var targets = document.querySelectorAll(selector), | |
evt = document.createEvent('MouseEvents'), | |
i, len; | |
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
for ( i = 0, len = targets.length; i < len; ++i ) { | |
targets[i].dispatchEvent(evt); | |
} | |
} |
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
window.requestAnimFrame = (function(){ | |
return window.requestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.oRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
function(callback){ | |
window.setTimeout(callback, 1000 / 60); | |
}; | |
})(); |
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
preloader: { | |
// The element to update on loading progress | |
$progressBar: $('#loadingbar').find('span'), | |
// The wrapper for the loading overlay | |
$loadingBlock: $('#loading'), | |
init: function(){ | |
this.load(); | |
this.checkForLoad(); | |
}, |
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
iOsScrollingToggle : function(enabled){ | |
function preventScroll(e){ | |
e.preventDefault(); | |
e.stopPropagation(); | |
} | |
// This should prevent people from scrolling away from the modal window without closing it | |
if(enabled){ | |
document.body.removeEventListener('touchmove',preventScroll,false); | |
} else { | |
document.body.addEventListener('touchmove',preventScroll,false); |
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
var mouseWheelHandler = function(e){ | |
// Prevent your scroll action here e.g: | |
$(window).stop(true) | |
} | |
/** for Mozilla. */ | |
if (window.addEventListener) window.addEventListener('DOMMouseScroll', mouseWheelHandler, false); | |
/** IE/Opera. */ | |
window.onmousewheel = document.onmousewheel = mouseWheelHandler; |
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
$.expr[':'].onscreen = function(obj){ | |
var $win = $(window), pos = $(obj).position(); | |
return $.contains(document.documentElement, obj) && pos.top < $win.height() && pos.left < $win.width(); | |
}; | |
$.expr[':'].offscreen = function(obj){ | |
return !$(obj).is(':onscreen'); | |
}; |
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
$.expr[':'].onscreen = function(obj){ | |
obj = jQuery(obj) | |
return obj.position().top < jQuery(window).height() && obj.position().top < jQuery(window).width(); | |
}; | |
$.expr[':'].offscreen = function(obj){ | |
obj = jQuery(obj) | |
return obj.position().top > jQuery(window).height() && obj.position().top > jQuery(window).width(); | |
}; |
NewerOlder