Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@350d
350d / windowstatus.js
Created January 31, 2014 17:06
Window Active Status
function windowVisibility() {
var v = 'visible', hidden = h = 'hidden', map = {focus:v, focusin:v, pageshow:v, blur:h, focusout:h, pagehide:h};
if (hidden in D) D.addEventListener("visibilitychange", onchange);
else if ((hidden = "mozHidden") in D) D.addEventListener("mozvisibilitychange", onchange);
else if ((hidden = "webkitHidden") in D) D.addEventListener("webkitvisibilitychange", onchange);
else if ((hidden = "msHidden") in D) D.addEventListener("msvisibilitychange", onchange);
else if ('onfocusin' in D) D.onfocusin = D.onfocusout = onchange;
W.onpageshow = W.onpagehide = W.onfocus = W.onblur = onchange;
function onchange(e) {
e = e || W.event;
"undefined"==typeof jwplayer&&(jwplayer=function(e){if(jwplayer.api)return jwplayer.api.selectPlayer(e)},jwplayer.version="6.8.4616",jwplayer.vid=document.createElement("video"),jwplayer.audio=document.createElement("audio"),jwplayer.source=document.createElement("source"),function(e){function a(h){return function(){return b(h)}}function l(h,b,a,k,j){return function(){var d,f;if(j)a(h);else{try{if(d=h.responseXML)if(f=d.firstChild,d.lastChild&&"parsererror"===d.lastChild.nodeName){k&&k("Invalid XML");
return}}catch(g){}if(d&&f)return a(h);(d=c.parseXML(h.responseText))&&d.firstChild?(h=c.extend({},h,{responseXML:d}),a(h)):k&&k(h.responseText?"Invalid XML":b)}}}var g=document,f=window,d=navigator,c=e.utils=function(){};c.exists=function(h){switch(typeof h){case "string":return 0<h.length;case "object":return null!==h;case "undefined":return!1}return!0};c.styleDimension=function(h){return h+(0<h.toString().indexOf("%")?"":"px")};c.getAbsolutePath=function(h,b){c.exists(b)||(b=g.location.href);if(c.exists(h)){va
<?xml version="1.0" ?><skin author="JW Player" name="Five" target="6.7" version="3.0">
<components>
<component name="controlbar">
<settings>
<setting name="margin" value="0"/>
<setting name="maxwidth" value="9999"/>
<setting name="fontsize" value="11"/>
<setting name="fontweight" value="normal"/>
@350d
350d / domready.js
Created March 19, 2014 21:59
Minimal DOM ready, IE tested
function r(f) {
/in/.test(document.readyState) ? setTimeout('r('+f+')',9) : f()
}
@350d
350d / hosts
Created April 1, 2014 19:00
No More Youtube ADS
127.0.0.1 ads.youtube.com
127.0.0.1 s0.2mdn.net
127.0.0.1 s1.2mdn.net
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 ad.doubleclick.net
127.0.0.1 static.doubleclick.net
@350d
350d / debounce.js
Last active August 29, 2015 14:03
Javascript debounce
Function.prototype.debounce = function(delay) {
var timeout, callback = this;
return function() {
clearTimeout(timeout);
timeout = setTimeout(callback, delay);
}
}
property image_extension_list : {"tif", "tiff", "gif", "png", "pict", "pct", "jpg", "jpeg", "bmp"}
property video_extension_list : {"avi", "mov", "mpg", "mpeg", "wmv", "mp4", "m4a"}
property audio_extension_list : {"mp3", "wav", "aac"}
property archive_extension_list : {"zip", "sit", "tar", "tgz", "gz", "bzip2"}
property documents_extension_list : {"doc", "docx", "pdf", "txt", "xls", "xslx", "ppt"}
property diskAlignLeft : true
property otherAlignLeft : false
property margin : {50, 60, 0, 0} -- {left, top, right, bottom}
property xPadding : 50
property yPadding : 50
@350d
350d / isie.js
Created September 24, 2014 21:58
Internet Explorer Browser Detector ( method that does not depend on the navigator.userAgent )
function isIE() {
return typeof document.documentMode == "number" || eval("/*@cc_on!@*/!1");
}
@350d
350d / 0.gif
Created September 26, 2014 03:27
Transparent .GIF 1x1 px Base64 encoded
data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=
@350d
350d / jquery.raf.js
Created October 29, 2014 13:16
jQuery RequestAnimationFrame Plugin
(function(jQuery){
'use strict';
if (!Date.now) Date.now = function() { return new Date().getTime(); };
var animating,
vendors = ['moz', 'webkit'],
W = window;
for (var i = 0; i < vendors.length && !W.requestAnimationFrame; ++i) {
var vp = vendors[i];