Skip to content

Instantly share code, notes, and snippets.

View lackneets's full-sized avatar
🤗
Sorry I am super busy. I may respond in weeks or months

Lackneets Chang (小耀博士) lackneets

🤗
Sorry I am super busy. I may respond in weeks or months
  • TAROBO Investment Advisors Ltd.
  • Taipei, Taiwan
View GitHub Profile
@lackneets
lackneets / swipedirection.js
Created August 5, 2014 02:12
Detect left/right-swipe on touch-devices, but allow up/down-scrolling
// a modification from http://goo.gl/tLbLXr
var attachEvent = function(element, event, fn) {
if (element.addEventListener)
element.addEventListener(event, fn, false);
else if (element.attachEvent) // if IE
element.attachEvent('on' + event, fn);
}
var onReady = function(func) {
@lackneets
lackneets / onReady.js
Last active May 30, 2016 07:00
equivalent to $.ready
(function(){
function attachEvent(element, event, fn) {
if (element.addEventListener) {
element.addEventListener(event, fn, false);
} else if (element.attachEvent) {
element.attachEvent('on' + event, fn);
}
}
window.ready = window.onReady = function(func) {
// Batch Big5-URLDecoder
// go visit http://www.mytju.com/classcode/tools/urldecode_big5.asp
(function insertScripts(src) {
if (src instanceof Array && src.length) {
insertScripts(src.shift())
return insertScripts(src);
}
var script = document.createElement('script');
script.type = 'text/javascript';
function MyArray() {
var parent = { // Remember the Origional-methods
push: this.push
}
this.push = function (element) { // Override
// Do my actions
return parent.push.apply(this, arguments);
}
setInterval(function () {
// 取得網頁上所有連結
var a = document.getElementsByTagName('a');
// 針對每個連結跑一次
for (var i in a) {
// 檢查是不是真的是連結
if (a.hasOwnProperty(i)) {
// 檢查是不是讚的連結
if (a[i].className == "UFILikeLink") {
// 檢查是不是還沒按過讚
@lackneets
lackneets / insertScripts.js
Last active August 29, 2015 14:02
insertScripts in console
(function insertScripts(src) {
if (src instanceof Array && src.length) {
insertScripts(src.shift())
return insertScripts(src);
}
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
document.head.appendChild(script);
})([