]> git.parisson.com Git - telemeta.git/commitdiff
fix popupdiv
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 28 Nov 2014 00:34:45 +0000 (01:34 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 28 Nov 2014 00:34:45 +0000 (01:34 +0100)
telemeta/static/telemeta/js/popupdiv.js
telemeta/templates/telemeta/collection_detail.html
telemeta/templates/telemeta/lists.html
telemeta/templates/telemeta/mediaitem_detail.html

index a1c5a9b9175c1a5fada9c10141123255fc378f6b..b1d38bc52bf92f47771a39df64ba0647d6b7554a 100644 (file)
@@ -552,7 +552,7 @@ function PopupDiv() {
         //we add the centralDiv cause, if scrollbars are present, then moving the scrollbars sets the focus to the\r
         //centralDiv in IE and therefore the popup would hide\r
 \r
-        \r
+\r
         var focusNameSpace = "blur."+this.getId();\r
         if(!value){\r
             elementsWithFocus.each(function(i,elm){\r
@@ -584,7 +584,7 @@ function PopupDiv() {
                 //otherwise execute callback\r
                 setTimeout(function(){\r
                     var v = doc_.activeElement;\r
-                    \r
+\r
                     if((v && $(v).attr(focusAttr)) || me.__isClosing){\r
                         //if we are closing, we will call back this method which removes the focus attributes, bt meanwhile the\r
                         //timeout should execute\r
@@ -624,8 +624,8 @@ function PopupDiv() {
             return; //show(), when called, will update size and other stuff written in this method here bwloe\r
         }\r
         this.setBounds();\r
-        \r
-        \r
+\r
+\r
         if(focusable){\r
             this.getFirstFocusableElement().focus();\r
         }\r
@@ -638,7 +638,7 @@ function PopupDiv() {
         var text = subdiv.contents().filter(function() {\r
             return this.nodeType == 3;\r
         });\r
-        \r
+\r
         var node = text.get(0);\r
         if(!title){\r
             //if title is the empty string, apparently the text node seems to be "deleted", so resetting\r
@@ -676,7 +676,7 @@ function PopupDiv() {
             div.css(this.popupCss);\r
             this.popupCss = ''; //override prototype property\r
         }\r
-        \r
+\r
 \r
         this.setFocusCycleRoot(this.focusable);\r
 \r
@@ -734,7 +734,7 @@ function PopupDiv() {
             div.appendTo('body');\r
         }\r
 \r
-        \r
+\r
         if(isClickElement){\r
             //storing click events, when showing clicking on an event must give the focus to the popup\r
             //old handlers will be restored in close()\r
@@ -743,7 +743,7 @@ function PopupDiv() {
             if(focusElm){\r
                 var oldHandlers = [];\r
                 var type = 'click';\r
-                var clickEvents =invoker.data("events")[type];\r
+                var clickEvents = $._data(invoker[0], "events")[type];\r
                 $.each(clickEvents, function(key, value) {\r
                     oldHandlers.push(value);\r
                 });\r
@@ -767,7 +767,7 @@ function PopupDiv() {
 \r
         }\r
         this.setBounds();\r
-       \r
+\r
         var shadow = this._getShadow();\r
         var place = this.setOffset;\r
         var postShowFcn = function(){\r
@@ -804,7 +804,7 @@ function PopupDiv() {
                     v.focus();\r
                 }\r
             }\r
-            \r
+\r
         };\r
 \r
         div.show(this.fadInTime,function(){\r
@@ -873,7 +873,7 @@ function PopupDiv() {
         var spaceLeft = invokerOffset.left + invokerOuterWidth - windowRectangle.x;\r
         var placeLeft = spaceLeft > spaceRight && div.outerWidth(false) + shadowOffset > spaceRight;\r
 \r
-        \r
+\r
         this.setMaxSize({\r
             height : (placeAbove ? spaceAbove : spaceBelow),\r
             width: (placeLeft ? spaceLeft : spaceRight)\r
@@ -889,7 +889,7 @@ function PopupDiv() {
         //however, we want CH to change even if a new maxHeight greater than CH is set\r
         });\r
 \r
-        \r
+\r
         this.postSizeFcn();\r
 \r
     };\r
@@ -904,18 +904,18 @@ function PopupDiv() {
         var boundsExact = this.boundsExact;\r
 \r
         var div = this.getDiv();\r
-        \r
+\r
         this.preSizeFcn();\r
-        \r
+\r
         var bounds = this.getBoundsOf(parent);\r
-       \r
-        \r
+\r
+\r
         var x=bounds.x;\r
         var y = bounds.y;\r
         var w = bounds.width;\r
         var h = bounds.height;\r
 \r
-        \r
+\r
         var pInt = parseInt;\r
         //rebuilding:\r
 \r
@@ -942,7 +942,7 @@ function PopupDiv() {
             'width':w-padding['left']-padding['right']+this.shadowOffset,\r
             'height':h-padding['top']-padding['bottom']+this.shadowOffset\r
         };\r
-        \r
+\r
         this.setMaxSize({\r
             width:maxSize.width,\r
             height:maxSize.height\r
@@ -958,7 +958,7 @@ function PopupDiv() {
 \r
         this.postSizeFcn();\r
     };\r
-    \r
+\r
     p.preSizeFcn = function(){\r
         var div = this.getDiv();\r
         var subdivs = div.children();\r
@@ -1014,9 +1014,9 @@ function PopupDiv() {
     //            console.log('width: '+bottomDiv.width()+' css-minWidth: ' +bottomDiv.css('minWidth')+' css-width: ' +bottomDiv.css('width')+' css-maxWidth: ' +bottomDiv.css('maxWidth'));\r
     //            console.log(' ' );\r
     };\r
-    \r
+\r
     p.postSizeFcn = function(){\r
-        \r
+\r
         //set title and close button to span whole width, if necessary\r
         //closeButton.outerWidth should be zero if this.showClose = false\r
         //titleInput.outerWidth(true) should be equal to titleInput.width(), as margins borders and padding are zero, however we want to calculate it safely\r
@@ -1029,21 +1029,21 @@ function PopupDiv() {
         var bottomDiv = subdivs.eq(2);\r
         //set central div height. We could set the central div height only if necessary, or the central div max height,\r
         //but this has side effect in IE\r
-       \r
+\r
         var maxHeight = (div.height()-topDiv.outerHeight(true)-bottomDiv.outerHeight(true)-\r
             (centralDiv.outerHeight(true)-centralDiv.height()));\r
-       \r
+\r
         //setting centralDiv maxHeight or height is actually the same, we use height to be sure...\r
         if(maxHeight>0){\r
             centralDiv.css('height',maxHeight+'px');\r
         }\r
-       \r
+\r
         //to be put AT THE END otherwise bug in IE7\r
         centralDiv.css('overflow','auto');\r
         //after the command above, centralDiv.hegith is set to zero in IE7.\r
         //It might be a refresh problem cause if we display an alert then the size is properly set.\r
         //However, put it at the end\r
-        \r
+\r
 \r
         //                console.log('postsize');\r
         //                console.log('width: '+ topDiv.width()+' css-minWidth: ' +topDiv.css('minWidth')+' css-width: ' +topDiv.css('width')+' css-maxWidth: ' +topDiv.css('maxWidth'));\r
@@ -1051,7 +1051,7 @@ function PopupDiv() {
         //                console.log('width: '+bottomDiv.width()+' css-minWidth: ' +bottomDiv.css('minWidth')+' css-width: ' +bottomDiv.css('width')+' css-maxWidth: ' +bottomDiv.css('maxWidth'));\r
         //                console.log(' ' );\r
 \r
-        \r
+\r
         this.setOffset();\r
 \r
     };\r
@@ -1091,10 +1091,10 @@ function PopupDiv() {
     };\r
 \r
     p._setOffsetInside = function(){\r
-       \r
+\r
         var div = this.getDiv();\r
 \r
-        \r
+\r
         var parent = this.invoker;\r
         var bounds = this.getBoundsOf(parent);\r
         var pd = this.bounds;\r
@@ -1183,7 +1183,7 @@ function PopupDiv() {
     //getDiv must be sizable (preShowFcn must have been called)\r
     p.setMaxSize = function(size){\r
         var div = this.getDiv();\r
-        \r
+\r
         this._convertSize(div, size);\r
         var css;\r
         if(size.hasOwnProperty('width')){\r
@@ -1206,7 +1206,7 @@ function PopupDiv() {
     //getDiv must be sizable (preShowFcn must have been called)\r
     p.setMinSize = function(size){\r
         var div = this.getDiv();\r
-        \r
+\r
         this._convertSize(div, size);\r
         var css;\r
         if(size.hasOwnProperty('width')){\r
index da2aee292b194f5f23f476277c0bfda1f7c4a31f..63daaffb8ad624dceb09bb85a9014d4e3a9f4ece 100644 (file)
@@ -10,7 +10,7 @@
 <script src="{{ STATIC_URL }}telemeta/js/playlist.js" type="text/javascript"></script>
 <script>
     {% if user.is_authenticated %}
-    jQuery(document).ready(function(){
+    $(document).ready(function(){
         var p = playlistUtils;
 
         {% for playlist in playlists %}
@@ -18,7 +18,7 @@
         {% endfor %}
 
         {% if collection %}
-        var anchor = jQuery('#_add_to_playlist');
+        var anchor = $('#_add_to_playlist');
         if(anchor.length){
         anchor.click(function(){
             p.showAddResourceToPlaylist(anchor,'collection','{{collection.id}}',gettrans('collection added to the selected playlist'));return false;
@@ -58,7 +58,7 @@
       </button>
     </a>
     {% endif %}
-    {% if user.is_authenticated and perms.telemeta.change_mediaitem %}
+    {% if user.is_authenticated and perms.telemeta.change_mediacollection %}
     <a href="{% url "telemeta-collection-additem" collection.public_id %}">
       <button type="button" class="btn btn-default">
         <span class="glyphicon glyphicon-plus"></span> {% trans "Add item" %}
index d7959dc40d5014ba19f97074f393a3d9f6106dcc..2f31a92e57ebf1bcce1943d068184bbf88023d45 100644 (file)
@@ -3,7 +3,7 @@
 {% load i18n %}
 
 {% block extra_javascript %}
-<script src="{{ STATIC_URL }}telemeta/js/popupdiv-min.js" type="text/javascript"></script>
+<script src="{{ STATIC_URL }}telemeta/js/popupdiv.js" type="text/javascript"></script>
 <script src="{{ STATIC_URL }}telemeta/js/playlist.js" type="text/javascript"></script>
 <script>
     jQuery(window).ready(function(){
index f0087c574976b0afdd71c6f0d54e53d2ecc948b0..1e53daec96cf59ea2082e31734eaad16b7f55cfc 100644 (file)
@@ -14,7 +14,7 @@
 
 {% if item %}
 
-<script src="{{ STATIC_URL }}telemeta/js/popupdiv-min.js" type="text/javascript"></script>
+<script src="{{ STATIC_URL }}telemeta/js/popupdiv.js" type="text/javascript"></script>
 <script src="{{ STATIC_URL }}telemeta/js/playlist.js" type="text/javascript"></script>
 
 {% if item.file or item.url %}