MediaWiki:Common.js/w/Wikibooks:Dialog/echo

/* For. See Special:WhatLinksHere/. */

function reservedParams { return { 'DIALOG-ECHO-VERSION': '0.3 (2015-11-10)' }; }

function primaryVerb { function doEcho(actionParams, authData, other) { function handleRollback { $('input.wikidialog-echo-rollback').attr('disabled',true); if (window.wikidialog.rollback) return; alert("Sorry, something's gone wrong; unable to go back using this button."); $('input.wikidialog-echo-rollback').attr('disabled',false); }       //        // message at the top //       var s = ' Echo dialog data '; if (window.wikidialog.canRollback) { s += '\n To return to the previous display, use this button: ' + ' x ' + '; or the "back" navigation function on your browser. ';       }        //        // data fields //       for (var p in actionParams) { if (actionParams[p]) { s += '\n \n ' + p + ': \n  '; } else { s += '\n \n ' + p + ' '; }       }        //        // authentication //       s += '\n  \n  '; s += '\n origin: ' + authData.origin + ' '; s += ' proxy: ' + authData.proxy + ' '; //       // other //       if (other.length > 0) { s += '\n \n  '; for (var k = 0; k < other.length; k++) { if (k > 0) s += ','; s += ' ' + other[k]; }       }        //        // message at the bottom //       s += '\n  \n  ' + 'To examine dialog states currently stored, you can consult the diagnostic panel; if you have just arrived here, ' + 'the most recently listed dialog state on the panel should be the one ' + "you got here from. The data set shown here won't be listed on the " + "panel, but should be accessible using the panel's expert mode."; //       // show //       $('div.wikidialog-echo').replaceWith(s); $('.wikidialog-echo-rollback').replaceWith(function {            return $(document.createElement('input')).attr('type','button')                .addClass('wikidialog-echo-rollback').val('back')                .attr('title','back').click(handleRollback);        }); }   window.wikidialog.receiveAnonymous(        function  {            var actionParams = this;            var r = reservedParams;            for (var p in r) {                actionParams[p] = r[p];            }            var authData = arguments[0];            var other = [];            for (var k = 1; k < arguments.length; k++) {                other[k - 1] = arguments[k];            }            doEcho(actionParams, authData, other);        }    ); }

$.getScript( // MediaWiki:Dialog/receive   mw.config.get('wgScript') + '?title=' + mw.util.wikiUrlencode('MediaWiki:Dialog/receive') + '&action=raw&ctype=text/javascript',    primaryVerb );