MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
David Mason (talk | contribs) No edit summary |
David Mason (talk | contribs) No edit summary |
||
Line 25: | Line 25: | ||
hideNav(); | hideNav(); | ||
$('#wnavcontrol').after('<a onclick=" | $('#wnavcontrol').after('<a onclick="clickSupport()">Support</a>'); | ||
FB.init({appId: 129531840449132, status: true, cookie: true}); | FB.init({appId: 129531840449132, status: true, cookie: true}); | ||
Line 56: | Line 56: | ||
function | function clickSupport() { | ||
document.write('<script src="http://connect.facebook.net/en_US/all.js"></script>'); | document.write('<script src="http://connect.facebook.net/en_US/all.js"></script>'); | ||
// Assign an internal ID that points to a database record | // Assign an internal ID that points to a database record |
Revision as of 16:55, 14 April 2011
var wnavcontrol = false;
function showNav() {
$(".noprint").show();
$('#content').css('margin-left', '10em');
$('#wnavcontrol').remove();
var dshow = "<span id='wnavcontrol' onclick='hideNav()' style='float: right; font-weight: bold; color: blue'>-Wiki</span>";
$('#firstHeading').before(dshow).fadeIn();
}
function hideNav() {
$(".noprint").hide();
$('#content').css('margin-left', '0em').css('padding', '0.2em').css('background-image', 'none');
if (wnavcontrol) {
$('#wnavcontrol').remove();
}
var dshow = "<span id='wnavcontrol' onclick='showNav()' style='float: right; font-weight: bold; color: blue'>+Wiki</span>";
$('#firstHeading').before(dshow).fadeIn();
wnavcontrol = true;
}
onload=function(){
$('#firstHeading').wrap('<div style="width: 100%" />');
hideNav();
$('#wnavcontrol').after('<a onclick="clickSupport()">Support</a>');
FB.init({appId: 129531840449132, status: true, cookie: true});
if (document.getElementsByClassName == undefined) {
document.getElementsByClassName = function(className) {
var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
var allElements = document.getElementsByTagName("*");
var results = [];
var element;
for (var i = 0; (element = allElements[i]) != null; i++) {
var elementClass = element.className;
if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
results.push(element);
}
return results;
}
}
makeExt('external');
function makeExt(lclass) {
links = document.getElementsByClassName(lclass);
// add onClick handler to links
for (var i = 0; (element = links[i]) != null; i++) {
element.href = "/frame/?l="+escape(element.href);
}
}
}
function clickSupport() {
document.write('<script src="http://connect.facebook.net/en_US/all.js"></script>');
// Assign an internal ID that points to a database record
var order_info = 'canbudget';
// calling the API ...
var obj = {
method: 'pay',
order_info: order_info,
purchase_type: 'item'
};
FB.ui(obj, callback);
}
var callback = function(data) {
if (data['order_id']) {
return true;
} else {
//handle errors here
return false;
}
};
function writeback(str) {
document.getElementById('output').innerHTML=str;
}