Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Sabahx
.
Toggle Highlighting
SQL
var textarea = document.getElementById("textarea"); var limit = 200; document.getElementById('wordsToWikify').value = "google, lol, awesome" $('.expandingTextArea').bind('keyup', function(){ textarea.style.height = ""; textarea.style.height = Math.min(textarea.scrollHeight, 300) + "px"; var theResult = generateWikiText(document.getElementById("textarea").value, document.getElementById("wordsToWikify").value.split(",")); document.getElementById("printStuff").innerHTML = theResult; document.getElementById("result").value = theResult; }); //alert(wikifyText("[[", "]]", "There are cars, be careful, carefully, and with great care!!", ["text", "hoogahjush", "wikify", "car", "careful", "carefully", "great care"])); //document.write(createWikipediaLinks("Hi, this is just a test. Car. Carry.", ["Carry", "Car", "test"])); function createWikipediaLinks(text, list){ //sort list into ascending order list.sort(function(a, b){ return b.length - a.length; // ASC -> a - b; DESC -> b - a }); list.reverse(); //replace every element in the array with the wikified text for(var i = 0; i < list.length; i++){ text = wikifyText("<a href = 'http://en.wikipedia.org/wiki/"+list[i]+"'>", "</a>", text, [list[i]]); } return text; } function wikifyText(startString, endString, text, list){ //sort list into ascending order list.sort(function(a, b){ return b.length - a.length; // ASC -> a - b; DESC -> b - a }); list.reverse(); //replace every element in the array with the wikified text for(var i = 0; i < list.length; i++){ text = text.replace(list[i], startString + list[i] + endString); } return text; } function generateWikiText(text, list){ //sort list into ascending order list.sort(function(a, b){ return b.length - a.length; // ASC -> a - b; DESC -> b - a }); list.reverse(); //replace every element in the array with the wikified text for(var i = 0; i < list.length; i++){ text = wikifyText("[[", "]]", text, [list[i]]); } return text; }
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...