Suggestions and comments about the ReactOS website
Moderator: Moderator Team
-
learn_more
- Developer
- Posts: 246
- Joined: Fri Dec 19, 2014 10:00 pm
Post
by learn_more »
Updated the script.
The end result:
[ external image ]
The userscript:
Code: Select all
// ==UserScript==
// @name ros-dev Expand threaded view inline
// @namespace https://www.reactos.org/pipermail/ros-dev/
// @version 0.3
// @description try to take over the world!
// @author Mark Jansen
// @match https://www.reactos.org/pipermail/ros-dev/*/thread.html
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
/* jshint -W097 */
'use strict';
$('li a').each(function() {
var href = $(this).attr('href');
var ohref = this.href;
if (typeof href !== typeof undefined && ohref != href && ohref.indexOf('#') < 0) {
var span = $('<span>[+] </span>').insertBefore($(this));
var href = this.href; // Full href (for loading)
var id = $(this).attr('href').replace(/\.[^/.]+$/, ""); // partial href (to use as id)
var parent = $(this).parent();
var oth = parent.children('ul');
var loading = $('<div class="' + id + '" style="display: none;">Loading...</div>');
if (oth.length > 0) {
loading.insertBefore(oth.first());
} else {
loading.appendTo(parent);
}
span.addClass(id).css('font-family', 'Courier, monospace').css('cursor', 'pointer');
span.on('click', {id:id, href:href}, function(e){
var id = e.data.id;
var href = e.data.href;
$('div.' + id).toggle().load(href + ' pre');
$('span.' + e.data.id).text('[-] ');
$(this).off('click').on('click', {id:id}, function(e){
elem = $('div.' + e.data.id);
$('span.' + e.data.id).text(elem.is(":visible") ? '[+] ' : '[-] ');
elem.toggle();
});
});
}
});
I am not responsible for your pc exploding.
Last edited by
learn_more on Wed Mar 23, 2016 10:09 pm, edited 3 times in total.
-
dizt3mp3r
- Posts: 1874
- Joined: Mon Jun 14, 2010 5:54 pm
Post
by dizt3mp3r »
Feck... my PC exploded, I'm covered with chips.
[ external image ]
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
-
learn_more
- Developer
- Posts: 246
- Joined: Fri Dec 19, 2014 10:00 pm
Post
by learn_more »
Updated the script, now there are [+] items that will collapse / expand,
and clicking the title will bring you to the single item.
for reference, the old version:
[spoiler]
http://i.imgur.com/136GgLH.gif
The userscript:
Code: Select all
// ==UserScript==
// @name Expand threaded view inline
// @namespace http://www.reactos.org/
// @version 0.1
// @description try to take over the world!
// @author Mark Jansen
// @match https://www.reactos.org/pipermail/ros-dev/*/thread.html
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
/* jshint -W097 */
'use strict';
$('li a').each(function() {
var href = $(this).attr('href');
var ohref = this.href;
if (typeof href !== typeof undefined && ohref != href && ohref.indexOf('#') < 0) {
$(this).on('click', function(e){
e.preventDefault();
var parent = $(this).parent();
var oth = parent.children('ul');
var target;
if (oth.length > 0) {
target = $('<div></div>').insertBefore(oth.first());
} else {
target = $('<div></div>').appendTo(parent);
}
var href = this.href; // Full href (for loading)
var id = $(this).attr('href').replace(/\.[^/.]+$/, ""); // partial href (to use as id)
$(this).attr('id', id);
target.load(href + ' pre', function(){ $(this).addClass(id); });
$(this).off('click').on('click', function(e){
e.preventDefault();
id2 = $(this).attr('id');
$('div.' + id).toggle();
});
});
}
});
[/spoiler]
-
Black_Fox
- Posts: 1584
- Joined: Fri Feb 15, 2008 9:44 pm
- Location: Czechia
Post
by Black_Fox »
This is brilliant!
Firefox Addons webpage says the lowest supported Firefox version is 46 (not released yet), so it'll work with it as well.
Users browsing this forum: No registered users and 1 guest