Fix and Creative Commons license code for Wikipedia provider with Jquery Oembed

new $.fn.oembed.OEmbedProvider(“wikipedia”, “rich”, [“wikipedia.org/wiki/.+”], “http://$1.wikipedia.org/w/api.php?action=parse&page=$2&format=json&section=0&callback=?”,{

templateRegex:/.*\/\/([\w]+).*\/wiki\/([^\/]+).*/,

templateData : function(data){if(!data.parse)return false;

var text1 = data.parse[‘text’][‘*’];

text2 =encodeURI(text1);

var regex = new RegExp(“/wiki/”, ‘gi’);

text3 = text2.replace(regex, “http://en.wikipedia.org/wiki/”);

text = decodeURI(text3);

var css = document.createElement(“style”);

css.type = “text/css”;

css.innerHTML = “.error.mw-ext-cite-error,.metadata.plainlinks.ambox.ambox-content.ambox-Refimprove,.dablink { display: none; } .infobox{float: right; }”;

document.body.appendChild(css);

return ‘<div id=”content”><h3><a class=”nav-link” href=”http://en.wikipedia.org/wiki/’+data.parse[‘displaytitle’]+'”>’+data.parse[‘displaytitle’]+'</a></h3>’+text+'<br /></div><ul>Text is available under the <a href=”//en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License”>Creative Commons Attribution-ShareAlike License</a><a href=”//creativecommons.org/licenses/by-sa/3.0/” “></a> additional terms may apply.</ul>’;

}

}),

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>