Difference between revisions of "MediaWiki:Common.js"

From Symbol Copy
 
Line 2: Line 2:
 
var symbolAutoCopy= new Clipboard('.symbol_div_to_copy');
 
var symbolAutoCopy= new Clipboard('.symbol_div_to_copy');
 
var copy_notif_div=$("#copied_notif_msg");
 
var copy_notif_div=$("#copied_notif_msg");
 +
var isInMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  
 
$(".symbol_div_to_copy").click(function() {
 
$(".symbol_div_to_copy").click(function() {
 
   //alert( "Handler for .click() called." );
 
   //alert( "Handler for .click() called." );
// the_element=$(this);
+
  if(isInMobile){
// the_element.css("color", "white");
+
the_element=$(this);
// thisPos=$(this).position();
+
the_element.css("color", "white");
 +
thisPos=$(this).position();
 
 
// topPos=thisPos.top+ ($(this).outerHeight(true)-copy_notif_div.outerHeight(true))/2;
+
topPos=thisPos.top+ ($(this).outerHeight(true)-copy_notif_div.outerHeight(true))/2;
//topPos=thisPos.top + 2;
+
topPos=thisPos.top + 2;
// leftPos=thisPos.left+ ($(this).outerWidth(true)-copy_notif_div.outerWidth(true))/2;
+
leftPos=thisPos.left+ ($(this).outerWidth(true)-copy_notif_div.outerWidth(true))/2;
 
 
 
 
// copy_notif_div.css('top',topPos);   
+
copy_notif_div.css('top',topPos);   
// copy_notif_div.css('left',leftPos);
+
copy_notif_div.css('left',leftPos);
 
 
// copy_notif_div.addClass("disappearing");
+
copy_notif_div.addClass("disappearing");
 
 
// var is_presenting_copied_effect=true;
+
var is_presenting_copied_effect=true;
// setTimeout(function () {
+
setTimeout(function () {
// copy_notif_div.css('top',-5000);  
+
copy_notif_div.css('top',-5000);  
// copy_notif_div.removeClass("disappearing");     
+
copy_notif_div.removeClass("disappearing");     
// // $(the_element).css('border-color','#ff3300');
+
// $(the_element).css('border-color','#ff3300');
// is_presenting_copied_effect=false;
+
is_presenting_copied_effect=false;
// the_element.css("color", "black");
+
the_element.css("color", "black");
// }, 3000);  
+
}, 3000);  
 +
  }
 +
  else{
 
$(".mymodal").css("width","70%");
 
$(".mymodal").css("width","70%");
 
showCopyingModalDialog($(this).data("clipboard-text"));
 
showCopyingModalDialog($(this).data("clipboard-text"));
 +
  }
 
});
 
});
  

Latest revision as of 15:52, 2 June 2021

/* 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");
var isInMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

$(".symbol_div_to_copy").click(function() {
  //alert( "Handler for .click() called." );
  if(isInMobile){
	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); 
  }
  else{
	$(".mymodal").css("width","70%");
	showCopyingModalDialog($(this).data("clipboard-text"));
  }
});

$(".emojiblock").click(function() {
    location.href = $(this).find("a").attr('href');
});

function showCopyingModalDialog(theText){  

  $("#myModal").css("display", "block");
  $("#myModal").css("position", "fixed");
  $("#myModal").css("visibility", "visible");

  var theHTML = "<div><span class='the_copied_text'>"+theText + "</span></div><div><span class='the_copied_text_description'> has been <span class='emphasis'>copied</span>. Please paste anywhere! ";

  $("#modal_header").html(theHTML);
}
$("#modal-footer-close").on( "click", function() {
    $("#myModal").css("display", "none");
});
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-41694441-13', 'auto');
ga('send', 'pageview');

var _Hasync= _Hasync|| [];
_Hasync.push(['Histats.start', '1,3514282,4,0,0,0,00010000']);
_Hasync.push(['Histats.fasi', '1']);
_Hasync.push(['Histats.track_hits', '']);
(function() {
var hs = document.createElement('script'); hs.type = 'text/javascript'; hs.async = true;
hs.src = ('//s10.histats.com/js15_as.js');
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(hs);
})();