User:Srhat/vector.js
Jump to navigation
Jump to search
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac);
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5;
- Konqueror: simply click the Reload button, or press F5;
- Opera users may need to completely clear their cache in Tools→Preferences.
Warning: Malicious code can compromise your account. Page preview will cause your web browser to execute this page's content as code under some skins, including Monobook. If you have any questions about any code you plan to add, you can ask at the appropriate reading room. |
The accompanying .css page for this skin is at User:Srhat/vector.css. |
$(document).ready( function() {
$(".exercise-answer").each( function() {
var lheight = $(this).css("line-height");
$(this).wrap('<span class="exercise-answer-c" />');
$(this).css({"bottom": lheight} );
$(this).parent(".exercise-answer-c").css("height", lheight);
});
$(".exercise-answer-c").click().toggle( function() {
$(this).children(".exercise-answer").animate({"bottom": "0px"});
}, function() {
var lheight = $(this).css("line-height");
$(this).children(".exercise-answer").animate({"bottom": lheight});
});
$("table.box button img").attr({ src: "http://upload.wikimedia.org/wikipedia/commons/thumb/9/93/View-playback_Gion_simple.svg/20px-View-playback_Gion_simple.svg.png", width: "20", height: "20" });
});
$(".maintext").hover( function() {
if (!$(this).parents().hasClass("tbox")) {
var pos = $(this).position(); // position of the 'maintext'
$(this).wrap('<div class="tbox" />'); // make 'maintext' a part of 'tbox'
var tbox = $(this).parent(".tbox");
$(this).data('title',$(this).attr('title'));
var tooltip = $(this).data("title");
$(this).removeAttr('title'); // remove title to prevent native tooltip
tbox.append('<div class="tooltip">' + tooltip + "</div>"); // add the tooltip text
tbox.css( { "display": "block", "left": (pos.left-13) + "px", "top": (pos.top-9) + "px" } ); // set the position of the 'tbox'
$(this).clone().insertBefore(tbox).attr("id", "ctext"); // place a clone of the 'maintext' as a placeholder
}
}, function() {
var tbox = $(this).parent(".tbox");
var clone = tbox.prev("#ctext");
clone.remove(); //remove clone
$(this).insertBefore(tbox); //replace 'maintext'
var tbox = $(this).siblings(".tbox"); //tbox is no longer parent
tbox.remove();
$(this).attr('title',$(this).data("title")); //replace 'title' for another hover event
} );
/*
$(".suffix").mouseover(showMenu);
var showMenu = function(ev) {
//get the position of the placeholder element
var pos = $(".suffix").offset();
var width = $(".suffix").width();
//show the menu directly over the placeholder
$(".tbox").css( { "left": (pos.left + width) + "px", "top":pos.top + "px" , "display":"inline-block"} );
}
$("#placeholder").mouseover(showMenu);
var showMenu = function(ev) {
//get the position of the placeholder element
var pos = $("#placeholder").offset();
var width = $("#placeholder").width();
//show the menu directly over the placeholder
$("#menu").css( { "left": (pos.left + width) + "px", "top":pos.top + "px" } );
$("#menu").show();
}
*/