forked from philc/vimium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show link hints for elements that have delegated onclick listener phi…
- Loading branch information
Maxim Baz
committed
Jan 2, 2015
1 parent
8bd8e13
commit 524d00d
Showing
5 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
markHookSet = "vimium-hooked-delegated-onclick-listeners" | ||
return if document.documentElement.hasAttribute(markHookSet) | ||
|
||
|
||
Object.defineProperty window, "jQuery", | ||
enumerable: yes | ||
configurable: yes | ||
set: (jQuery) -> | ||
on_ = jQuery.fn.on | ||
|
||
jQuery.fn.on = (evnt, selector, handlerFn) -> | ||
if evnt is "click" and typeof selector is "string" | ||
attrKey = "vimium-jquery-delegated-events-selectors" | ||
sep = "|" | ||
|
||
element = if @[0] is document then document.documentElement else @[0] | ||
selectors = element.getAttribute(attrKey) || sep | ||
if selectors.indexOf("#{sep}#{selector}#{sep}") < 0 | ||
element.setAttribute attrKey, selectors + selector + sep | ||
|
||
return on_.apply @, arguments | ||
|
||
return jQuery | ||
|
||
|
||
document.documentElement.setAttribute markHookSet, "" |
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