45 |
45 |
46 <script type="text/javascript"> |
46 <script type="text/javascript"> |
47 <!-- |
47 <!-- |
48 |
48 |
49 // Using jQuery UI-Layout to allow scrolling in Safari mobile |
49 // Using jQuery UI-Layout to allow scrolling in Safari mobile |
50 if (/iPhone|iPod|iPad/.test(navigator.userAgent)) { |
50 jQuery(document).ready (function () { |
51 jQuery(document).ready (function () { |
51 // safari_mobile is defined in media/js/client/c_sync.js |
|
52 if (safari_mobile) { |
52 jQuery('body').layout ({ |
53 jQuery('body').layout ({ |
53 center: { |
54 center: { |
54 paneSelector : '#maincontainer', |
55 paneSelector : '#maincontainer', |
55 applyDefaultStyles : true, |
56 applyDefaultStyles : true, |
56 } |
57 } |
57 }); |
58 }); |
58 jQuery('#maincontainer').css ({ |
59 jQuery('#maincontainer').css ({ |
59 height: '100%', |
60 height: '100%', |
|
61 width: '99%' |
60 }); |
62 }); |
61 }); |
63 |
62 } |
64 /** |
|
65 * cloneSelection |
|
66 * s : Selection object |
|
67 * return : a deep copy of a given Selection, co-ment usefull functions are recreated |
|
68 */ |
|
69 function cloneSelection (s) { |
|
70 var c = jQuery.extend (true, {}, s); |
|
71 // var c = JSON.parse(JSON.stringify(s)); // alternative |
|
72 c.ranges = []; |
|
73 |
|
74 for (var j = 0; j < s.rangeCount; j++) { |
|
75 c.ranges [j] = s.getRangeAt (j); |
|
76 } |
|
77 |
|
78 c.getRangeAt = function (j) { return this.ranges [j]; }; |
|
79 c.toString = function () { return this.ranges[0].toString (); }; |
|
80 return c; |
|
81 } |
|
82 |
|
83 var emptySelection = { rangeCount: 0 }; |
|
84 // intended global variable used in media/js/client/c_selection.js |
|
85 storedSelection = emptySelection; |
|
86 |
|
87 document.addEventListener("selectionchange", function() { |
|
88 var c = cloneSelection(window.getSelection()); |
|
89 var c_txt = c.toString (); |
|
90 |
|
91 if (c_txt && c_txt != '') { |
|
92 storedSelection = c; |
|
93 } else { |
|
94 setTimeout (function () { storedSelection = emptySelection; }, 500); |
|
95 } |
|
96 }, false); |
|
97 } |
|
98 }); |
63 |
99 |
64 // GLOBALS from server |
100 // GLOBALS from server |
65 sv_user_permissions = []; |
101 sv_user_permissions = []; |
66 {% get_local_text_perm request text can_create_comment as can_create_comment %} |
102 {% get_local_text_perm request text can_create_comment as can_create_comment %} |
67 {% if can_create_comment %} sv_user_permissions.push("can_create_comment") {% endif %}; |
103 {% if can_create_comment %} sv_user_permissions.push("can_create_comment") {% endif %}; |