// ==UserScript== // @namespace http://mrob.com/time/scripts-beta // @name spoiler-opener for OTT // @description Open All Spoilers on (Re)Load // @author Robert Munafo // @version 48660.32 // @downloadURL http://mrob.com/time/scripts-beta/spoiler-opener.user.js.txt // @grant GM_getValue // @grant GM_setValue // @include http://www.forums.xkcd.com/* // @include http://forums.xkcd.com/* // @include http://echochamber.me/* // @include http://fora.xkcd.com/* // @include http://1190.bicyclesonthemoon.info/ott* // @include http://moonbase.chirpingmustard.com/ott* // @run-at document-end // ==/UserScript== // REVISION HISTORY: // // np5708: Add this script to github // Comment out debugging statements ("log" function) // Add comments explaining how the script works. // Update revision # and make a more descriptive name // np5718: Change text 'Spoiler:' to height of contained text (bug: it isn't // counting height of images yet) // np5719: Improve comments // np5725: Use 'load' or 'onload' event listener instead of 'DOMContentLoaded' // np5732: Set backgroundColor of contents of every spoiler to #BBD // so it's obvious which parts were inside the spoilers. // Cross-browser method for getting element heights. // np5757.19 Use setTimeout to run the function twice // np5757.25 Wait 9.111 seconds; fix a bug // np5761.68 Fix window.addEventListener/attachEvent calls and add fallback // case if neither deferred method is available. // np5826.91 Do not open the spoilers or change the button title on the // second scan (in case user has decided to close spoiler(s) during the // interval) // np5905.00 Run 3 more times instead of just 1, with exponentially increasing // delays (this improves performance when the servers are really slow.) // np6002.91 Make the lavender background a fair bit lighter so it doesn't // interfere as much with any images, font colours, etc. that the author // might have included. // np8198.89 If spoiler button is inside a link, change the button text to // '> spURLer! < to make it obvious // np8201.06 Handle a few more cases of Spoiler nested within other tags which // are nested in a URL. // np8233.28 Fix a typo ("lavendar") // np10050.85 Add 'Zero Margins' option. // np10937.15 Work on search.php pages. // np10966.08 If possible, identify href target in URL and scroll to it // np10966.67 Work on the balthamirror (1190.bicyclesonthemoon.dnsd.info) // np11640.04 Enforce scrolling to the user's target location as long as // the target location keeps changing, but until document.body.scrollTop // changes by some other means. // np11641.26 Neaten up the code a little // np12165.61 Try harder to change spURLer buttons' text // np13078.01 Work when viewing PMs // np13115.92 Broaden balthamirror match pattern // np13128.24 Add moonbase.chirpingmustard.com // np13196.35 Slightly broader match pattern for the two balthasar sites // np14757.49 Remove 'dnsd' from bicyclesonthemoon hostname // np14771.07 Add www.forums.xkcd.com // np21083.61 Add @grant and @run-at requests // np26758.29 Add a semicolon // np26808.56 Always call convert() explicitly // np26828.73 Zero margins option works once again // np26836.23 Create checkboxes only once. // np40917.84 Option-setting temporarily disabled. // np48660.32 Fix errors/warnings reported by TamperMonkey // A sample forum page is: // // forums.xkcd.com/viewtopic.php?f=7&t=101043&p=3495924#p3495924 // // A Spoiler:'d item is implemented with the following HTML: // //