v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "User:Emi/review.js"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
Line 30: Line 30:
 
api_orphan.onreadystatechange = rater_prc_orphan;
 
api_orphan.onreadystatechange = rater_prc_orphan;
 
api_orphan.send(null);
 
api_orphan.send(null);
document.getElementById('rater_orphan').innerHTML += "... ";
 
 
}
 
}
  
 
function rater_prc_orphan(_api) {
 
function rater_prc_orphan(_api) {
 +
document.getElementById('rater_orphan').innerHTML += "1";
 
if(_api.readyState==4) {
 
if(_api.readyState==4) {
 +
document.getElementById('rater_orphan').innerHTML += "2";
 
if(_api.status==200) {
 
if(_api.status==200) {
 +
document.getElementById('rater_orphan').innerHTML += "3";
 
if(_api.responseText.indexOf("No pages link to") == -1){
 
if(_api.responseText.indexOf("No pages link to") == -1){
 
    document.getElementById('rater_orphan').innerHTML += '<div class="rater_green">NO</div>';
 
    document.getElementById('rater_orphan').innerHTML += '<div class="rater_green">NO</div>';

Revision as of 00:44, 22 May 2010

addOnloadHook(
  function rater_addLink() {
    addPortletLink("p-cactions", "javascript:rater_init()", "Rate", "ca-rater", "Rate");
  }
);

function rater_init() {
var rater_PageName = wgPageName.replace(/_/g, ' ');

  if (!wfSupportsAjax()) {
    jsMsg('<span style="color:red; font-size:120%">Your browser does not seem to support AJAX, which is required for the rating script.</span>');
    return;
  }

jsMsg('<h3>Rating '+rater_PageName+'</h3><div id="rater_div"></div>');
rater_autotests();
}

function rater_autotests() {
var rater_PageName = wgPageName.replace(/_/g, ' ');

document.getElementById('rater_div').innerHTML += '<div id="rater_orphan">Is page orphaned</div>';
document.getElementById('rater_div').innerHTML += '<div id="rater_deadend">Is page deadend... </div>';
document.getElementById('rater_div').innerHTML += '<div id="rater_redlink">How many redlinks does page contain... </div>';
document.getElementById('rater_div').innerHTML += '<div id="rater_length">How long (approximately) is the article... </div>';
document.getElementById('rater_div').innerHTML += '<div id="rater_cats">Is the page in any categories...</div>';

var api_orphan = sajax_init_object();
api_orphan.open('GET', 'http://df.magmawiki.com/index.php/Special:WhatLinksHere/' + rater_PageName, true);
api_orphan.onreadystatechange = rater_prc_orphan;
api_orphan.send(null);
}

function rater_prc_orphan(_api) {
document.getElementById('rater_orphan').innerHTML += "1";
	if(_api.readyState==4) {
document.getElementById('rater_orphan').innerHTML += "2";
		if(_api.status==200) {
document.getElementById('rater_orphan').innerHTML += "3";
			if(_api.responseText.indexOf("No pages link to") == -1){
			     document.getElementById('rater_orphan').innerHTML += '<div class="rater_green">NO</div>';
                        }else{
			     document.getElementById('rater_orphan').innerHTML += '<div class="rater_red">YES</div>';                        
                        }
		} else {
			document.getElementById('rater_orphan').innerHTML += 'Unknown (error)';
		}
	}
}