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
function getScrollbarWidth(){ | |
var scrollDiv = document.createElement('div'); | |
scrollDiv.style.position = 'absolute'; | |
scrollDiv.style.top = '-9999px'; | |
scrollDiv.style.width = '50px'; | |
scrollDiv.style.height = '50px'; | |
scrollDiv.style.overflow= 'scroll'; | |
document.body.appendChild(scrollDiv); | |
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; | |
document.body.removeChild(scrollDiv); |
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
// https://www.facebook.com/pokes/?notif_t=poke | |
setInterval(function(){ | |
var cancel = document.querySelector('a[autofocus][action=cancel]'); | |
cancel && cancel.click(); | |
var poke = document.querySelector('a[ajaxify*="/pokes/inline/"]:not(.saving)'); | |
poke && poke.click(); | |
}, 1000); |
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
/* | |
iFrameResponsive.js | |
by Lackneets Chang < lackneets@gmail.com > | |
*/ | |
(function(){ | |
// Polyfill | |
// http://javascript.boxsheep.com/polyfills/Array-prototype-forEach/ | |
if (!Array.prototype.forEach) { | |
Array.prototype.forEach = function (fn, arg) { |
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
# Install imagemagick | |
sudo apt-get install imagemagick | |
# Resize jpeg images under subdirectories | |
find . -name "*.jpg" -exec mogrify -resize 1600x1600\> -quality 75% -verbose -format jpg {} + | |
# Resize jpeg images only if > 1MB | |
# http://superuser.com/questions/204564/how-can-i-find-files-that-are-bigger-smaller-than-x-bytes | |
find . -name "*.jpg" -size +1M -exec mogrify -resize 1600x1600\> -quality 75% -verbose -format jpg {} + |
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
/* October */ | |
html:lang(zh-tw), body:lang(zh-tw){ font-size:14.5px } | |
:lang(zh-tw) h5,.h5{ font-size:1rem } | |
:lang(zh-tw) .btn{ font-size:1rem; font-weight: normal; } | |
:lang(zh-tw) .btn[class^="oc-icon-"]:before,.btn[class*=" oc-icon-"]:before{ font-size:1rem } | |
:lang(zh-tw) .btn-text{ font-size:1rem } | |
:lang(zh-tw) .dropdown-menu{ font-size:1rem } | |
:lang(zh-tw) .dropdown-menu .dropdown-container > ul li a[class^="oc-icon-"]:before,.dropdown-menu .dropdown-container > ul li a[class*=" oc-icon-"]:before{ font-size:1rem } | |
:lang(zh-tw) .touch .dropdown-menu .dropdown-container > ul li a:hover:before{ font-size:1rem } | |
:lang(zh-tw) div.control-popover .popover-head h3{ font-size:1rem } |
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
$(function(){ | |
$('iframe[src*="youtube"][width][height]').each(function(){ | |
var w = $(this).attr('width'); | |
var h = $(this).attr('height'); | |
$(this).wrap($('<div class="youtube-wrapper">').css({ | |
'max-width' : '100%', | |
'height': 0, | |
'padding-bottom': (h/w*100) + '%', | |
'position': 'relative' | |
})).css({ |
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
(function(){ | |
var fonts = []; | |
Array.from(document.styleSheets).forEach(function(styleSheet){ | |
Array.from(styleSheet.cssRules || []).forEach(function(rule){ | |
String(rule.style && rule.style.fontFamily).split(/\s*,\s*/).forEach(function(font){ | |
font = font.replace(/^["'](.*)["']$/, '$1'); | |
if(font && fonts.indexOf(font) == -1 && !font.match(/undefined|inherit|initial/i)){ | |
fonts.push(font); | |
} | |
}) |
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
window.ready=function(e){"loading"!=document.readyState?e():document.addEventListener?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",function(){"loading"!=document.readyState&&e()})}; | |
/* Fallback for lazysizes on IE8 */ | |
window.ready(function(){ | |
if (document.documentMode == 8) { | |
var elms = document.querySelectorAll('.lazyload'); | |
for(var i=0; i<elms.length; i++){ | |
elms[i].setAttribute('class', String(elms[i].getAttribute('class')).replace(/\s*lazyload\s*/g, ' lazyloaded ')); | |
if(elms[i].getAttribute('data-src')){ | |
elms[i].setAttribute('src', elms[i].getAttribute('data-src')); |
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
/* Common Behaviors */ | |
.noselect { | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-khtml-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
} |
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
# OctoberCMS storage/ | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$ | |
RewriteRule ^(.*)$ - [E=BASE:%1] | |
# .../xxx.png => minified/.../xxx.png if exists | |
RewriteCond %{DOCUMENT_ROOT}%{ENV:BASE}minified/$1 -f |