MediaWiki:Perbook/Turkish.js

/* Tooltip for use in Template:Turkish/Tooltip $(".maintext").hover( function { if (!$(this).parents.hasClass("tbox")) { var pos = $(this).position; // position of the 'maintext' $(this).wrap(' '); // 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(' ' + tooltip + " "); // 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 } );