Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cheerly/a6261f1033179cf46055e666f1ff21dc to your computer and use it in GitHub Desktop.
Save cheerly/a6261f1033179cf46055e666f1ff21dc to your computer and use it in GitHub Desktop.
user.js
// ==UserScript==
// @name Feedly Customization
// @namespace http://userscripts.org/users/colt365
// @description Customization for Feedly.
// @include https://feedly.com/*
// @version 1.2.0.20170223
// @grant none
// ==/UserScript==
var checkLoadInterval;
function generateHistoryButton(target) {
var historyButton = document.createElement('button');
historyButton.className = 'full-width onboarded button-icon-left';
historyButton.style = 'background-color: rgb(71, 119, 180); margin: -5% 0;';
historyButton.setAttribute('data-uri','label/feedly.history');
historyButton.innerText = 'Recently Read';
target.parentNode.appendChild(historyButton);
}
function checkLoaded() {
var targetButton = document.getElementById('addContentPlaceholderFX');
if (targetButton) {
window.clearInterval(checkLoadInterval);
targetButton = targetButton.querySelector('button');
targetButton.style.padding = '1px';
targetButton.style.margin = '-3% 0';
generateHistoryButton(targetButton);
}
}
checkLoadInterval = setInterval(checkLoaded, 5000);
// ==UserScript==
// @name Redirector with jQuery
// @namespace http://userscripts.org/users/colt365
// @description Redirector implemented with jQuery
// @include http://www.yufan520.com/*
// @include http://share-links.biz/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
// @version 1
// ==/UserScript==
switch (location.hostname) {
case "www.yufan520.com":
yufan520();
break;
case "share-links.biz":
shareLinks();
break;
default:
alert(location.hostname);
break;
}
function yufan520() {
var allLink = $("a");
for (i = allLink.length - 1; i >= 0; --i) {
if(allLink[i].innerHTML.toLowerCase() == "download") {
location.replace(allLink[i].href);
break;
}
}
}
function shareLinks(){
location.replace("http://"+unsafeWindow.basewebclean+"/get/lnk/" + $(".decrypt img").attr('onclick').toString().split("'")[1]);
}
// ==UserScript==
// @name Redirector
// @namespace http://userscripts.org/users/colt365
// @description Redirect on some sites
// @include http://share-links.biz/*
// @include http://*yufan520.com/*
// @include http://*mengning520.com/*
// @include http://*yunfile.com/*
// @include http://9ez.me/*
// @include http://article.woshao.com/*
// @include http://*.rapeit.net*
// @include http://bc.vc/*
// @include http://sh.st/*
// @include http://rdlnk.co/*
// @include http://*.linkbucks.com/*
// @include http://adf.ly/*
// @include http://shr77.com/*
// @include http://www.kingfiles.net/*
// @include http://www.tusfiles.net/*
// @include http://crisshare.com/*
// @include http://media4.us/*
// @include https://*.appinn.com/*
// @include http://www.ftchinese.com/story/*
// @include /^https?://(item|ai)\.taobao\.com/.*$/
// @include /^https?://(world|detail)\.tmall\.com/.*$/
// @include /^https?://detail\.yao\.95095\.com/.*$/
// @version 2.3.1.20170214
// ==/UserScript==
a = location.hostname.split('.')[0];
b = location.hostname.split('.')[1];
if ("$share-links$9ez$yufan520$yunfile$bc$sh$rdlnk$adf$shr77$media4$crisshare$".indexOf('$' + a + '$') >= 0) {
eval('_' + a.replace(/-/, '') + '()');
} else if ("$yufan520$mengning520$yunfile$woshao$rapeit$linkbucks$kingfiles$tusfiles$taobao$tmall$appinn$yao$ftchinese$".indexOf('$' + b + '$') >= 0) {
eval('_' + b.replace(/-/, '') + '()');
} else {
// alert(location.hostname); // for debug
}
function reloadPage() {
location.reload();
}
function setCookie(sName,sValue) {
document.cookie = sName + "=" + escape(sValue);
}
function getCookie(sName) {
var aCookie = document.cookie.split(";");
for(var i=0; i < aCookie.length; i++) {
var aCrumb = aCookie[i].split("=");
if(sName == aCrumb[0].trim()) {
return unescape(aCrumb[1]).trim();
}
}
return null;
}
function framekiller() {
if (window.top!=window.self) window.top.location=location;
}
function clickDownload() {
var allLink = document.getElementsByTagName("a");
for (i = allLink.length - 1; i >= 0; --i) {
if (allLink[i].innerHTML.search(/download/i) >= 0) {
location.assign(allLink[i].href);
}
}
}
function _yufan520() {clickDownload();}
function _mengning520() {clickDownload();}
function _sharelinks(){
var query = location.toString().split('/')[3];
if(query.charAt(0) == '_') {
if (document.getElementsByClassName('decrypt').length !== 0) {
// redirect after input captcha
location.assign("http://"+unsafeWindow.basewebclean+"/get/lnk/" + document.getElementsByClassName('decrypt')[0].getElementsByTagName("img")[0].onclick.toString().split("'")[1]);
} else {
// reload the captcha page if it's not last opened
setCookie("lastOpen", query.substr(1));
unsafeWindow.onfocus = function(){if(getCookie("lastOpen")!=query.substr(1)){document.getElementById("captcha_container").style.visibility="hidden"; reloadPage();}};
}
} else if(location.toString().split('/')[4] == 'frm') {
if(document.getElementsByTagName('p')[0].innerHTML.search(/fatal/i) != -1) {
setTimeout(function(){history.back();}, 5000);
}
}
}
function _9ez(){
document.getElementById("btnSubmit").onclick();
}
function _yunfile(){
if (location.toString().split('/')[4] == 'down') {
// to download
unsafeWindow.ck();
document.getElementById('hidebtn').click();
} else {
// to redirect // fail now because of captcha
// unsafeWindow.redirectDownPage();
// document.getElementById('slow_button').click();
// document.getElementById('wait_span').innerHTML = '0';
}
}
function _woshao() {
var url = document.getElementById('LinkSource').href;
location.assign('http://' + url.split('http://')[2]);
}
function _rapeit() {
document.getElementById('download_link').click();
}
function _bc() {
setTimeout(function(){location.assign('http' + location.href.split('http')[2]);},5000);
}
function _sh() {
setInterval(function(){document.getElementById('skip_button').click();},8000);
}
function _rdlnk() {
setTimeout(function(){location.assign(location.href.split('?rdu=')[1]);},6000);
}
function _linkbucks() {
setInterval(function(){document.getElementById('skiplink').click();},3000);
}
function _adf() {
if (location.href.indexOf('adf.ly/ad/locked') >= 0) {
setInterval(function(){document.getElementById('continue').childNodes[1].childNodes[1].click();}, 5000);
return;
}
setTimeout(function(){document.getElementById('skip_button').click();},9000);
}
function _shr77() {
setInterval(function(){document.getElementById('loading').click();},4000);
}
function _kingfiles() {framekiller();}
function _tusfiles() {framekiller();}
function _crisshare() {framekiller();}
function _media4() {
document.getElementById('download_link').click();
}
function removePara(url, par) {
var pos = url.indexOf(par + "=");
if (pos > 0) {
var end = url.indexOf("&", pos);
if (end > 0) {
return url.substring(0,pos) + url.substr(end + 1);
} else {
return url.substring(0,pos - 1);
}
}
return url;
}
function _appinn() {
if (a != "d") return;
var links = document.getElementsByClassName("thecontent")[0].getElementsByTagName('a');
function removeUtm(event) {
event.currentTarget.setAttribute("href", removePara(event.currentTarget.getAttribute("href"), "utm_source"));
}
for (var i = 0; i < links.length; ++i) {
links[i].onmousedown = removeUtm;
}
}
function ali() {
var ali_para = ["_u", "abbucket", "abtest", "acm", "ad_id", "aldid", "ali_refid", "ali_trackid", "am_id", "areaId", "cat_id", "clk1", "cm_id", "is_b", "mt", "ns", "pm_id", "pos", "pvid", "qq-pf-to", "rn", "scene", "scm", "sm", "smToken", "smSign", "spm", "standard", "toSite", "user_id"]; // "sku_properties", "skuId"
var url = location.toString();
var init_length = url.length;
for (var j in ali_para) {
url = removePara(url, ali_para[j]);
}
if (url.length != init_length) {
location.assign(url);
}
}
function _taobao() {
switch (a) {
case "item": ali(); break;
case "ai":
var tmp = document.getElementsByClassName('right-btn')[0];
if (!tmp) tmp = document.getElementsByClassName('go-to-buy')[0];
location.assign(tmp.href);
break;
default: break;
}
}
function _tmall() {ali();}
function _yao() {ali();}
function _ftchinese() {
if (location.search.includes('full=y')) return;
location.search += (location.search === '') ? '?full=y' : '&full=y';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment