X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/334e476e48d0e34cf2c3cc940eeb9e5b52b3103b..d3d0f68c842db9d5fda99a388f2df96358084166:/apps/wolnelektury_core/static/js/picture.js diff --git a/apps/wolnelektury_core/static/js/picture.js b/apps/wolnelektury_core/static/js/picture.js index 0d6d0cbcf..2464220e4 100644 --- a/apps/wolnelektury_core/static/js/picture.js +++ b/apps/wolnelektury_core/static/js/picture.js @@ -24,7 +24,7 @@ self._zoom = 0; self._ratio = 1.0; - self.original = self.element.find('img.original').eq(0); + self.original = $(''); self._original_avaialble = self.ORIGINAL_LOADING; function original_loaded() { @@ -54,11 +54,13 @@ } var initial_hash = window.location.hash; if (initial_hash) { - var mk = null; - if (initial_hash.startsWith('#object-')) { + var mk = null, + objectPrefix = '#object-', + themePrefix = '#theme-'; + if (initial_hash.substr(0, objectPrefix.length) === objectPrefix) { $("[href=#picture-objects]").trigger('click'); - } else if (initial_hash.startsWith('#theme-')) { - $("[href=#picutre-themes]").trigger('click'); + } else if (initial_hash.substr(0, themePrefix.length) === themePrefix) { + $("[href=#picture-themes]").trigger('click'); } mk = $("[href=" + initial_hash + "]").eq(0); self._initial_mark = self.createMark({ @@ -147,6 +149,10 @@ this._ratio = ratio; this.element.css(target); + if (this._initial_mark) { + this._initial_mark = this.redrawMark(this._initial_mark); + } + }, allowedPosition: function(off) { @@ -188,7 +194,12 @@ return undefined; }, - + redrawMark: function(mark) { + var $mark = $(mark); + var $newmark = this.createMark($mark.data('mark')); + $mark.remove(); + return $newmark; + }, // mark // { // label: "...", @@ -216,42 +227,27 @@ $mark.width(coords[1][0] - coords[0][0]); $mark.height(coords[1][1] - coords[0][1]); $mark.css({left: coords[0][0], top: coords[0][1]}); + + $mark.data('mark', mark); return $mark.get(0); }, }); -}(jQuery)); $(document).ready(function() { $.highlightFade.defaults.speed = 3000; - $('.toolbar a.dropdown').each(function() { + $('#menu .dropdown').each(function() { $t = $(this); $($t.attr('href')).hide().insertAfter(this); }); - function closeDD() { - $(this).removeClass('selected'); - $($(this).attr('href')).slideUp('fast'); - - } - $('.toolbar a.dropdown').click(function(ev) { - $("#sponsors:not(:hidden)").fadeOut(); - ev.preventDefault(); - if ($(this).hasClass('selected')) { - closeDD.call(this); - } else { - $(this).addClass('selected'); - $($(this).attr('href')).slideDown('fast'); - $(this).parent().siblings(".button:has(.dropdown)").children(".dropdown").each(closeDD); - } - }); - $(".picture-wrap").pictureviewer({ - plus_button: $(".toolbar .button.plus"), - minus_button: $(".toolbar .button.minus"), + plus_button: $(".button.plus"), + minus_button: $(".button.minus"), areas_links: $("#picture-objects a, #picture-themes a"), }); }); +}(jQuery));