public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
Added the dimensions plugin to jquery

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4331 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Sun Feb 03 20:08:04 -0800 2008
commit  953a075f9720eba2de0ea039d32922c5bffe033f
tree    051892d9afaf3bd7b697405b33650e5b2f26e9f5
parent  c8834601839b3dbb1c06309f1b39f9aae8235636
...
18
19
20
 
21
22
 
 
 
 
 
 
 
 
23
24
25
...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
0
@@ -18,8 +18,17 @@
0
   
0
   <script type="text/javascript" src="../lib/jquery/jquery.js"></script>
0
   <script type="text/javascript" src="../lib/jquery/jquery.color.js"></script>
0
+ <script type="text/javascript" src="../lib/jquery/jquery.dimensions.js"></script>
0
   <script type="text/javascript" src="../lib/jquery/ui/ui.tabs.js"></script>
0
   <script type="text/javascript" src="../lib/jquery/ui/ui.accordion.js"></script>
0
+ <!--
0
+ <script type="text/javascript" src="../lib/jquery/ui/ui.mouse.js"></script>
0
+ <script type="text/javascript" src="../lib/jquery/ui/ui.draggable.js"></script>
0
+ <script type="text/javascript" src="../lib/jquery/ui/ui.droppable.js"></script>
0
+ <script type="text/javascript" src="../lib/jquery/ui/ui.draggable.ext.js"></script>
0
+ <script type="text/javascript" src="../lib/jquery/ui/ui.droppable.ext.js"></script>
0
+ <script type="text/javascript" src="../lib/jquery/ui/ui.sortable.js"></script>
0
+ -->
0
   
0
   <script type="text/javascript">//<![CDATA[
0
     // form handling stuff
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
0
@@ -1 +1,120 @@
0
+/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
0
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
0
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
0
+ *
0
+ * $LastChangedDate: 2007-12-20 08:46:55 -0600 (Thu, 20 Dec 2007) $
0
+ * $Rev: 4259 $
0
+ *
0
+ * Version: 1.2
0
+ *
0
+ * Requires: jQuery 1.2+
0
+ */
0
+
0
+(function($){
0
+
0
+$.dimensions = {
0
+ version: '1.2'
0
+};
0
+
0
+// Create innerHeight, innerWidth, outerHeight and outerWidth methods
0
+$.each( [ 'Height', 'Width' ], function(i, name){
0
+
0
+ // innerHeight and innerWidth
0
+ $.fn[ 'inner' + name ] = function() {
0
+ if (!this[0]) return;
0
+
0
+ var torl = name == 'Height' ? 'Top' : 'Left', // top or left
0
+ borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
0
+
0
+ return this.is(':visible') ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
0
+ };
0
+
0
+ // outerHeight and outerWidth
0
+ $.fn[ 'outer' + name ] = function(options) {
0
+ if (!this[0]) return;
0
+
0
+ var torl = name == 'Height' ? 'Top' : 'Left', // top or left
0
+ borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
0
+
0
+ options = $.extend({ margin: false }, options || {});
0
+
0
+ var val = this.is(':visible') ?
0
+ this[0]['offset' + name] :
0
+ num( this, name.toLowerCase() )
0
+ + num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
0
+ + num(this, 'padding' + torl) + num(this, 'padding' + borr);
0
+
0
+ return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
0
+ };
0
+});
0
+
0
+// Create scrollLeft and scrollTop methods
0
+$.each( ['Left', 'Top'], function(i, name) {
0
+ $.fn[ 'scroll' + name ] = function(val) {
0
+ if (!this[0]) return;
0
+
0
+ return val != undefined ?
0
+
0
+ // Set the scroll offset
0
+ this.each(function() {
0
+ this == window || this == document ?
0
+ window.scrollTo(
0
+ name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
0
+ name == 'Top' ? val : $(window)[ 'scrollTop' ]()
0
+ ) :
0
+ this[ 'scroll' + name ] = val;
0
+ }) :
0
+
0
+ // Return the scroll offset
0
+ this[0] == window || this[0] == document ?
0
+ self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
0
+ $.boxModel && document.documentElement[ 'scroll' + name ] ||
0
+ document.body[ 'scroll' + name ] :
0
+ this[0][ 'scroll' + name ];
0
+ };
0
+});
0
+
0
+$.fn.extend({
0
+ position: function() {
0
+ var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
0
+
0
+ if (elem) {
0
+ // Get *real* offsetParent
0
+ offsetParent = this.offsetParent();
0
+
0
+ // Get correct offsets
0
+ offset = this.offset();
0
+ parentOffset = offsetParent.offset();
0
+
0
+ // Subtract element margins
0
+ offset.top -= num(elem, 'marginTop');
0
+ offset.left -= num(elem, 'marginLeft');
0
+
0
+ // Add offsetParent borders
0
+ parentOffset.top += num(offsetParent, 'borderTopWidth');
0
+ parentOffset.left += num(offsetParent, 'borderLeftWidth');
0
+
0
+ // Subtract the two offsets
0
+ results = {
0
+ top: offset.top - parentOffset.top,
0
+ left: offset.left - parentOffset.left
0
+ };
0
+ }
0
+
0
+ return results;
0
+ },
0
+
0
+ offsetParent: function() {
0
+ var offsetParent = this[0].offsetParent;
0
+ while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
0
+ offsetParent = offsetParent.offsetParent;
0
+ return $(offsetParent);
0
+ }
0
+});
0
+
0
+function num(el, prop) {
0
+ return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;
0
+};
0
+
0
+})(jQuery);

Comments

    No one has commented yet.