Changes

Jump to navigation Jump to search
1,449 bytes removed ,  12:45, 19 December 2018
Info on ECMAScript 6
* Get [[MediaWiki/js]]* [[User Scriptswp:Greasemonkey]] ala Grease Monkey or Userscripts.org([httphttps://phifferaddons.mozilla.org Dan Phiffer] wrote this little greasemonkey script that turns any mediawiki article into a slide presentation<source lang="javascript">/en-US/ ==UserScript==firefox/addon/ @name Wikipedia Presentation748 here]) so that you can have your browser be even more useful. You might even want to use [http:// @namespace monkey.coolspacer.com/ Super Greasemonkey] if you like using the awesome [http://phifferjquery.orgcom/// @description Turn a Wikipedia article JQuery] library. I'm hoping that Super Greasemonkey makes it into a presentation// ==/UserScript==the official version, and that you can specify in your script which JQuery library to run (like Google's hosted JQuery scripts) making it easier to keep compatibility with the JQuery API version and also avoiding the need to bundle JQuery.
var wikipedia_presentation = {* [[MediaWiki/js]] talks about using JavaScript in MediaWikisetup: function() {* User Scripts are JavaScripts that you insert into your web browser such as Greasemonkey scripts. Userscripts.org is the open source repository of Grease Monkey scripts.* [[MediaWiki/Presentation]] describes methods to produce presentations from your wiki
this.sections = = JavaScript Libraries ==JQuery is included with [[Drupal]];, and is also used in many other projects.In thisslideshow, you can [http://slideshow.pos = 0;rubyforge.org/jquery.html compare JQuery with Prototype]
var body = document.getElementsByTagName('body')[0];
this.orig_markup = body.innerHTML;
var markup = body.innerHTML;
var start = 0;
var end = markup.indexOf('<span class="editsection"');
while (end != -1) {
start = markup.indexOf('</span>', end);
end = markup.indexOf('<span class="editsection"', start);
if (end == -1) {
end = markup.indexOf('<div class="printfooter">', start);
this.sections.push(markup.substr(start, end - start));
end = -1;
}
this.sections.push(markup.substr(start, end - start));
}
if (this.sections.length > 0) {
var div = document.getElementById('bodyContent');
var link = div.insertBefore(document.createElement('a'), div.firstChild);
link.innerHTML = 'Start presentation';
link.setAttribute('href', '#presentation');
link.addEventListener('click', this.start, false);
}
},
start=== [http: function() {var body = document//underscorejs.org/ Underscore.getElementsByTagName('body')[0js];body.innerHTML = '';body.style.textAlign = 'center';=
var prev = body.appendChild(documentUnderscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects.createElement('It�s the answer to the question: �If I sit down in front of a'));prev.innerHTML = '&larr; Prev';prev.setAttribute('href'blank HTML page, '#prev');prev.style.font = '11px verdanaand want to start being productive immediately, sans-serifwhat do I need?� � and the tie to go along with jQuery';prev.addEventListener(s tux and Backbone'click', function() {wikipedia_presentations suspenders.prev();}, false);
body== JavaScript Callbacks ==A great explanation of what are Callbacks and how to use them: http://javascriptissexy.appendChild(document.createTextNode(' com/understand-javascript-callback-functions-and-use-them/ '));
var stop = body.appendChild(document.createElement('a'));stop.innerHTML = 'Exit';stop.setAttribute('href', '#exit');stop.style.font JavaScript SourceMaps == '11px verdana, sans-serif';stop.addEventListener('click', function() {wikipedia_presentation.stop();}, false);Debug minified sources in FireFox or Chrome
body* [https://www.appendChild(documenthtml5rocks.createTextNode(' com/en/tutorials/developertools/sourcemaps/ tutorial]* [https://developer.mozilla.org/en-US/docs/Tools/Debugger/ '));Source_map_errors Debugging Source map errors]
var next = body.appendChild(document.createElement('a'));next.innerHTML = 'Next &rarr;';next.setAttribute('href', '#next');next.style.font JavaScript 6 = '11px verdana, sans-serif';next.addEventListener('click', function() {wikipedia_presentation.next();}, false); var slide = body.appendChild(document.createElement('div'));slide.setAttribute('id', 'wikipedia_presentation'); slide.style.width = '780px';* Basic overviews:slide** [https://github.stylecom/lukehoban/es6features https://github.margin = '10px 10px 10px 20px';slide.style.textAlign = 'left';slide.style.font = '2em verdana, sans-serif'; slide.innerHTML = wikipedia_presentation.sections[0com/lukehoban/es6features];var items = slide.getElementsByTagName('li');for (var i = 1; i < items.length; i++) {items** [i].style.display = 'none';} document.addEventListener('keypress', wikipedia_presentation.keypress, false);}, stophttps: function() {var body = document//blog.getElementsByTagName('body')[0];bodypragmatists.innerHTML = wikipedia_presentation.orig_markup;body.style.textAlign = 'left';wikipedia_presentation.setup();document.removeEventListener('keypress', wikipedia_presentation.keypress, false);}, keypresscom/top-10-es6-features-by-example-80ac878794bb https: function(event) {if (event//blog.keyCode == 39) {wikipedia_presentationpragmatists.next();} else if (event.keyCode == 37) {wikipedia_presentation.prev();}}, prev: function() {this.poscom/top-10-es6-features-;if (this.pos == by-1) {this.pos = this.sections.length example- 1;80ac878794bb]}* Outstanding book:var slide = document** [http://exploringjs.getElementById('wikipedia_presentation');slidecom/es6/ http://exploringjs.innerHTML = wikipedia_presentation.sections[this.poscom/es6/];}, next: function() { var slide = document* The "Can I use?".getElementById('wikipedia_presentation');var items = slide.getElementsByTagName('li'); var hidden = 0;for (var i = 0; i < items.length; i++) {if (items** [i]https://kangax.stylegithub.display == 'none') {hidden++;}} if (hidden > 0) {items[items.length io/compat- hidden]table/es6/ https://kangax.stylegithub.display = 'listio/compat-item';return;} this.pos++;if (this.pos == this.sections.length) {this.pos = 0;}slide.innerHTML = wikipedia_presentation.sections[this.postable/es6/];var items = slide.getElementsByTagName('li');for (var i = 1; i < items.length; i++) {* Sandbox:items** [i]https://es6console.style.display = 'none';} }}; wikipedia_presentationcom/ https://es6console.setup(); <com/source>]
[[Category:JavaScript]]
[[Category:Wiki]]
[[Category:Front-end]]
[[Category:Back-end]]
[[Category:Server]]
[[Category:Node]]
[[Category:Node.js]]
[[Category:Source]]
[[Category:Programming]]
[[Category:Code]]

Navigation menu