-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bookmark autoclick management (#2006)
* Clean up excess on managed route and clarify * Clarify bookmarks better... this will break some existing user content links. Applies to #1971 Post #970 , #944 etc. Auto-merge
- Loading branch information
Showing
5 changed files
with
77 additions
and
38 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,34 @@ | ||
<script type="text/javascript"> | ||
(function () { | ||
'use strict'; | ||
|
||
function onDOMContentLoaded(aEv) { | ||
var block = null; | ||
var key = null; | ||
var collapse = null; | ||
var clickNode = null; | ||
var testNode = null; | ||
|
||
var matches = window.location.hash.match(/^\#(userscript|openuserjs)-block-(.*)$/); | ||
if (matches) { | ||
|
||
[, block, key] = matches; | ||
|
||
if (block && key) { | ||
collapse = 'collapse-' + block + '-' + key; | ||
|
||
clickNode = document.querySelector('a[href="#' + collapse + '"]'); | ||
testNode = document.querySelector('div[id="' + collapse + '"]'); | ||
|
||
if (clickNode && testNode && !testNode.classList.contains('in')) { | ||
clickNode.click(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', onDOMContentLoaded); | ||
window.addEventListener('hashchange', onDOMContentLoaded); | ||
|
||
})(); | ||
</script> |
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