MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
 
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
mw.loader.using('mediawiki.user', function () {
$('tr').css('height : 1px');
$("#editcountgo").click(function() {


if ($.inArray("CMEUser", mw.config.get('wgUserGroups')) != "-1") {
var urlstring = "/api.php?action=query&list=users&usprop=editcount&format=json&ususers=";
$.getScript('http://www.wikidoc.org/includes/raty/jquery.timer.js', function () {
urlstring = urlstring + $("#editcountuser").val();
var Obj1 = new(function () {
$.get( urlstring, function( data ) {
var $timer1,
alert(data.query.users[0].editcount);
incrementTime = 100,
});
currentTime = 0,
updateTimer = function () {
$timer1.html(currentTime);
currentTime += incrementTime;
if (currentTime == 30000) {
if (window.location.pathname === "/index.php") {
var path = window.location.search.substring(1, window.location.search.length)
} else {
var path = window.location.pathname.substring(11, window.location.pathname.length)
}
var api = new mw.Api();
api.get({
action : 'updatetracker',
page : wgPageName,
                                                                activity : wgAction,
}).done(function (data) {
console.log(data);
});


currentTime = 0;
}
},
init = function () {
$timer1 = $('#output1');
window.Timer1 = $.timer(updateTimer, incrementTime, true);
};
this.pause = function () {
window.Timer1.pause().once();
};
this.play = function () {
if (!this.Timer.isActive) {
window.Timer1.play().once();
}
};
$(init);
});
var Obj2 = new(function () {
var $timer2,
incrementTime = 100,
currentTime = 120000,
updateTimer = function () {
$timer2.html(currentTime);
currentTime -= incrementTime;
if (currentTime === 100) {
window.Timer1.pause();
alert("Click OK to continue accruing CME Time");
window.Timer2.pause().once();
currentTime = 5000;
}
},
init = function () {
$timer2 = $('#output2');
window.Timer2 = $.timer(updateTimer, incrementTime, true);
};
this.resetTimer = function () {
currentTime = 120000;
if (!window.Timer2.isActive) {
window.Timer2.play().once();
}
window.Timer1.play();
}
$(init);
});
$(document).keypress(function () {
Obj2.resetTimer();
});
$(document).click(function () {
Obj2.resetTimer();
});
$(document).mousemove(function () {
Obj2.resetTimer();
});
$(document).scroll(function () {
Obj2.resetTimer();
});
});
}
});
$("#imageHolder").ready(function () {
    $("#imageHolder div").each(function () {
        var imgPos = $("#imageHolder").position();
        var top = Math.round(parseInt($(this).attr("data-top")) + imgPos.top);
        var left = Math.round(parseInt($(this).attr("data-left")) + imgPos.left);
        $(this).css({
            "position" : "absolute",
            "top" : top,
            "left" : left
        });
        $(this).html("<audio src='" + $(this).attr("data-src") + "'></audio>");
        $(this).children("audio").trigger('load');
        $(this).click(function () {
            if ($(this).children("audio")[0].paused) {
                $(this).children("audio").trigger('play');
            } else {
                $(this).children("audio").trigger('pause');
            }
        });
    });
});
$(".soundBox").mouseover(function(){
$(".soundBox").css('cursor','finger');
}).mouseout(function(){
$(".soundBox").css('cursor','auto');
});
});

Latest revision as of 08:53, 20 January 2021

	
$("#editcountgo").click(function() {

var urlstring = "/api.php?action=query&list=users&usprop=editcount&format=json&ususers=";
urlstring = urlstring + $("#editcountuser").val();
$.get( urlstring, function( data ) {
	alert(data.query.users[0].editcount);
	});

});