This file contains hidden or 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 resolveURL(url, base_url) { | |
| var doc = document | |
| , old_base = doc.getElementsByTagName('base')[0] | |
| , old_href = old_base && old_base.href | |
| , doc_head = doc.head || doc.getElementsByTagName('head')[0] | |
| , our_base = old_base || doc_head.appendChild(doc.createElement('base')) | |
| , resolver = doc.createElement('a') | |
| , resolved_url | |
| ; | |
| our_base.href = base_url; |
This file contains hidden or 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
| /** | |
| * Appends CSS code to an existing stylesheet. | |
| * @param styleSheetURL: URL of an existing styleSheet; | |
| * @param code: CSS code to append. | |
| */ | |
| function appendCSS(styleSheetURL, code) { | |
| let DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils); | |
| Cu.import("resource://gre/modules/NetUtil.jsm"); | |
This file contains hidden or 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
| .block{ | |
| position:fixed; | |
| display:inline-block; | |
| width:3em; | |
| height:3em; | |
| padding:1em; | |
| margin:0; | |
| background:pink; | |
| border:0.1em solid black; | |
| text-align:center; |
This file contains hidden or 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
| var MultiGetSet = function(opt){ | |
| var getType = function(o) { | |
| return ({}).toString.call(o).match(/\s([a-zA-Z]+)/)[1].toLowerCase() | |
| }; | |
| if(!opt.public || !opt.private) | |
| return opt.public; | |
| if(opt.handler && opt.handler.init) |
This file contains hidden or 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
| javascript:/*Zenkaku-Hankaku*/(function(doc){ | |
| var zen = /[\u3000\uFFE5\uFF01-\uFF5E]/g; | |
| var arr = ['contains(.,"\u3000")','contains(.,"\uFFE5")']; | |
| for (var i = 0xFF01; i < 0xFF5E; ++i) { | |
| arr.push('contains(.,"' + String.fromCharCode(i) + '")'); | |
| } | |
| var xpath = '//text()[(' + arr.join(' or ') + ') and not(ancestor::style) and not(ancestor::script)]'; |
This file contains hidden or 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
| // muhaha.. changed all the code | |
| // maybe this version handles scrolling to the bottom edge of a document a little better | |
| // still not satisfied with the speed variable.. should that be higher == more speed, perhaps? or pixels per second? | |
| // sorry about the opinionated style changes | |
| Scrolling = { | |
| smoothScrollTo: function(target_top) { | |
| // ensure that we never scroll further than viewport size from bottom of the doc | |
| target_top = Math.min(target_top, Math.max($(document).height(), $(window).height()) - $(window).height()); | |
| var speed = 30, |
This file contains hidden or 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
| var user = { | |
| validateCredentials: function (username, password) { | |
| return ( | |
| (!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
| : (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
| : (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
| : (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
| : (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
| : false | |
| ); |
This file contains hidden or 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
| <body id="B" onload=setInterval('t=new(Date)/210&31;B.innerHTML=28<t?"Let\'s\(・ω・)/にゃー!":["(」・ω・)」うー!","(/・ω・)/にゃー!"][19<t?1:t/4&1]',4)> |
This file contains hidden or 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
| javascript:(function(){ | |
| /* | |
| Adblock のフィルタを urlfilter.ini に変換する | |
| ついてに広告カット CSS も作成 | |
| https://adblock-plus-japanese-filter.googlecode.com/hg/abp_jp.txt で実行 | |
| || で始まる行は http, https の2行に、^ は "/*" に、$のある行はスルー。 | |
| CSS は -moz-document を使っている部分があるので Opera では前半のみ利用可能 | |
| */ |
This file contains hidden or 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== | |
| // @name Disable the SOPA overlay on English Wikipedia | |
| // @author Mathias Bynens <http://mathiasbynens.be/> | |
| // @match http://en.wikipedia.org/* | |
| // ==/UserScript== | |
| // http://mths.be/unsafewindow | |
| window.unsafeWindow || ( | |
| unsafeWindow = (function() { | |
| var el = document.createElement('p'); |