MediaWiki:Common.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ jQuery( document ).ready( function( $ ) { // Code wrapped in this function will be executed when the document is ready // When the document is ready, jQuery calls this passed callback function like this: // callbackFunction( jQuery ); var divHidden=false; var varURL = window.location.href; var iframe='<iframe id="frame" name="widget" src ="'+ varURL +'" width="500px" height="500px" marginheight="0" marginwidth="0" frameborder="no" scrolling="yes"></iframe>'; var varEmbedlink = $('<a />', { text: 'Embed link', style:'cursor:pointer;margin-left:20px;margin-bottom:15px;font-size: 12px;display:inline-block', id:'Embedlink', click: function () { var divexist = $("#iframevalue").length; if(divexist==0) { var hiddenDiv ="<div id='iframevalue' style='padding-left:18px;' ><textarea rows='10' cols='50' id='iFrametext' style='width:130px;margin-bottom:10px;'>"+iframe+"</textarea></div>"; $("#Embedlink").after(hiddenDiv); divHidden=false; } else { if (divHidden) { $("#iframevalue").css('display','block'); $("#iFrametext").val(iframe); divHidden=false; } else { $("#iframevalue").css('display','none'); divHidden=true; } } } }); $("#p-addthis").after(varEmbedlink); });