Last active
December 14, 2015 09:28
-
-
Save paranoidxc/5065236 to your computer and use it in GitHub Desktop.
固定 V2EX 的导航栏, 双击导航栏页面回到顶部,每日自动签到。
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
// ==UserScript== | |
// @author iParanoid | |
// @name V2EX_User_Script | |
// @namespace https://zone-huangxc.rhcloud.com | |
// @description Position fixed the navigation , Scroll to top when double click navigation bar or Page Footer | |
// @include * | |
// @updateURL https://gist.github.com/paranoidxc/5065236/raw/10bc3ee7501b86f2e579657ef64348e642cc2a70/V2EX.user.js | |
// ==/UserScript== | |
function iparanoid_wrapper() { | |
$('document').ready(function(){ | |
function scrolltoTop() { | |
$("html, body").animate({ scrollTop: 0 }, "slow"); | |
} | |
$('#Wrapper').css({"margin-top":45}); | |
$('#Top').css({"position":"fixed",'margin':'auto','width':'100%','top':0}).dblclick(scrolltoTop); | |
$('#Bottom').dblclick(scrolltoTop); | |
// daily mission | |
var daily_link = $("div.inner a[href='/mission/daily']"); | |
if( daily_link.length ) { | |
$.ajax({ | |
type:'get', | |
url: location.protocol+'//'+location.host+'/mission/daily', | |
success:function(html){ | |
var url = $(html).find('.box .cell>input').attr('onclick'); | |
var urls = url.split('=') | |
url = (urls[1]+'='+urls[2]).replace(/\'/g,'').replace(' ',''); | |
$.ajax({ | |
type:'get', | |
url: location.protocol+'//'+location.host+url, | |
success:function(html){ | |
daily_link.parent().parent().slideUp(); | |
},error:function(){ | |
alert('submit daily misson error'); | |
} | |
}) | |
}, | |
error:function(){ | |
alert('get daily misson error'); | |
} | |
}); | |
} | |
}); | |
}; | |
var script = document.createElement('script'); | |
script.id = "iparanoid_script"; | |
if (location.host == "www.v2ex.com" || location.host == "v2ex.com") { | |
script.appendChild(document.createTextNode('('+ iparanoid_wrapper +')();')); | |
(document.body || document.head || document.documentElement).appendChild(script); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment