]> git.wh0rd.org Git - tt-rss.git/commitdiff
js: move position stuff to separate file
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 8 Nov 2010 11:24:34 +0000 (14:24 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 8 Nov 2010 11:24:34 +0000 (14:24 +0300)
functions.js
lib/position.js [new file with mode: 0644]
prefs.php

index f3756051f218a295eea2d8b8da7746f824446e5e..626a23a896279bde44dc3a14fdfdb4b9958c69fa 100644 (file)
@@ -1633,36 +1633,6 @@ function openArticleInNewWindow(id) {
        }
 }
 
-/* http://textsnippets.com/posts/show/835 */
-
-Position.GetWindowSize = function(w) {
-        w = w ? w : window;
-        var width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
-        var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
-        return [width, height]
-}
-
-/* http://textsnippets.com/posts/show/836 */
-
-Position.Center = function(element, parent) {
-        var w, h, pw, ph;
-        var d = Element.getDimensions(element);
-        w = d.width;
-        h = d.height;
-        Position.prepare();
-        if (!parent) {
-                var ws = Position.GetWindowSize();
-                pw = ws[0];
-                ph = ws[1];
-        } else {
-                pw = parent.offsetWidth;
-                ph = parent.offsetHeight;
-        }
-        element.style.top = (ph/2) - (h/2) -  Position.deltaY + "px";
-        element.style.left = (pw/2) - (w/2) -  Position.deltaX + "px";
-}
-
-
 function isCdmMode() {
        return !$("headlinesList");
 }
diff --git a/lib/position.js b/lib/position.js
new file mode 100644 (file)
index 0000000..29bb9a5
--- /dev/null
@@ -0,0 +1,31 @@
+/* http://textsnippets.com/posts/show/835 */
+
+Position.GetWindowSize = function(w) {
+        w = w ? w : window;
+        var width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
+        var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
+        return [width, height]
+}
+
+/* http://textsnippets.com/posts/show/836 */
+
+Position.Center = function(element, parent) {
+        var w, h, pw, ph;
+        var d = Element.getDimensions(element);
+        w = d.width;
+        h = d.height;
+        Position.prepare();
+        if (!parent) {
+                var ws = Position.GetWindowSize();
+                pw = ws[0];
+                ph = ws[1];
+        } else {
+                pw = parent.offsetWidth;
+                ph = parent.offsetHeight;
+        }
+        element.style.top = (ph/2) - (h/2) -  Position.deltaY + "px";
+        element.style.left = (pw/2) - (w/2) -  Position.deltaX + "px";
+}
+
+
+
index 365c75a63a9e073bb529bdc01f22db112d154cc9..c6d2605b995b2d9d0c082367bbad3a6d49acf213 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -42,6 +42,7 @@
        <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
 
        <script type="text/javascript" src="lib/prototype.js"></script>
+       <script type="text/javascript" src="lib/position.js"></script>
        <script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
 
        <script type="text/javascript" charset="utf-8" src="localized_js.php?<?php echo $dt_add ?>"></script>