MediaWiki:Mobile.js
Jump to navigation
Jump to search
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
var id, timeOut, timeOutShow, origin, mouseWhere='', container = $("body"), count=0; // endvar function clickClose(i) { $('#close-'+ i).trigger('click'); } function getID(el) { return el.text().replace(/ /g, '').replace(':','').replace('-',''); } function showHover(hover, lnk) { var postop = lnk.offset().top; postop = postop <= 200 ? 10 : postop - 200; hover.css({"z-index":count, "top":postop+"px", "visibility":"visible"}) .addClass("mwe-popups-fade-in-up"); } function processHover (lnk) { // delay showing the verse hover box setTimeout(function(){ timeOutShow = null; if (lnk.data('verse')) verse = lnk.data('verse'); else verse = lnk.text(); id = getID(lnk); var hover = $('#' + id); count++; if (hover.length === 0) { $.ajax({ url: '/chronology/index.php?route=common/home/sa', type: 'get', data: '&verse=' + verse, dataType: 'html', beforeSend: function() { // set the verse hover box: content is loading lnk.after('<div id="' + id +'" class="hover"><div id="'+ id +'header" class="hvr-header">' + verse + '<div id="close-' + id + '" class="close">×</div></div><div class="hvr-content"><img src="/natnee/images/6.gif" /></div></div>'); }, success: function(json) { // verse hover box: content is the verse $('#' + id + ' .hvr-content').html(json); // important to redefine the hover; it becomes null if it isn't defined hover = $('#' + id); origin = 'top'; showHover(hover, lnk); // when [x] of verse hover is clicked $('#close-'+id).on('click', function() { if (origin == 'top') hover.removeClass("mwe-popups-fade-in-up").addClass("mwe-popups-fade-out-down"); else hover.removeClass("mwe-popups-fade-in-down").hover.addClass("mwe-popups-fade-out-up"); hover.on("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd", function(e){ hover.off(e); if (hover.attr('class').indexOf('mwe-popups-fade-out') >= 0 ) { hover.removeClass("mwe-popups-fade-out-down").css({'visibility':'hidden','top':'0', 'z-index':'0'}); } });//end hover animation });//end close on click return false; }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); } else if (hover.css('visibility') == 'hidden') { showHover(hover, lnk); } }, 700); } $('.verse').on('click', function(){ processHover($(this)); });