MediaWiki:Common.js: Difference between revisions

From RESTORE
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
Line 37: Line 37:
});
});
$("#p-addthis").after(varEmbedlink);
$("#p-addthis").after(varEmbedlink);
                $(".thumb").parent().css("float","left");
                $(".thumb").parent().css("margin-left","5px"); 
});
});

Latest revision as of 09:24, 10 September 2013

/* 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);
                $(".thumb").parent().css("float","left");
                $(".thumb").parent().css("margin-left","5px");  
});