Content deleted Content added
→Description / instruction manual: keypress |
m Replaced deprecated <source> tags with <syntaxhighlight> |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 332:
General usage:
<
mw.util.addPortletLink( 'portletId', 'href', 'text', 'id', 'tooltip', 'accesskey', 'nextnode');
</syntaxhighlight>
It's components:
Line 378:
== Change log ==
* 2017-07-07▼
** Version 0.4 – [https://en.wikipedia.org/w/index.php?title=User:The_Transhumanist/anno.js&oldid=789519032 ready to embark on fixing the viewport]▼
* 2017-07-06▼
** Moved the functions to the end of the script to make it easier to follow; marked the sections clearly▼
* 2017-07-05▼
** Added document ready function, so the script waits until the DOM is loaded before running▼
** Changed menu items to "Annotations (show)" and "Annotations (hide)"▼
* 2017-01-19▼
** Version 0.3 – [https://en.wikipedia.org/w/index.php?title=User:The_Transhumanist/anno.js&oldid=760834841 Simplified the script to wrap annotations and then hide or show them].▼
* 2016-12-11▼
** Version 0.2 – [https://en.wikipedia.org/w/index.php?title=User:The_Transhumanist/anno.js&oldid=754184988 on/off status persists across pages]. ▼
* 2016-12-08
** Anchor regexes on <nowiki><li></nowiki> (starting only) element delimiters
Line 395 ⟶ 384:
*** Uses regex to remove annotations
*** Uses a toggle to switch back and forth between the two states
▲* 2016-12-11
▲** Version 0.2 – [https://en.wikipedia.org/w/index.php?title=User:The_Transhumanist/anno.js&oldid=754184988 on/off status persists across pages].
▲* 2017-01-19
▲** Version 0.3 – [https://en.wikipedia.org/w/index.php?title=User:The_Transhumanist/anno.js&oldid=760834841 Simplified the script to wrap annotations and then hide or show them].
▲* 2017-07-05
▲** Added document ready function, so the script waits until the DOM is loaded before running
▲** Changed menu items to "Annotations (show)" and "Annotations (hide)"
▲* 2017-07-06
▲** Moved the functions to the end of the script to make it easier to follow; marked the sections clearly
▲* 2017-07-07
▲** Version 0.4 – [https://en.wikipedia.org/w/index.php?title=User:The_Transhumanist/anno.js&oldid=789519032 ready to embark on fixing the viewport]
* 2018-02-23
** Changed name to ViewAnnotationToggler.js
** removed activation filter so it works on all pages
* 2018-03-13
** Script editor wouldn't work while ViewAnnotationToggler was running, so added a deactivation filter so that this script doesn't run on edit pages.
== Task list ==
Line 778 ⟶ 783:
Post new discussion threads below.
== The Bug Report ==
Hi, {{ping|The Transhumanist}}. I've discovered an unintended side-effect caused by a line of code in your script, or should I say ''the'' line of code.
<syntaxhighlight lang="JavaScript>
cont.outerHTML = cont.outerHTML.replace(/(<li>.*?)( –.*)/g,'$1<span class="anno">$2</span>');
</syntaxhighlight>
This code strips action handlers from DOM elements which are descendants of <code>mw-content-text</code>. This notably affects 'buttons', such as the 'show/hide' button in the following templates:
{{collapse top}}
Peekaboo.
{{collapse bottom}}
{{Fragaria|state=expanded}}
You ''might'' be able to prevent this by iterating through <code><li></code> elements, like so:
<syntaxhighlight lang="JavaScript">
$("#mw-content-text li").each(function()
{
$(this).html($(this).html().replace(/(.*?)( –.*)/g,'$1<span class="anno">$2</span>'));
});
</syntaxhighlight>
Let me know if this helps! Regards, <span style="font-family:Times New Roman">[[User:Guywan|''GUYWAN'']] ( [[User talk:Guywan|''t'']] · [[Special:Contributions/Guywan|''c'']] )</span> 12:20, 6 June 2019 (UTC)
|