Difference between revisions of "MediaWiki:Common.js"

From CSE330 Wiki
Jump to navigationJump to search
m
m
Line 4: Line 4:
 
 
 
var gPlusStr = '<g:plusone size="standard"></g:plusone>';
 
var gPlusStr = '<g:plusone size="standard"></g:plusone>';
 
 
var navig = document.getElementById("p-navigation");
 
var navig = document.getElementById("p-navigation");
 
 
var container = document.createElement("div");
 
var container = document.createElement("div");
 
 
navig.parentNode.insertBefore(container, navig.nextSibling);
 
navig.parentNode.insertBefore(container, navig.nextSibling);
 
 
container.innerHTML = gPlusStr;
 
container.innerHTML = gPlusStr;
 
 
 
window.___gcfg = {
 
window.___gcfg = {
  lang: 'zh-CN',
+
lang: 'zh-CN',
  parsetags: 'onload'
+
parsetags: 'onload'
};
+
};
(function() {
+
(function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
+
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
+
po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
+
})();
 
 
 
});
 
});

Revision as of 05:46, 7 October 2013

/* Any JavaScript here will be loaded for all users on every page load. */

document.addEventListener("DOMContentLoaded", function(){
	
	var gPlusStr = '<g:plusone size="standard"></g:plusone>';
	var navig = document.getElementById("p-navigation");
	var container = document.createElement("div");
	navig.parentNode.insertBefore(container, navig.nextSibling);
	container.innerHTML = gPlusStr;
	
	window.___gcfg = {
		lang: 'zh-CN',
		parsetags: 'onload'
	};
	(function() {
		var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
		po.src = 'https://apis.google.com/js/plusone.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
	})();
	
});