Difference between revisions of "MediaWiki:Common.js"
From CSE330 Wiki
Jump to navigationJump to search (Use JavaScript to add G+ to sidebar) |
m |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
− | var gPlusStr = '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script><g:plusone size="standard"></g:plusone>'; | + | document.addEventListener("DOMContentLoaded", function(){ |
− | + | ||
− | var navig = document.getElementById("p-navigation"); | + | var gPlusStr = '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script><g:plusone size="standard"></g:plusone>'; |
− | + | ||
− | var container = document.createElement("div"); | + | var navig = document.getElementById("p-navigation"); |
− | container.innerHTML = gPlusStr; | + | |
− | + | var container = document.createElement("div"); | |
− | navig.parentNode.insertBefore(container, navig.nextSibling); | + | container.innerHTML = gPlusStr; |
+ | |||
+ | navig.parentNode.insertBefore(container, navig.nextSibling); | ||
+ | |||
+ | }); |
Revision as of 05:40, 7 October 2013
/* Any JavaScript here will be loaded for all users on every page load. */
document.addEventListener("DOMContentLoaded", function(){
var gPlusStr = '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script><g:plusone size="standard"></g:plusone>';
var navig = document.getElementById("p-navigation");
var container = document.createElement("div");
container.innerHTML = gPlusStr;
navig.parentNode.insertBefore(container, navig.nextSibling);
});