Content deleted Content added
Joshua Scott (talk | contribs) add option to hide diff |
<maintenance> more info TypeError: Cannot read properties of null (reading 'parentNode') Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
(22 intermediate revisions by 4 users not shown) | |||
Line 5:
var pendch_num_idle_req;
var pendch_curr_idle_req;
var pendch_diffonly;
var pendch_str_no_ajax = "There seems to be a problem using the
var pendch_str_box_title = "Pending changes";
var pendch_str_box_title_updating = "Pending
var pendch_str_box_title_failed = "Pending changes (update failed)";
var pendch_str_enable = "Enable this box";
var pendch_str_disable = "Disable this box";
/* initalise */
function pendch_init() {
var currURL = window.___location.toString();
var newURL=currURL.replace(/diffonly=1/,diffonly=0);▼
console.log(document.getElementById("difference").innerHTML
if (document.getElementById("difference").innerHTML.search(/Show page below diff/) == -1) {
document.getElementById("difference").innerHTML += ' (<a href="' + newURL + '">Show page below diff</a>)';
}▼
}▼
// allow user settings through
if (pendch_enabled == null) {
Line 33 ⟶ 41:
pendch_num_idle_req = 60;
}
if
}
▲ }
// A few limits to be nice to the servers
if (pendch_num_pages > 50) {
Line 92:
try {
pendch_http = new XMLHttpRequest();
} catch (e) {
try {
Line 129 ⟶ 128:
}
▲ if (window.___location.pathname.match(/diffonly=1/) == -1) {
▲ var newURL=currURL.replace(/diffonly=1/,diffonly=0);
▲ document.getElementById("difference").innerHTML += ' (<a href="' + newURL + '">Show page below diff</a>)';
▲ }
if (pendch_create_request () == false) {
if (cur_box != null) {
Line 143 ⟶ 135:
}
}
// Get the current time
var dateobj = new Date();
var now = Math.floor(dateobj.getTime() / 1000.0);
// Then make the request
pendch_http.open("GET", "/w/api.php?action=query&format=
pendch_http.send(null);
}
function pendch_draw_disabled_box() {
if (mw.config.get('skin') == 'vector') {
pendch_draw_disabled_box_vector();
} else {
Line 165 ⟶ 154:
function pendch_ajax_response() {
if (mw.config.get('skin') == 'vector') {
pendch_ajax_response_vector();
} else {
Line 196 ⟶ 185:
var div = document.createElement('div');
div.setAttribute('id', 'p-pendingchanges');
div.className = '
var heading = document.createElement('
heading.appendChild(document.createTextNode(pendch_str_box_title));
div.appendChild(heading);
Line 219 ⟶ 208:
} else {
var node = document.getElementById('p-search');
if ( node && node.parentNode === side_col ) {
side_col.insertBefore(div, node);
}
}
}
Line 225 ⟶ 216:
/* Draw response (monobook) */
function pendch_ajax_response_monobook() {
var resp = JSON.parse(pendch_http.responseText);
var items = resp.query.oldreviewedpages;
// create the div that holds all the
var link_div = document.createElement('div');
link_div.className = 'pBody';
Line 236 ⟶ 228:
// populate the list with 10 links.
for (var i = 0; i < items.length; i++) {
var
var old_id = item.stable_revid;
item_name = item_name.replace(/&/, "%26");
a = document.createElement('a');
Line 254 ⟶ 247:
var div = document.createElement('div');
div.setAttribute('id', 'p-pendingchanges');
div.className = '
var heading = document.createElement('
heading.appendChild(document.createTextNode(pendch_str_box_title));
div.appendChild(heading);
Line 292 ⟶ 285:
div.setAttribute('id', 'p-pendingchanges');
div.className = 'portal collapsed';
var heading = document.createElement('
heading.appendChild(document.createTextNode(pendch_str_box_title));
div.appendChild(heading);
Line 317 ⟶ 310:
}
if( typeof $
$
if ( event.which == 13 /* Enter */ || event.which == 32 /* Space */ ) {
pendch_toggle( $
}
} )
.mousedown( function() {
pendch_toggle( $
$
return false;
} );
Line 336 ⟶ 329:
function pendch_ajax_response_vector() {
var resp = JSON.parse(pendch_http.responseText);
var items = resp.query.oldreviewedpages;
// create the div that holds all the
var link_div = document.createElement('div');
link_div.className = 'body';
Line 347 ⟶ 341:
// populate the list with 10 links.
for (var i = 0; i < items.length; i++) {
var
var old_id = item.stable_revid;
item_name = item_name.replace(/&/, "%26");
a = document.createElement('a');
Line 367 ⟶ 362:
div.setAttribute('id', 'p-pendingchanges');
div.className = 'portal expanded';
var heading = document.createElement('
heading.appendChild(document.createTextNode(pendch_str_box_title));
div.appendChild(heading);
Line 393 ⟶ 388:
}
if( typeof $
$
if ( event.which == 13 /* Enter */ || event.which == 32 /* Space */ ) {
pendch_toggle( $
}
} )
.mousedown( function() {
pendch_toggle( $
$
return false;
} );
Line 410 ⟶ 405:
function pendch_toggle( $element ) {
$
if( $element.parent().is('.collapsed') ) {
pendch_enable_box();
|