MediaWiki:Common.js

From Symbol Copy
Revision as of 14:38, 9 April 2021 by Fk (talk | contribs) (Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: var symbolAutoCopy= new Clipboard('.symbol_div_to_copy'); var copy_notif_div=$("#copied_notif_msg");...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After saving, 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: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */
var symbolAutoCopy= new Clipboard('.symbol_div_to_copy');
var copy_notif_div=$("#copied_notif_msg");

$(".symbol_div_to_copy").click(function() {
  //alert( "Handler for .click() called." );
	the_element=$(this);
	the_element.css("color", "white");
	thisPos=$(this).position();
	
	topPos=thisPos.top+ ($(this).outerHeight(true)-copy_notif_div.outerHeight(true))/2;
	//topPos=thisPos.top + 2;
	leftPos=thisPos.left+ ($(this).outerWidth(true)-copy_notif_div.outerWidth(true))/2;
	
	
	copy_notif_div.css('top',topPos);   
	copy_notif_div.css('left',leftPos);
	
	copy_notif_div.addClass("disappearing");
	
	var is_presenting_copied_effect=true;
	setTimeout(function () {
		copy_notif_div.css('top',-5000); 
		copy_notif_div.removeClass("disappearing");    
		// $(the_element).css('border-color','#ff3300');
		is_presenting_copied_effect=false;
		the_element.css("color", "black");
	}, 3000); 
});