ALL POSTSRecentChangesMultiple
<p>Hey, so I've been working on a script RecentChangesMultiple (live example), and was wondering if someone who knows what they are doing could - at the minimum - help me figure out things I should consider for a script like this (such as "window.ajaxCallAgain" / namespacing to avoid issues where possible). Due to the nature of the script, I also wouldn't mind if someone could help me make sure I'm not missing any huge memory leak concerns (I attempt to clean stuff up in "gApp.refresh"), or even if anyone knows a good article for testing garbage collection / memory leaks.
</p><p>To anyone actually looking at my code: A) sorry for dumb naming conventions and B) "sorry" for lack of jQuery; I wanted to challenge myself to make an app with as little jQuery as possible (since this isn't really a "customer facing" script, I figured it would be fine).
</p><p>I'm also open to just a plain and simple code review (or even random insults at that mess), but unless it's performance related / something that could improve the use of the app I may not bother addressing it if it's a pain (sorry, I'm lazy). All the parsing and checks (for logs, wall removal, etc) are just things I've figured out / hobbled together since I wasn't able to find where Wikia's code for formatting all this stuff is (all I found was this).
</p><p>Suggestions / thoughts welcome as well. I'm considering this fairly near the end of alpha (todo list at top of code) (barring someone pointing out super-important things here), and I am considering "beta" just stress testing it, fixing any bugs, and testing it with tons of odd-ball wikis to make sure I have most "special" cases covered. This is the first script I've made that I've made (not relating to work) with the intent of being used by more than me / couple friends, and I have tried making it cover as many concerns / edge cases as possible and make it somewhat user-friendly from my own experiences, but this whole project was mostly just a "personal dare" of sorts, so again suggestions / thoughts welcome. <small>(I don't plan on supporting translations for the translation nightmare at this (or really any) time)</small>
</p>
(Edited by Fewfre)
<p>Maybe provide an option to changes the time? I might want mine at 10 seconds, whereas someone else wants theirs at 30, and someone else, 60.
</p>
(Edited by Spydar007)
Can you make your script works on mobile skin: Wikiamobile skin and Mercury skin?
(Edited by Dai ca superman)
<p>Added. "data-autorefresh" can be set to any whole number (I recommend not using 0 of course though =p) to specify the number of seconds (default is 60).
</p>
(Edited by Fewfre)
I love you so much right now.
(Edited by Spydar007)
Is there any way to make it load a wiki's CSS so that usernames are highlighted liken they normally are?
(Edited by Spydar007)
<div class="quote"><i>
<p>Dai ca superman wrote:
Can you make your script works on mobile skin: Wikiamobile skin and Mercury skin?
</p>
</i></div>
<p>Sorry I missed your message earlier. I could probably make it work, but it seems one of the important things missing is the "mediaWiki" object on the mobile skin. Before I start trying to create work arounds, does anyone know if there's a way to get access to the "mediaWiki" object on mobile? Edit: Should at least run now (more on post below). </p> <div class="quote"><i> <p>Spydar007 wrote: Is there any way to make it load a wiki's CSS so that usernames are highlighted liken they normally are? </p> </i></div>
<p>I think that would be more of a pain than it's worth, since any CSS styles loaded would effect everything on the page, and that would probably not be desirable most times (like if one wiki's CSS made all table backgrounds black, while another wiki's CSS defined all text as black with "!important"), and would probably cause issues for people who did it... Unless a simple way occurs to me to do this, I <i>think</i> the best thing to do would be to add a "callback" for when the script is loaded, so custom code can be entered, like: </p> <div dir="ltr" class="mw-geshi mw-content-ltr"><div class="javascript source-javascript">
<p>Sorry I missed your message earlier. I could probably make it work, but it seems one of the important things missing is the "mediaWiki" object on the mobile skin. Before I start trying to create work arounds, does anyone know if there's a way to get access to the "mediaWiki" object on mobile? Edit: Should at least run now (more on post below). </p> <div class="quote"><i> <p>Spydar007 wrote: Is there any way to make it load a wiki's CSS so that usernames are highlighted liken they normally are? </p> </i></div>
<p>I think that would be more of a pain than it's worth, since any CSS styles loaded would effect everything on the page, and that would probably not be desirable most times (like if one wiki's CSS made all table backgrounds black, while another wiki's CSS defined all text as black with "!important"), and would probably cause issues for people who did it... Unless a simple way occurs to me to do this, I <i>think</i> the best thing to do would be to add a "callback" for when the script is loaded, so custom code can be entered, like: </p> <div dir="ltr" class="mw-geshi mw-content-ltr"><div class="javascript source-javascript">
window.<span class="me1">RecentChangesMultipleOnLoad</span> <span class="sy0">=</span> <span class="kw1">function</span><span class="br0">(</span><span class="br0">)</span><span class="br0">{</span>
$<span class="br0">(</span><span class="st0">'head'</span><span class="br0">)</span>.<span class="me1">append</span><span class="br0">(</span><span class="st0">'<link rel="stylesheet" type="text/css" href="dev.wikia.com/load.php?mode=articles&articles=u:dev:RecentChangesMultiple/stylesheet.css&only=styles">'</span><span class="br0">)</span><span class="sy0">;</span>
<span class="br0">}</span><span class="sy0">;</span></div></div>
<p>With the stylesheet being the one you want. But to make sure I understand what you want exactly (and that I'm not over thinking it), how were you thinking it would be done?
</p>
(Edited by Fewfre)
I have no idea exactly how you'd do it in terms of code :P
(Edited by Spydar007)
<p>Sorry, I guess I meant like were you thinking it would:
</p>
<p>As an update, I modified the script so it will work on mobile; however it's a bit of a hack, so "hidemyself=1" won't work ("hideusers" data attribute will), and rows won't collapse, but it should work now otherwise when you run the script on mercury / wikiamobile. Let me know if you encounter any issues. </p>
- be automatic (I see no good way to do this without a lot of random guesses at what styles to load)
- add specific scripts to a list to be loaded ex: ["u:dev:MediaWiki:common.css", "w:c:muppets:MediaWiki:Wikia.css", etc] (this could still have issues if it's not the same for monobook and normal wikia skin)
- something like above (same issues as second option, but gives a little more freedom with what people can do after the script loads).
- something else
<p>As an update, I modified the script so it will work on mobile; however it's a bit of a hack, so "hidemyself=1" won't work ("hideusers" data attribute will), and rows won't collapse, but it should work now otherwise when you run the script on mercury / wikiamobile. Let me know if you encounter any issues. </p>
(Edited by Fewfre)
<p>It doesn't work on my phone and PC browser (when i change the user agent to mobile). It seems Wikia doesn't load any modified JavaScript from MediaWiki:Common.js and MediaWiki:Wikia.js on their mobile skin
</p>
(Edited by Dai ca superman)
<p>Oh, sorry, thought you already knew that and had it loading somehow. I know a <abbr style="border-bottom:1px dotted currentColor;" title="You can put HTML tags such as <link/> for style sheets in MediaWiki:Wikiamobile-menu to load stuff on mobile">hack</abbr> that allows custom CSS on mobile wiki-wide (and am fairly sure it works with JavaScript), but I know of no way to actually load the script on mobile for a specific user.
</p>
(Edited by Fewfre)