migration fix
[wolnelektury.git] / wolnelektury / static / js / catalogue.js
index b356183..7a7709d 100644 (file)
@@ -1,50 +1,53 @@
-alert(LANGUAGE_CODE);
 var LOCALE_TEXTS = {
        "pl": {
                "DELETE_SHELF": "Czy na pewno usunąć półkę",
                "HIDE_DESCRIPTION": "Zwiń opis",
-               "EXPAND DESCRIPTION": "Rozwiń opis",
+               "EXPAND_DESCRIPTION": "Rozwiń opis",
                "LOADING": "Ładowanie",                
        },
+    "de": {
+        "DELETE_SHELF": "Translate me!",
+        "HIDE_DESCRIPTION": "Translate me!",
+        "EXPAND_DESCRIPTION": "Translate me!",
+        "LOADING": "Translate me!",             
+    },
        "fr": {
                "DELETE_SHELF": "Translate me!",
                "HIDE_DESCRIPTION": "Translate me!",
-               "EXPAND DESCRIPTION": "Translate me!",
-               "LOADING": "Translate me!",                             
-       },
-       "ru": {
-               "DELETE_SHELF": "Translate me!",
-               "HIDE_DESCRIPTION": "Translate me!",
-               "EXPAND DESCRIPTION": "Translate me!",
+               "EXPAND_DESCRIPTION": "Translate me!",
                "LOADING": "Translate me!",                             
        },
        "en": {
                "DELETE_SHELF": "Translate me!",
                "HIDE_DESCRIPTION": "Translate me!",
-               "EXPAND DESCRIPTION": "Translate me!",
+               "EXPAND_DESCRIPTION": "Translate me!",
                "LOADING": "Translate me!",             
        }, 
        "ru": {
                "DELETE_SHELF": "Translate me!",
                "HIDE_DESCRIPTION": "Translate me!",
-               "EXPAND DESCRIPTION": "Translate me!",
+               "EXPAND_DESCRIPTION": "Translate me!",
                "LOADING": "Translate me!",             
        },
        "es": {
                "DELETE_SHELF": "Translate me!",
                "HIDE_DESCRIPTION": "Translate me!",
-               "EXPAND DESCRIPTION": "Translate me!",
+               "EXPAND_DESCRIPTION": "Translate me!",
                "LOADING": "Translate me!",                             
        },
-       "lt":{
-               "DELETE_SHELF": "Translate me!",
-               "HIDE_DESCRIPTION": "Translate me!",
-               "EXPAND DESCRIPTION": "Translate me!",
-               "LOADING": "Translate me!",                             
-       }
+    "lt":{
+        "DELETE_SHELF": "Translate me!",
+        "HIDE_DESCRIPTION": "Translate me!",
+        "EXPAND_DESCRIPTION": "Translate me!",
+        "LOADING": "Translate me!",             
+    },
+    "uk":{
+        "DELETE_SHELF": "Translate me!",
+        "HIDE_DESCRIPTION": "Translate me!",
+        "EXPAND_DESCRIPTION": "Translate me!",
+        "LOADING": "Translate me!",             
+    }
 }
-
-alert(LOCALE_TEXTS[LANGUAGE_CODE]['DELETE_SHELF']);
 var BANNER_TEXTS = [
     'Przekaż 1% żeby ukryć ten baner.',
     'Jak dobrze wydać 1% swojego podatku? <strong>Poradnik dla opornych</strong>.',
@@ -126,14 +129,16 @@ function serverTime() {
                     function() { $(this).css({background: '#FFF'}); }
                 ).click(function() {
                     $(this).fadeOut(function() {
-                        $(this).prev().fadeIn()
+                        $(this).prev().fadeIn();
                     });
+                    return false;
                 })
             }
         });
         
         $('.fragment-short-text').click(function() {
             $(this).fadeOut(function() { $(this).next().fadeIn() });
+            return false;
         }).hover(
             function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
             function() { $(this).css({background: '#FFF'}); }
@@ -284,10 +289,21 @@ function serverTime() {
             } else {
                 $('#description').slideUp('fast').addClass('hidden');
                 $.cookie('description-state', 'closed', {path: '/', expires: 30});
-                $('p', this).html(LOCALE_TEXTS[LANGUAGE_CODE]['HIDE_DESCRIPTION'] + ' ▼');
+                $('p', this).html(LOCALE_TEXTS[LANGUAGE_CODE]['EXPAND_DESCRIPTION'] + ' ▼');
             }
         });
-    
+
+        $('#toggle-share-shelf').hover(
+            function() { $(this).css({background: '#F3F3F3', cursor: 'pointer'}); },
+            function() { $(this).css({background: '#EEE'}); }
+        ).click(function() {
+            if ($('#share-shelf').hasClass('hidden')) {
+                $('#share-shelf').slideDown('fast').removeClass('hidden');
+            } else {
+                $('#share-shelf').slideUp('fast').addClass('hidden');
+            }
+        });
+
         var target = $('#set-window div.target');
     
         $('#set-window').jqm({
@@ -317,8 +333,11 @@ function serverTime() {
         
         if ($.cookie('description-state') == 'closed') {
             $('#description').hide().addClass('hidden');
-            $('#toggle-description p').html(LOCALE_TEXTS[LANGUAGE_CODE]['EXPAND_SHELF']+' ▼');
+            $('#toggle-description p').html(LOCALE_TEXTS[LANGUAGE_CODE]['EXPAND_DESCRIPTION']+' ▼');
         }
+               
+        $('#share-shelf').hide().addClass('hidden');
+               $('#share-shelf input').focus(function(){this.select();});
                 
         $('#user-info').show();
         changeBannerText();