Last active
December 14, 2015 01:48
-
-
Save XP1/5008515 to your computer and use it in GitHub Desktop.
Disable Yahoo! Search rewrite: Disables the rewrite of links in Yahoo! Search results.
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 Yahoo! Search rewrite | |
// @version 1.00 | |
// @description Disables the rewrite of links in Yahoo! Search results. | |
// @namespace https://gist.github.com/XP1/5008515/ | |
// @copyright 2013 | |
// @author XP1 | |
// @homepage https://github.com/XP1/ | |
// @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 | |
// @include http*://search.yahoo.*/search?* | |
// @include http*://*.search.yahoo.*/search?* | |
// ==/UserScript== | |
/* | |
* Copyright 2013 XP1 | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
/*jslint browser: true, vars: true, maxerr: 50, indent: 4 */ | |
(function (window, MouseEvent, HTMLElement) { | |
"use strict"; | |
function disableRewrite(event) { | |
if (!(event instanceof MouseEvent)) { | |
return; | |
} | |
var target = event.target; | |
var current = null; | |
for (current = target; current instanceof HTMLElement; current = current.parentNode) { | |
if (current.hasAttribute("dirtyhref")) { | |
current.removeAttribute("dirtyhref"); | |
return; | |
} | |
} | |
} | |
window.addEventListener("mousedown", disableRewrite, true); | |
window.addEventListener("click", disableRewrite, true); | |
}(this, this.MouseEvent, this.HTMLElement)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I posted this user JS in this thread:
How to stop yahoo changing “href” to “dirtyhref” when I click a link?:
http://stackoverflow.com/questions/13560303/how-to-stop-yahoo-changing-href-to-dirtyhref-when-i-click-a-link/15012967#15012967