Wp-Insert - Version 1.3.1

Version Description

Download this release

Release Info

Developer namith.jawahar
Plugin Icon 128x128 Wp-Insert
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3.0 to 1.3.1

images/popUpBtm.png ADDED
Binary file
images/popUpBtmLft.png ADDED
Binary file
images/popUpBtmRgt.png ADDED
Binary file
images/popUpLft.png ADDED
Binary file
images/popUpRgt.png ADDED
Binary file
images/popUpTop.png ADDED
Binary file
images/popUpTopLft.png ADDED
Binary file
images/popUpTopRgt.png ADDED
Binary file
images/search-16x16.png ADDED
Binary file
includes/ads.php CHANGED
@@ -53,7 +53,43 @@ wp_nonce_field('update-options');
53
  wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
54
  wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
55
  ?>
 
 
 
 
 
56
  <script type="text/javascript" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/js/common.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  <div id="poststuff" class="metabox-holder has-right-sidebar">
58
  <div id="side-info-column" class="inner-sidebar">
59
  <?php do_meta_boxes('adWidgets','advanced',null); ?>
@@ -104,8 +140,10 @@ function wp_insert_in_post_ad_HTML($in_post_adID) { ?>
104
  <textarea id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_content" class="widefat" name="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_content" cols="20" rows="16"><?php echo get_option('wp_insert_in_post_ad_'.$in_post_adID.'_content'); ?></textarea>
105
  </p>
106
  <p>
107
- <label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids">Exclude On Posts/Pages:</label>
108
- <input id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids" class="widefat" type="text" value="<?php echo get_option('wp_insert_in_post_ad_'.$in_post_adID.'_exclude_ids'); ?>" name="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids"/>
 
 
109
  </p>
110
  <p>
111
  <label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_home">Exclude On Home Page:</label>
@@ -147,8 +185,10 @@ function ad_widget_HTML($widgetID) { ?>
147
  <textarea id="wp_insert_ad_widget_<?php echo $widgetID; ?>_content" class="widefat" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_content" cols="20" rows="16"><?php echo get_option('wp_insert_ad_widget_'.$widgetID.'_content'); ?></textarea>
148
  </p>
149
  <p>
150
- <label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids">Exclude On Posts/Pages:</label>
151
- <input id="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids" class="widefat" type="text" value="<?php echo get_option('wp_insert_ad_widget_'.$widgetID.'_exclude_ids'); ?>" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids"/>
 
 
152
  </p>
153
  <p>
154
  <label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_home">Exclude On Home Page:</label>
53
  wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
54
  wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
55
  ?>
56
+ <script type="text/javascript" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/js/jquery/ui.core.js"></script>
57
+ <script type="text/javascript" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/js/jquery/ui.draggable.js"></script>
58
+ <script type="text/javascript" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/js/jquery/jquery.corner.js"></script>
59
+ <?php require_once (dirname(__FILE__) . '/postpicker.php'); ?>
60
+
61
  <script type="text/javascript" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/js/common.js"></script>
62
+ <style type="text/css">
63
+ .GreyOutLayer
64
+ {
65
+ position: absolute;
66
+ top: 0px;
67
+ left: 0px;
68
+ width: 100%;
69
+ height: 100%;
70
+ bottom: 0px;
71
+ background-color: #666;
72
+ z-index: 100;
73
+ filter: progid:DXImageTransform.Microsoft.Alpha(opacity = 30);
74
+ opacity: 0.30;
75
+ }
76
+
77
+ #popUpMaster{position:relative;padding:10px 0 0 10px;display:none}
78
+ #popUpTopLft{position:absolute;left:0px;top:0}
79
+ #popUpTop{position:absolute;left:10px;top:0;height:36px;z-index:9}
80
+ #popUpTopRgt{position:absolute;right:0px;top:0;z-index:9}
81
+ #popUpLft{position:absolute;left:0px;top:30px;width:17px;}
82
+ #popUpRgt{position:absolute;right:0px;top:36px;width:26px;}
83
+ #popUpBtmLft{position:absolute;left:0px;bottom:0px;}
84
+ #popUpBtm{position:absolute;left:17px;bottom:0px;height:20px}
85
+ #popUpBtmRgt{position:absolute;right:0px;bottom:0px;}
86
+ #content{background:#F2F2F2;height:520px;width:725px;margin:0px;z-index:100;position:absolute;top:26px;right:15px;}
87
+ .closePopUp{display:block;position:absolute;right:10px;top:4px;width:20px;height:18px;z-index:10;text-decoration:none;background:none}
88
+ #popUpMaster h4{position:absolute;top:0;left:0;z-index:10;padding:0;margin:6px 0 0 10px;color:#333333;text-shadow:0 1px 0 #FFFFFF;
89
+ font-family:Arial, Helvetica, sans-serif;font-size:12px;line-height:15px;cursor:move;background:nonImage.gif;
90
+ width:100%}
91
+ </style>
92
+
93
  <div id="poststuff" class="metabox-holder has-right-sidebar">
94
  <div id="side-info-column" class="inner-sidebar">
95
  <?php do_meta_boxes('adWidgets','advanced',null); ?>
140
  <textarea id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_content" class="widefat" name="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_content" cols="20" rows="16"><?php echo get_option('wp_insert_in_post_ad_'.$in_post_adID.'_content'); ?></textarea>
141
  </p>
142
  <p>
143
+ <label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids">Exclude On Posts/Pages:</label><div class="clear"></div>
144
+ <input style="float:left; width:60%; margin: 0 6px;" class="widefat" type="text" value="<?php echo get_option('wp_insert_in_post_ad_'.$in_post_adID.'_exclude_ids'); ?>" name="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids" id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids" />
145
+ <img style="float:left; margin-top:4px; cursor: pointer;" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/images/search-16x16.png" width="16px" height="16px" onclick="ShowPostPicker('wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids')" />
146
+ <div class="clear"></div>
147
  </p>
148
  <p>
149
  <label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_home">Exclude On Home Page:</label>
185
  <textarea id="wp_insert_ad_widget_<?php echo $widgetID; ?>_content" class="widefat" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_content" cols="20" rows="16"><?php echo get_option('wp_insert_ad_widget_'.$widgetID.'_content'); ?></textarea>
186
  </p>
187
  <p>
188
+ <label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids">Exclude On Posts/Pages:</label><div class="clear"></div>
189
+ <input style="float:left; width:60%; margin: 0 6px;" class="widefat" type="text" value="<?php echo get_option('wp_insert_ad_widget_'.$widgetID.'_exclude_ids'); ?>" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids" id="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids" />
190
+ <img style="float:left; margin-top:4px; cursor: pointer;" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/images/search-16x16.png" width="16px" height="16px" onclick="ShowPostPicker('wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids')" />
191
+ <div class="clear"></div>
192
  </p>
193
  <p>
194
  <label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_home">Exclude On Home Page:</label>
includes/postpicker.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style type="text/css">
2
+ .multipleSelectBoxControl span{ /* Labels above select boxes*/
3
+ font-family:arial;
4
+ font-size:11px;
5
+ font-weight:bold;
6
+ }
7
+ .multipleSelectBoxControl div select{ /* Select box layout */
8
+ font-family:arial;
9
+ height:100%;
10
+ }
11
+ .multipleSelectBoxControl input{ /* Small butons */
12
+ width:25px;
13
+ }
14
+
15
+ .multipleSelectBoxControl div{
16
+ float:left;
17
+ }
18
+ </style>
19
+ <script type="text/javascript">
20
+
21
+ var fromBoxArray = new Array();
22
+ var toBoxArray = new Array();
23
+ var selectBoxIndex = 0;
24
+ var arrayOfItemsToSelect = new Array();
25
+
26
+ function moveSingleElement()
27
+ {
28
+ var selectBoxIndex = this.parentNode.parentNode.id.replace(/[^\d]/g,'');
29
+ var tmpFromBox;
30
+ var tmpToBox;
31
+ if(this.tagName.toLowerCase()=='select'){
32
+ tmpFromBox = this;
33
+ if(tmpFromBox==fromBoxArray[selectBoxIndex])tmpToBox = toBoxArray[selectBoxIndex]; else tmpToBox = fromBoxArray[selectBoxIndex];
34
+ }else{
35
+
36
+ if(this.value.indexOf('>')>=0){
37
+ tmpFromBox = fromBoxArray[selectBoxIndex];
38
+ tmpToBox = toBoxArray[selectBoxIndex];
39
+ }else{
40
+ tmpFromBox = toBoxArray[selectBoxIndex];
41
+ tmpToBox = fromBoxArray[selectBoxIndex];
42
+ }
43
+ }
44
+
45
+ for(var no=0;no<tmpFromBox.options.length;no++){
46
+ if(tmpFromBox.options[no].selected){
47
+ tmpFromBox.options[no].selected = false;
48
+ tmpToBox.options[tmpToBox.options.length] = new Option(tmpFromBox.options[no].text,tmpFromBox.options[no].value);
49
+
50
+ for(var no2=no;no2<(tmpFromBox.options.length-1);no2++){
51
+ tmpFromBox.options[no2].value = tmpFromBox.options[no2+1].value;
52
+ tmpFromBox.options[no2].text = tmpFromBox.options[no2+1].text;
53
+ tmpFromBox.options[no2].selected = tmpFromBox.options[no2+1].selected;
54
+ }
55
+ no = no -1;
56
+ tmpFromBox.options.length = tmpFromBox.options.length-1;
57
+
58
+ }
59
+ }
60
+
61
+
62
+ var tmpTextArray = new Array();
63
+ for(var no=0;no<tmpFromBox.options.length;no++){
64
+ tmpTextArray.push(tmpFromBox.options[no].text + '___' + tmpFromBox.options[no].value);
65
+ }
66
+ tmpTextArray.sort();
67
+ var tmpTextArray2 = new Array();
68
+ for(var no=0;no<tmpToBox.options.length;no++){
69
+ tmpTextArray2.push(tmpToBox.options[no].text + '___' + tmpToBox.options[no].value);
70
+ }
71
+ tmpTextArray2.sort();
72
+
73
+ for(var no=0;no<tmpTextArray.length;no++){
74
+ var items = tmpTextArray[no].split('___');
75
+ tmpFromBox.options[no] = new Option(items[0],items[1]);
76
+
77
+ }
78
+
79
+ for(var no=0;no<tmpTextArray2.length;no++){
80
+ var items = tmpTextArray2[no].split('___');
81
+ tmpToBox.options[no] = new Option(items[0],items[1]);
82
+ }
83
+ }
84
+
85
+ function sortAllElement(boxRef)
86
+ {
87
+ var tmpTextArray2 = new Array();
88
+ for(var no=0;no<boxRef.options.length;no++){
89
+ tmpTextArray2.push(boxRef.options[no].text + '___' + boxRef.options[no].value);
90
+ }
91
+ tmpTextArray2.sort();
92
+ for(var no=0;no<tmpTextArray2.length;no++){
93
+ var items = tmpTextArray2[no].split('___');
94
+ boxRef.options[no] = new Option(items[0],items[1]);
95
+ }
96
+
97
+ }
98
+ function moveAllElements()
99
+ {
100
+ var selectBoxIndex = this.parentNode.parentNode.id.replace(/[^\d]/g,'');
101
+ var tmpFromBox;
102
+ var tmpToBox;
103
+ if(this.value.indexOf('>')>=0){
104
+ tmpFromBox = fromBoxArray[selectBoxIndex];
105
+ tmpToBox = toBoxArray[selectBoxIndex];
106
+ }else{
107
+ tmpFromBox = toBoxArray[selectBoxIndex];
108
+ tmpToBox = fromBoxArray[selectBoxIndex];
109
+ }
110
+
111
+ for(var no=0;no<tmpFromBox.options.length;no++){
112
+ tmpToBox.options[tmpToBox.options.length] = new Option(tmpFromBox.options[no].text,tmpFromBox.options[no].value);
113
+ }
114
+
115
+ tmpFromBox.options.length=0;
116
+ sortAllElement(tmpToBox);
117
+
118
+ }
119
+
120
+
121
+ function createMovableOptions(fromBox,toBox,totalWidth,totalHeight,labelLeft,labelRight)
122
+ {
123
+ fromObj = document.getElementById(fromBox);
124
+ toObj = document.getElementById(toBox);
125
+
126
+ arrayOfItemsToSelect[arrayOfItemsToSelect.length] = toObj;
127
+
128
+
129
+ fromObj.ondblclick = moveSingleElement;
130
+ toObj.ondblclick = moveSingleElement;
131
+
132
+
133
+ fromBoxArray.push(fromObj);
134
+ toBoxArray.push(toObj);
135
+
136
+ var parentEl = fromObj.parentNode;
137
+
138
+ var parentDiv = document.createElement('DIV');
139
+ parentDiv.className='multipleSelectBoxControl';
140
+ parentDiv.id = 'selectBoxGroup' + selectBoxIndex;
141
+ parentDiv.style.width = totalWidth + 'px';
142
+ parentDiv.style.height = totalHeight + 'px';
143
+ parentEl.insertBefore(parentDiv,fromObj);
144
+
145
+
146
+ var subDiv = document.createElement('DIV');
147
+ subDiv.style.width = (Math.floor(totalWidth/2) - 15) + 'px';
148
+ fromObj.style.width = (Math.floor(totalWidth/2) - 15) + 'px';
149
+
150
+ var label = document.createElement('SPAN');
151
+ label.innerHTML = labelLeft;
152
+ subDiv.appendChild(label);
153
+
154
+ subDiv.appendChild(fromObj);
155
+ subDiv.className = 'multipleSelectBoxDiv';
156
+ parentDiv.appendChild(subDiv);
157
+
158
+
159
+ var buttonDiv = document.createElement('DIV');
160
+ buttonDiv.style.verticalAlign = 'middle';
161
+ buttonDiv.style.paddingTop = (totalHeight/2) - 50 + 'px';
162
+ buttonDiv.style.width = '30px';
163
+ buttonDiv.style.textAlign = 'center';
164
+ parentDiv.appendChild(buttonDiv);
165
+
166
+ var buttonRight = document.createElement('INPUT');
167
+ buttonRight.type='button';
168
+ buttonRight.value = '>';
169
+ buttonDiv.appendChild(buttonRight);
170
+ buttonRight.onclick = moveSingleElement;
171
+
172
+ var buttonAllRight = document.createElement('INPUT');
173
+ buttonAllRight.type='button';
174
+ buttonAllRight.value = '>>';
175
+ buttonAllRight.onclick = moveAllElements;
176
+ buttonDiv.appendChild(buttonAllRight);
177
+
178
+ var buttonLeft = document.createElement('INPUT');
179
+ buttonLeft.style.marginTop='10px';
180
+ buttonLeft.type='button';
181
+ buttonLeft.value = '<';
182
+ buttonLeft.onclick = moveSingleElement;
183
+ buttonDiv.appendChild(buttonLeft);
184
+
185
+ var buttonAllLeft = document.createElement('INPUT');
186
+ buttonAllLeft.type='button';
187
+ buttonAllLeft.value = '<<';
188
+ buttonAllLeft.onclick = moveAllElements;
189
+ buttonDiv.appendChild(buttonAllLeft);
190
+
191
+ var subDiv = document.createElement('DIV');
192
+ subDiv.style.width = (Math.floor(totalWidth/2) - 15) + 'px';
193
+ toObj.style.width = (Math.floor(totalWidth/2) - 15) + 'px';
194
+
195
+ var label = document.createElement('SPAN');
196
+ label.innerHTML = labelRight;
197
+ subDiv.appendChild(label);
198
+
199
+ subDiv.appendChild(toObj);
200
+ parentDiv.appendChild(subDiv);
201
+
202
+ toObj.style.height = (totalHeight - label.offsetHeight) + 'px';
203
+ fromObj.style.height = (totalHeight - label.offsetHeight) + 'px';
204
+
205
+
206
+ selectBoxIndex++;
207
+
208
+ }
209
+
210
+ function SavePostPicker(sender) {
211
+ var count = 0;
212
+ var value = '';
213
+ var list = document.getElementById('toBox');
214
+ for(var i = 0; i < list.options.length; ++i) {
215
+ if(count > 0) { value += ',' + list.options[i].value; }
216
+ else { value += list.options[i].value; }
217
+ count++;
218
+ }
219
+ document.getElementById(sender).value = value;
220
+
221
+ ClosePopup();
222
+ }
223
+
224
+ function ShowPostPicker(sender) {
225
+ sender = document.getElementById(sender);
226
+ GreyOutScreen();
227
+ divPopup = CreatePopUp("Select Posts/Pages", 525, 390, (GetPageHeight() / 2) - 262, (GetPageWidth() / 2) - 195);
228
+
229
+ <?php
230
+ $count = 0;
231
+ $pages = get_pages('sort_column=menu_order');
232
+ $posts = get_posts('numberposts=-1&sort_column=desc');
233
+ $allposts = "<select multiple name='fromBox' id='fromBox'>";
234
+ $selectedposts = "<select multiple name='toBox' id='toBox'></select>";
235
+ foreach($pages as $page) {
236
+ if($count < 100) {
237
+ $allposts .= "<option value='".$page->ID."'>".$page->post_title."</option>";
238
+ }
239
+ $count++;
240
+ }
241
+ foreach($posts as $post) {
242
+ if($count < 100) {
243
+ $allposts .= "<option value='".$post->ID."'>".$post->post_title."</option>";
244
+ }
245
+ $count++;
246
+ }
247
+ $allposts .= "</select>";
248
+ echo 'divPopup.innerHTML = "'.$allposts.$selectedposts.'";';
249
+ ?>
250
+ divPopup.innerHTML += "<p class='submit'><input class='button-primary' type='button' value='OK' style='float:right;' onclick='SavePostPicker(\"" + sender.id + "\")' /></p>";
251
+ createMovableOptions('fromBox','toBox',500,300,'All Posts/Pages','Selected Posts/Pages');
252
+ for(var counter = 0; counter < 1000; counter++) { void(0); }
253
+ SelectedPosts = sender.value.split(",");
254
+ for (var counter = 0; counter < SelectedPosts.length; counter++) {
255
+ var list = document.getElementById('fromBox');
256
+ for(var i = 0; i < list.options.length; ++i) {
257
+ if(list.options[i].value == SelectedPosts[counter]) {
258
+ var toBox = document.createElement('option');
259
+ toBox.value = SelectedPosts[counter];
260
+ toBox.innerHTML = moveAllElements;
261
+ toBox.innerHTML = list.options[i].innerHTML;
262
+ document.getElementById("toBox").appendChild(toBox);
263
+ break;
264
+ }
265
+ }
266
+ }
267
+ document.getElementById('fromBox').focus();
268
+ return false;
269
+ }
270
+ </script>
js/common.js CHANGED
@@ -6,12 +6,246 @@
6
  function wpInsertToggleAdWidget(sender, pointerid) {
7
  if(jQuery(sender).attr("value") == "Click to Activate") {
8
  jQuery(pointerid).attr("checked", true);
9
- jQuery(sender).animate({color: "red",}, 1500, "linear", function() { wpInsertToggleNotSavedAlert(); } );
10
  jQuery(sender).attr("value", "Click to Deactivate");
11
  }
12
  else {
13
- jQuery(pointerid).attr("checked", false);
14
- jQuery(sender).animate({color: "#2f9303",}, 1500, "linear", function() { wpInsertToggleNotSavedAlert(); } );
15
  jQuery(sender).attr("value", "Click to Activate");
16
  }
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  function wpInsertToggleAdWidget(sender, pointerid) {
7
  if(jQuery(sender).attr("value") == "Click to Activate") {
8
  jQuery(pointerid).attr("checked", true);
9
+ jQuery(sender).animate({color: "red"}, 1500, "linear", function() { wpInsertToggleNotSavedAlert(); } );
10
  jQuery(sender).attr("value", "Click to Deactivate");
11
  }
12
  else {
13
+ jQuery(pointerid).attr("checked", false);
14
+ jQuery(sender).animate({color: "#2f9303"}, 1500, "linear", function() { wpInsertToggleNotSavedAlert(); } );
15
  jQuery(sender).attr("value", "Click to Activate");
16
  }
17
+ }
18
+
19
+ /* PopUps */
20
+
21
+ //Code to find Y coordinates of any element starts here
22
+
23
+ function YPos(obj) {
24
+ var curtop = 0;
25
+ if (obj.offsetParent) {
26
+ while (1) {
27
+ curtop += obj.offsetTop;
28
+ if (!obj.offsetParent)
29
+ break;
30
+ obj = obj.offsetParent;
31
+ }
32
+ }
33
+ else if (obj.y) {
34
+ curtop += obj.y;
35
+ }
36
+ return curtop;
37
+ }
38
+
39
+ //Code to find Y coordinates of any element ends here
40
+
41
+ /****************************************/
42
+
43
+ //Code to find X coordinates of any element starts here
44
+
45
+ function XPos(obj) {
46
+ var curtop = 0;
47
+ if (obj.offsetParent) {
48
+ while (1) {
49
+ curtop += obj.offsetLeft;
50
+ if (!obj.offsetParent)
51
+ break;
52
+ obj = obj.offsetParent;
53
+ }
54
+ }
55
+ else if (obj.x) {
56
+ curtop += obj.x;
57
+ }
58
+ return curtop;
59
+ }
60
+
61
+ //Code to find X coordinates of any element ends here
62
+
63
+ //Code to find page Height/Width starts here
64
+
65
+ function GetPageHeight() {
66
+ if (window.innerHeight && window.scrollMaxY) {// Firefox
67
+ yWithScroll = window.innerHeight + window.scrollMaxY;
68
+ xWithScroll = window.innerWidth + window.scrollMaxX;
69
+ } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
70
+ yWithScroll = document.body.scrollHeight;
71
+ xWithScroll = document.body.scrollWidth;
72
+ } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
73
+ yWithScroll = document.body.offsetHeight;
74
+ xWithScroll = document.body.offsetWidth;
75
+ }
76
+ return yWithScroll;
77
+
78
+ }
79
+
80
+ function GetPageWidth() {
81
+ var IE=document.all;
82
+ var iXPos;
83
+ if (!IE) {
84
+ iXPos = self.innerWidth;
85
+ }
86
+ else {
87
+ iXPos = (document.body.clientWidth);
88
+ }
89
+ return iXPos;
90
+ }
91
+
92
+ //Code to find page Height/Width starts here
93
+
94
+
95
+ function vIE() {
96
+ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { //test for MSIE x.x;
97
+ var ieversion = new Number(RegExp.jQuery1) // capture x.x portion and store as a number
98
+ return ieversion;
99
+ }
100
+ else
101
+ return 0; // this is for other browsers
102
+ }
103
+
104
+ function InitialisePopUP(width, height, ypos, xpos) {
105
+
106
+ if (width > 749) { alert('Please Use a smaller value for the Popup (less than 749)'); }
107
+ if (height > 540) { alert('Please Use a smaller value for the Popup (less than 540)'); }
108
+ jQuery("#popUpMaster").draggable({
109
+ containment: ['parent'],
110
+ effect: ['fade', 'fade']
111
+ });
112
+ var top;
113
+ var bottom;
114
+ var left;
115
+ var right;
116
+ var contentHeight;
117
+ var contentWidth;
118
+ left = height - 40;
119
+ right = left - 16;
120
+ top = width - 24;
121
+ bottom = top - 19;
122
+ contentWidth = top;
123
+ if (vIE()) {
124
+ right = left - 16;
125
+ contentHeight = height - 44;
126
+
127
+ if (vIE() >= 7) {
128
+ contentHeight = height - 46;
129
+ right = right;
130
+ bottom = bottom;
131
+ }
132
+ }
133
+ else if (vIE() == 0) {
134
+ contentHeight = height - 45;
135
+ right = right;
136
+ bottom = bottom;
137
+ }
138
+ jQuery("#popUpMaster").css('width', width);
139
+ jQuery("#popUpMaster").css('height', height);
140
+ jQuery("#popUpTop").css('width', top);
141
+ jQuery("#popUpLft").css('height', left);
142
+ jQuery("#popUpRgt").css('height', right);
143
+ jQuery("#popUpBtm").css('width', bottom);
144
+ jQuery("#content").css('width', contentWidth);
145
+ jQuery("#content").css('height', contentHeight);
146
+
147
+ jQuery("#popUpMaster").show();
148
+ jQuery("#popUpMaster").css('top', ypos);
149
+ jQuery("#popUpMaster").css('left', xpos);
150
+
151
+ if (vIE() == 6) {
152
+ jQuery('img[@srcjQuery=.png], div#popUpMaster').ifixpng();
153
+ }
154
+ }
155
+
156
+ function GreyOutScreen() {
157
+ var divGreyOut = document.createElement("div");
158
+ divGreyOut.id = "GreyOut";
159
+ divGreyOut.className = "GreyOutLayer";
160
+ divGreyOut.style.visibility = "visible";
161
+ divGreyOut.style.height = GetPageHeight().toString(10) + "px";
162
+ document.body.appendChild(divGreyOut);
163
+ }
164
+
165
+ function CreatePopUp(headerText, width, height, top, left) {
166
+ var divTemp = document.createElement("div");
167
+
168
+ divTemp.style.padding = "0";
169
+ divTemp.style.zIndex = "103";
170
+ divTemp.style.position = "absolute";
171
+ divTemp.id = "popUpMaster";
172
+
173
+ var headingText = document.createElement("h4");
174
+ headingText.innerHTML = headerText;
175
+
176
+ var closeButton = document.createElement("a");
177
+ closeButton.innerHTML = "&nbsp&nbsp&nbsp&nbsp";
178
+ closeButton.href = "javascript:;";
179
+ closeButton.className = "closePopUp";
180
+ closeButton.onclick = ClosePopup;
181
+ closeButton.id = "closeButton";
182
+
183
+ var img1 = document.createElement("img");
184
+ img1.src ="../wp-content/plugins/wp-insert/images/popUpTopLft.png";
185
+ img1.id = "popUpTopLft";
186
+
187
+ var img2 = document.createElement("img");
188
+ img2.src = "../wp-content/plugins/wp-insert/images/popUpTop.png";
189
+ img2.id = "popUpTop";
190
+
191
+ var img3 = document.createElement("img");
192
+ img3.src = "../wp-content/plugins/wp-insert/images/popUpTopRgt.png";
193
+ img3.id = "popUpTopRgt";
194
+
195
+ var img4 = document.createElement("img");
196
+ img4.src = "../wp-content/plugins/wp-insert/images/popUpLft.png";
197
+ img4.id = "popUpLft";
198
+
199
+ var img5 = document.createElement("img");
200
+ img5.src = "../wp-content/plugins/wp-insert/images/popUpRgt.png";
201
+ img5.id = "popUpRgt";
202
+
203
+ var img6 = document.createElement("img");
204
+ img6.src = "../wp-content/plugins/wp-insert/images/popUpBtmLft.png";
205
+ img6.id = "popUpBtmLft";
206
+
207
+ var img7 = document.createElement("img");
208
+ img7.src = "../wp-content/plugins/wp-insert/images/popUpBtmRgt.png";
209
+ img7.id = "popUpBtmRgt";
210
+
211
+ var img8 = document.createElement("img");
212
+ img8.src = "../wp-content/plugins/wp-insert/images/popUpBtm.png";
213
+ img8.id = "popUpBtm";
214
+
215
+ var divContentArea = document.createElement("div");
216
+ divContentArea.id = "content";
217
+
218
+ divTemp.appendChild(headingText);
219
+ divTemp.appendChild(closeButton);
220
+ divTemp.appendChild(img1);
221
+ divTemp.appendChild(img2);
222
+ divTemp.appendChild(img3);
223
+ divTemp.appendChild(img4);
224
+ divTemp.appendChild(img5);
225
+ divTemp.appendChild(img6);
226
+ divTemp.appendChild(img7);
227
+ divTemp.appendChild(img8);
228
+ divTemp.appendChild(divContentArea);
229
+
230
+
231
+ document.body.appendChild(divTemp);
232
+
233
+ try {
234
+ InitialisePopUP(width, height, top, left);
235
+ }
236
+ catch (err) {
237
+ }
238
+ return divContentArea; ;
239
+
240
+ }
241
+
242
+ function ClosePopup() {
243
+ if (document.getElementById("popUpMaster")) {
244
+ document.body.removeChild(document.getElementById("popUpMaster"));
245
+ }
246
+ if (document.getElementById("GreyOut")) {
247
+ document.body.removeChild(document.getElementById("GreyOut"));
248
+ }
249
+ }
250
+
251
+ /* End PopUps */
js/jquery/jquery.corner.js ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery corner plugin
3
+ *
4
+ * version 1.7 (1/26/2007)
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ */
10
+
11
+ /**
12
+ * The corner() method provides a simple way of styling DOM elements.
13
+ *
14
+ * corner() takes a single string argument: $().corner("effect corners width")
15
+ *
16
+ * effect: The name of the effect to apply, such as round or bevel.
17
+ * If you don't specify an effect, rounding is used.
18
+ *
19
+ * corners: The corners can be one or more of top, bottom, tr, tl, br, or bl.
20
+ * By default, all four corners are adorned.
21
+ *
22
+ * width: The width specifies the width of the effect; in the case of rounded corners this
23
+ * will be the radius of the width.
24
+ * Specify this value using the px suffix such as 10px, and yes it must be pixels.
25
+ *
26
+ * For more details see: http://methvin.com/jquery/jq-corner.html
27
+ * For a full demo see: http://malsup.com/jquery/corner/
28
+ *
29
+ *
30
+ * @example $('.adorn').corner();
31
+ * @desc Create round, 10px corners
32
+ *
33
+ * @example $('.adorn').corner("25px");
34
+ * @desc Create round, 25px corners
35
+ *
36
+ * @example $('.adorn').corner("notch bottom");
37
+ * @desc Create notched, 10px corners on bottom only
38
+ *
39
+ * @example $('.adorn').corner("tr dog 25px");
40
+ * @desc Create dogeared, 25px corner on the top-right corner only
41
+ *
42
+ * @example $('.adorn').corner("round 8px").parent().css('padding', '4px').corner("round 10px");
43
+ * @desc Create a rounded border effect by styling both the element and its parent
44
+ *
45
+ * @name corner
46
+ * @type jQuery
47
+ * @param String options Options which control the corner style
48
+ * @cat Plugins/Corner
49
+ * @return jQuery
50
+ * @author Dave Methvin (dave.methvin@gmail.com)
51
+ * @author Mike Alsup (malsup@gmail.com)
52
+ */
53
+ jQuery.fn.corner = function(o) {
54
+ function hex2(s) {
55
+ var s = parseInt(s).toString(16);
56
+ return ( s.length < 2 ) ? '0'+s : s;
57
+ };
58
+ function gpc(node) {
59
+ for ( ; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode ) {
60
+ var v = jQuery.css(node,'backgroundColor');
61
+ if ( v.indexOf('rgb') >= 0 ) {
62
+ rgb = v.match(/\d+/g);
63
+ return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
64
+ }
65
+ if ( v && v != 'transparent' )
66
+ return v;
67
+ }
68
+ return '#ffffff';
69
+ };
70
+ function getW(i) {
71
+ switch(fx) {
72
+ case 'round': return Math.round(width*(1-Math.cos(Math.asin(i/width))));
73
+ case 'cool': return Math.round(width*(1+Math.cos(Math.asin(i/width))));
74
+ case 'sharp': return Math.round(width*(1-Math.cos(Math.acos(i/width))));
75
+ case 'bite': return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
76
+ case 'slide': return Math.round(width*(Math.atan2(i,width/i)));
77
+ case 'jut': return Math.round(width*(Math.atan2(width,(width-i-1))));
78
+ case 'curl': return Math.round(width*(Math.atan(i)));
79
+ case 'tear': return Math.round(width*(Math.cos(i)));
80
+ case 'wicked': return Math.round(width*(Math.tan(i)));
81
+ case 'long': return Math.round(width*(Math.sqrt(i)));
82
+ case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
83
+ case 'dog': return (i&1) ? (i+1) : width;
84
+ case 'dog2': return (i&2) ? (i+1) : width;
85
+ case 'dog3': return (i&3) ? (i+1) : width;
86
+ case 'fray': return (i%2)*width;
87
+ case 'notch': return width;
88
+ case 'bevel': return i+1;
89
+ }
90
+ };
91
+ o = (o||"").toLowerCase();
92
+ var keep = /keep/.test(o); // keep borders?
93
+ var cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]); // corner color
94
+ var sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]); // strip color
95
+ var width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10; // corner width
96
+ var re = /round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;
97
+ var fx = ((o.match(re)||['round'])[0]);
98
+ var edges = { T:0, B:1 };
99
+ var opts = {
100
+ TL: /top|tl/.test(o), TR: /top|tr/.test(o),
101
+ BL: /bottom|bl/.test(o), BR: /bottom|br/.test(o)
102
+ };
103
+ if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
104
+ opts = { TL:1, TR:1, BL:1, BR:1 };
105
+ var strip = document.createElement('div');
106
+ strip.style.overflow = 'hidden';
107
+ strip.style.height = '1px';
108
+ strip.style.backgroundColor = sc || 'transparent';
109
+ strip.style.borderStyle = 'solid';
110
+ return this.each(function(index){
111
+ var pad = {
112
+ T: parseInt(jQuery.css(this,'paddingTop'))||0, R: parseInt(jQuery.css(this,'paddingRight'))||0,
113
+ B: parseInt(jQuery.css(this,'paddingBottom'))||0, L: parseInt(jQuery.css(this,'paddingLeft'))||0
114
+ };
115
+
116
+ if (jQuery.browser.msie) this.style.zoom = 1; // force 'hasLayout' in IE
117
+ if (!keep) this.style.border = 'none';
118
+ strip.style.borderColor = cc || gpc(this.parentNode);
119
+ var cssHeight = jQuery.curCSS(this, 'height');
120
+
121
+ for (var j in edges) {
122
+ var bot = edges[j];
123
+ strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
124
+ var d = document.createElement('div');
125
+ var ds = d.style;
126
+
127
+ bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);
128
+
129
+ if (bot && cssHeight != 'auto') {
130
+ if (jQuery.css(this,'position') == 'static')
131
+ this.style.position = 'relative';
132
+ ds.position = 'absolute';
133
+ ds.bottom = ds.left = ds.padding = ds.margin = '0';
134
+ if (jQuery.browser.msie)
135
+ ds.setExpression('width', 'this.parentNode.offsetWidth');
136
+ else
137
+ ds.width = '100%';
138
+ }
139
+ else {
140
+ ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' :
141
+ (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';
142
+ }
143
+
144
+ for (var i=0; i < width; i++) {
145
+ var w = Math.max(0,getW(i));
146
+ var e = strip.cloneNode(false);
147
+ e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
148
+ bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
149
+ }
150
+ }
151
+ });
152
+ };
js/jquery/ui.core.js ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI @VERSION
3
+ *
4
+ * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI
9
+ */
10
+ ;(function($) {
11
+
12
+ $.ui = {
13
+ plugin: {
14
+ add: function(module, option, set) {
15
+ var proto = $.ui[module].prototype;
16
+ for(var i in set) {
17
+ proto.plugins[i] = proto.plugins[i] || [];
18
+ proto.plugins[i].push([option, set[i]]);
19
+ }
20
+ },
21
+ call: function(instance, name, args) {
22
+ var set = instance.plugins[name];
23
+ if(!set) { return; }
24
+
25
+ for (var i = 0; i < set.length; i++) {
26
+ if (instance.options[set[i][0]]) {
27
+ set[i][1].apply(instance.element, args);
28
+ }
29
+ }
30
+ }
31
+ },
32
+ cssCache: {},
33
+ css: function(name) {
34
+ if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
35
+ var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
36
+
37
+ //if (!$.browser.safari)
38
+ //tmp.appendTo('body');
39
+
40
+ //Opera and Safari set width and height to 0px instead of auto
41
+ //Safari returns rgba(0,0,0,0) when bgcolor is not set
42
+ $.ui.cssCache[name] = !!(
43
+ (!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||
44
+ !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
45
+ );
46
+ try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){}
47
+ return $.ui.cssCache[name];
48
+ },
49
+ disableSelection: function(e) {
50
+ e.unselectable = "on";
51
+ e.onselectstart = function() { return false; };
52
+ if (e.style) { e.style.MozUserSelect = "none"; }
53
+ },
54
+ enableSelection: function(e) {
55
+ e.unselectable = "off";
56
+ e.onselectstart = function() { return true; };
57
+ if (e.style) { e.style.MozUserSelect = ""; }
58
+ },
59
+ hasScroll: function(e, a) {
60
+ var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false;
61
+ if (e[scroll] > 0) return true; e[scroll] = 1;
62
+ has = e[scroll] > 0 ? true : false; e[scroll] = 0;
63
+ return has;
64
+ }
65
+ };
66
+
67
+
68
+ /** jQuery core modifications and additions **/
69
+
70
+ var _remove = $.fn.remove;
71
+ $.fn.remove = function() {
72
+ $("*", this).add(this).trigger("remove");
73
+ return _remove.apply(this, arguments );
74
+ };
75
+
76
+ // $.widget is a factory to create jQuery plugins
77
+ // taking some boilerplate code out of the plugin code
78
+ // created by Scott González and Jörn Zaefferer
79
+ function getter(namespace, plugin, method) {
80
+ var methods = $[namespace][plugin].getter || [];
81
+ methods = (typeof methods == "string" ? methods.split(/,?\s+/) : methods);
82
+ return ($.inArray(method, methods) != -1);
83
+ }
84
+
85
+ $.widget = function(name, prototype) {
86
+ var namespace = name.split(".")[0];
87
+ name = name.split(".")[1];
88
+
89
+ // create plugin method
90
+ $.fn[name] = function(options) {
91
+ var isMethodCall = (typeof options == 'string'),
92
+ args = Array.prototype.slice.call(arguments, 1);
93
+
94
+ if (isMethodCall && getter(namespace, name, options)) {
95
+ var instance = $.data(this[0], name);
96
+ return (instance ? instance[options].apply(instance, args)
97
+ : undefined);
98
+ }
99
+
100
+ return this.each(function() {
101
+ var instance = $.data(this, name);
102
+ if (isMethodCall && instance && $.isFunction(instance[options])) {
103
+ instance[options].apply(instance, args);
104
+ } else if (!isMethodCall) {
105
+ $.data(this, name, new $[namespace][name](this, options));
106
+ }
107
+ });
108
+ };
109
+
110
+ // create widget constructor
111
+ $[namespace][name] = function(element, options) {
112
+ var self = this;
113
+
114
+ this.widgetName = name;
115
+ this.widgetBaseClass = namespace + '-' + name;
116
+
117
+ this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, options);
118
+ this.element = $(element)
119
+ .bind('setData.' + name, function(e, key, value) {
120
+ return self.setData(key, value);
121
+ })
122
+ .bind('getData.' + name, function(e, key) {
123
+ return self.getData(key);
124
+ })
125
+ .bind('remove', function() {
126
+ return self.destroy();
127
+ });
128
+ this.init();
129
+ };
130
+
131
+ // add widget prototype
132
+ $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
133
+ };
134
+
135
+ $.widget.prototype = {
136
+ init: function() {},
137
+ destroy: function() {
138
+ this.element.removeData(this.widgetName);
139
+ },
140
+
141
+ getData: function(key) {
142
+ return this.options[key];
143
+ },
144
+ setData: function(key, value) {
145
+ this.options[key] = value;
146
+
147
+ if (key == 'disabled') {
148
+ this.element[value ? 'addClass' : 'removeClass'](
149
+ this.widgetBaseClass + '-disabled');
150
+ }
151
+ },
152
+
153
+ enable: function() {
154
+ this.setData('disabled', false);
155
+ },
156
+ disable: function() {
157
+ this.setData('disabled', true);
158
+ }
159
+ };
160
+
161
+ $.widget.defaults = {
162
+ disabled: false
163
+ };
164
+
165
+
166
+ /** Mouse Interaction Plugin **/
167
+
168
+ $.ui.mouse = {
169
+ mouseInit: function() {
170
+ var self = this;
171
+
172
+ this.element.bind('mousedown.'+this.widgetName, function(e) {
173
+ return self.mouseDown(e);
174
+ });
175
+
176
+ // Prevent text selection in IE
177
+ if ($.browser.msie) {
178
+ this._mouseUnselectable = this.element.attr('unselectable');
179
+ this.element.attr('unselectable', 'on');
180
+ }
181
+
182
+ this.started = false;
183
+ },
184
+
185
+ // TODO: make sure destroying one instance of mouse doesn't mess with
186
+ // other instances of mouse
187
+ mouseDestroy: function() {
188
+ this.element.unbind('.'+this.widgetName);
189
+
190
+ // Restore text selection in IE
191
+ ($.browser.msie
192
+ && this.element.attr('unselectable', this._mouseUnselectable));
193
+ },
194
+
195
+ mouseDown: function(e) {
196
+ // we may have missed mouseup (out of window)
197
+ (this._mouseStarted && this.mouseUp(e));
198
+
199
+ this._mouseDownEvent = e;
200
+
201
+ var self = this,
202
+ btnIsLeft = (e.which == 1),
203
+ elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).is(this.options.cancel) : false);
204
+ if (!btnIsLeft || elIsCancel || !this.mouseCapture(e)) {
205
+ return true;
206
+ }
207
+
208
+ this._mouseDelayMet = !this.options.delay;
209
+ if (!this._mouseDelayMet) {
210
+ this._mouseDelayTimer = setTimeout(function() {
211
+ self._mouseDelayMet = true;
212
+ }, this.options.delay);
213
+ }
214
+
215
+ if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
216
+ this._mouseStarted = (this.mouseStart(e) !== false);
217
+ if (!this._mouseStarted) {
218
+ e.preventDefault();
219
+ return true;
220
+ }
221
+ }
222
+
223
+ // these delegates are required to keep context
224
+ this._mouseMoveDelegate = function(e) {
225
+ return self.mouseMove(e);
226
+ };
227
+ this._mouseUpDelegate = function(e) {
228
+ return self.mouseUp(e);
229
+ };
230
+ $(document)
231
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
232
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
233
+
234
+ return false;
235
+ },
236
+
237
+ mouseMove: function(e) {
238
+ // IE mouseup check - mouseup happened when mouse was out of window
239
+ if ($.browser.msie && !e.button) {
240
+ return this.mouseUp(e);
241
+ }
242
+
243
+ if (this._mouseStarted) {
244
+ this.mouseDrag(e);
245
+ return false;
246
+ }
247
+
248
+ if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
249
+ this._mouseStarted =
250
+ (this.mouseStart(this._mouseDownEvent, e) !== false);
251
+ (this._mouseStarted ? this.mouseDrag(e) : this.mouseUp(e));
252
+ }
253
+
254
+ return !this._mouseStarted;
255
+ },
256
+
257
+ mouseUp: function(e) {
258
+ $(document)
259
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
260
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
261
+
262
+ if (this._mouseStarted) {
263
+ this._mouseStarted = false;
264
+ this.mouseStop(e);
265
+ }
266
+
267
+ return false;
268
+ },
269
+
270
+ mouseDistanceMet: function(e) {
271
+ return (Math.max(
272
+ Math.abs(this._mouseDownEvent.pageX - e.pageX),
273
+ Math.abs(this._mouseDownEvent.pageY - e.pageY)
274
+ ) >= this.options.distance
275
+ );
276
+ },
277
+
278
+ mouseDelayMet: function(e) {
279
+ return this._mouseDelayMet;
280
+ },
281
+
282
+ // These are placeholder methods, to be overriden by extending plugin
283
+ mouseStart: function(e) {},
284
+ mouseDrag: function(e) {},
285
+ mouseStop: function(e) {},
286
+ mouseCapture: function(e) { return true; }
287
+ };
288
+
289
+ $.ui.mouse.defaults = {
290
+ cancel: null,
291
+ distance: 1,
292
+ delay: 0
293
+ };
294
+
295
+ })(jQuery);
js/jquery/ui.draggable.js ADDED
@@ -0,0 +1,560 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Draggable
3
+ *
4
+ * Copyright (c) 2008 Paul Bakaus
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Draggables
9
+ *
10
+ * Depends:
11
+ * ui.core.js
12
+ */
13
+ (function($) {
14
+
15
+ $.widget("ui.draggable", $.extend($.ui.mouse, {
16
+ init: function() {
17
+
18
+ //Initialize needed constants
19
+ var o = this.options;
20
+
21
+ //Position the node
22
+ if (o.helper == 'original' && !(/(relative|absolute|fixed)/).test(this.element.css('position')))
23
+ this.element.css('position', 'relative');
24
+
25
+ this.element.addClass('ui-draggable');
26
+ (o.disabled && this.element.addClass('ui-draggable-disabled'));
27
+
28
+ this.mouseInit();
29
+
30
+ },
31
+ mouseStart: function(e) {
32
+ var o = this.options;
33
+
34
+ if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle')) return false;
35
+
36
+ var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
37
+
38
+
39
+ $(this.options.handle, this.element).find("*").andSelf().each(function() {
40
+ if(this == e.target) handle = true;
41
+ });
42
+ if (!handle) return false;
43
+
44
+ if($.ui.ddmanager) $.ui.ddmanager.current = this;
45
+
46
+ //Create and append the visible helper
47
+ this.helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element);
48
+ if(!this.helper.parents('body').length) this.helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
49
+ if(this.helper[0] != this.element[0] && !(/(fixed|absolute)/).test(this.helper.css("position"))) this.helper.css("position", "absolute");
50
+
51
+ /*
52
+ * - Position generation -
53
+ * This block generates everything position related - it's the core of draggables.
54
+ */
55
+
56
+ this.margins = { //Cache the margins
57
+ left: (parseInt(this.element.css("marginLeft"),10) || 0),
58
+ top: (parseInt(this.element.css("marginTop"),10) || 0)
59
+ };
60
+
61
+ this.cssPosition = this.helper.css("position"); //Store the helper's css position
62
+ this.offset = this.element.offset(); //The element's absolute position on the page
63
+ this.offset = { //Substract the margins from the element's absolute offset
64
+ top: this.offset.top - this.margins.top,
65
+ left: this.offset.left - this.margins.left
66
+ };
67
+
68
+ this.offset.click = { //Where the click happened, relative to the element
69
+ left: e.pageX - this.offset.left,
70
+ top: e.pageY - this.offset.top
71
+ };
72
+
73
+ this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); //Get the offsetParent and cache its position
74
+ if(this.offsetParent[0] == document.body && $.browser.mozilla) po = { top: 0, left: 0 }; //Ugly FF3 fix
75
+ this.offset.parent = { //Store its position plus border
76
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
77
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
78
+ };
79
+
80
+ var p = this.element.position(); //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helpers
81
+ this.offset.relative = this.cssPosition == "relative" ? {
82
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.offsetParent[0].scrollTop,
83
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.offsetParent[0].scrollLeft
84
+ } : { top: 0, left: 0 };
85
+
86
+ this.originalPosition = this.generatePosition(e); //Generate the original position
87
+ this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size
88
+
89
+ if(o.cursorAt) {
90
+ if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left + this.margins.left;
91
+ if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right + this.margins.left;
92
+ if(o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top + this.margins.top;
93
+ if(o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom + this.margins.top;
94
+ }
95
+
96
+
97
+ /*
98
+ * - Position constraining -
99
+ * Here we prepare position constraining like grid and containment.
100
+ */
101
+
102
+ if(o.containment) {
103
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
104
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
105
+ 0 - this.offset.relative.left - this.offset.parent.left,
106
+ 0 - this.offset.relative.top - this.offset.parent.top,
107
+ $(o.containment == 'document' ? document : window).width() - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
108
+ ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
109
+ ];
110
+
111
+ if(!(/^(document|window|parent)$/).test(o.containment)) {
112
+ var ce = $(o.containment)[0];
113
+ var co = $(o.containment).offset();
114
+
115
+ this.containment = [
116
+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left,
117
+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top,
118
+ co.left+Math.max(ce.scrollWidth,ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
119
+ co.top+Math.max(ce.scrollHeight,ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
120
+ ];
121
+ }
122
+ }
123
+
124
+ //Call plugins and callbacks
125
+ this.propagate("start", e);
126
+
127
+ this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
128
+ if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
129
+
130
+ this.helper.addClass("ui-draggable-dragging");
131
+ this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
132
+ return true;
133
+ },
134
+ convertPositionTo: function(d, pos) {
135
+ if(!pos) pos = this.position;
136
+ var mod = d == "absolute" ? 1 : -1;
137
+ return {
138
+ top: (
139
+ pos.top // the calculated relative position
140
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
141
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
142
+ - (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop) * mod // The offsetParent's scroll position, not if the element is fixed
143
+ + (this.cssPosition == "fixed" ? $(document).scrollTop() : 0) * mod
144
+ + this.margins.top * mod //Add the margin (you don't want the margin counting in intersection methods)
145
+ ),
146
+ left: (
147
+ pos.left // the calculated relative position
148
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
149
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
150
+ - (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft) * mod // The offsetParent's scroll position, not if the element is fixed
151
+ + (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0) * mod
152
+ + this.margins.left * mod //Add the margin (you don't want the margin counting in intersection methods)
153
+ )
154
+ };
155
+ },
156
+ generatePosition: function(e) {
157
+
158
+ var o = this.options;
159
+ var position = {
160
+ top: (
161
+ e.pageY // The absolute mouse position
162
+ - this.offset.click.top // Click offset (relative to the element)
163
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
164
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
165
+ + (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop) // The offsetParent's scroll position, not if the element is fixed
166
+ - (this.cssPosition == "fixed" ? $(document).scrollTop() : 0)
167
+ ),
168
+ left: (
169
+ e.pageX // The absolute mouse position
170
+ - this.offset.click.left // Click offset (relative to the element)
171
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
172
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
173
+ + (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed
174
+ - (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0)
175
+ )
176
+ };
177
+
178
+ if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options
179
+
180
+ /*
181
+ * - Position constraining -
182
+ * Constrain the position to a mix of grid, containment.
183
+ */
184
+ if(this.containment) {
185
+ if(position.left < this.containment[0]) position.left = this.containment[0];
186
+ if(position.top < this.containment[1]) position.top = this.containment[1];
187
+ if(position.left > this.containment[2]) position.left = this.containment[2];
188
+ if(position.top > this.containment[3]) position.top = this.containment[3];
189
+ }
190
+
191
+ if(o.grid) {
192
+ var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
193
+ position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
194
+
195
+ var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
196
+ position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
197
+ }
198
+
199
+ return position;
200
+ },
201
+ mouseDrag: function(e) {
202
+
203
+ //Compute the helpers position
204
+ this.position = this.generatePosition(e);
205
+ this.positionAbs = this.convertPositionTo("absolute");
206
+
207
+ //Call plugins and callbacks and use the resulting position if something is returned
208
+ this.position = this.propagate("drag", e) || this.position;
209
+
210
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
211
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
212
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
213
+
214
+ return false;
215
+ },
216
+ mouseStop: function(e) {
217
+
218
+ //If we are using droppables, inform the manager about the drop
219
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
220
+ $.ui.ddmanager.drop(this, e);
221
+
222
+ if(this.options.revert) {
223
+ var self = this;
224
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revert, 10) || 500, function() {
225
+ self.propagate("stop", e);
226
+ self.clear();
227
+ });
228
+ } else {
229
+ this.propagate("stop", e);
230
+ this.clear();
231
+ }
232
+
233
+ return false;
234
+ },
235
+ clear: function() {
236
+ this.helper.removeClass("ui-draggable-dragging");
237
+ if(this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove();
238
+ //if($.ui.ddmanager) $.ui.ddmanager.current = null;
239
+ this.helper = null;
240
+ this.cancelHelperRemoval = false;
241
+ },
242
+
243
+ // From now on bulk stuff - mainly helpers
244
+ plugins: {},
245
+ uiHash: function(e) {
246
+ return {
247
+ helper: this.helper,
248
+ position: this.position,
249
+ absolutePosition: this.positionAbs,
250
+ options: this.options
251
+ };
252
+ },
253
+ propagate: function(n,e) {
254
+ $.ui.plugin.call(this, n, [e, this.uiHash()]);
255
+ return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [e, this.uiHash()], this.options[n]);
256
+ },
257
+ destroy: function() {
258
+ if(!this.element.data('draggable')) return;
259
+ this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable');
260
+ this.mouseDestroy();
261
+ }
262
+ }));
263
+
264
+ $.extend($.ui.draggable, {
265
+ defaults: {
266
+ appendTo: "parent",
267
+ axis: false,
268
+ cancel: ":input",
269
+ delay: 0,
270
+ distance: 1,
271
+ helper: "original"
272
+ }
273
+ });
274
+
275
+ $.ui.plugin.add("draggable", "cursor", {
276
+ start: function(e, ui) {
277
+ var t = $('body');
278
+ if (t.css("cursor")) ui.options._cursor = t.css("cursor");
279
+ t.css("cursor", ui.options.cursor);
280
+ },
281
+ stop: function(e, ui) {
282
+ if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);
283
+ }
284
+ });
285
+
286
+ $.ui.plugin.add("draggable", "zIndex", {
287
+ start: function(e, ui) {
288
+ var t = $(ui.helper);
289
+ if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");
290
+ t.css('zIndex', ui.options.zIndex);
291
+ },
292
+ stop: function(e, ui) {
293
+ if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);
294
+ }
295
+ });
296
+
297
+ $.ui.plugin.add("draggable", "opacity", {
298
+ start: function(e, ui) {
299
+ var t = $(ui.helper);
300
+ if(t.css("opacity")) ui.options._opacity = t.css("opacity");
301
+ t.css('opacity', ui.options.opacity);
302
+ },
303
+ stop: function(e, ui) {
304
+ if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);
305
+ }
306
+ });
307
+
308
+ $.ui.plugin.add("draggable", "iframeFix", {
309
+ start: function(e, ui) {
310
+ $(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {
311
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
312
+ .css({
313
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
314
+ position: "absolute", opacity: "0.001", zIndex: 1000
315
+ })
316
+ .css($(this).offset())
317
+ .appendTo("body");
318
+ });
319
+ },
320
+ stop: function(e, ui) {
321
+ $("div.DragDropIframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
322
+ }
323
+ });
324
+
325
+ $.ui.plugin.add("draggable", "scroll", {
326
+ start: function(e, ui) {
327
+ var o = ui.options;
328
+ var i = $(this).data("draggable");
329
+ o.scrollSensitivity = o.scrollSensitivity || 20;
330
+ o.scrollSpeed = o.scrollSpeed || 20;
331
+
332
+ i.overflowY = function(el) {
333
+ do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
334
+ return $(document);
335
+ }(this);
336
+ i.overflowX = function(el) {
337
+ do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
338
+ return $(document);
339
+ }(this);
340
+
341
+ if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
342
+ if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
343
+
344
+ },
345
+ drag: function(e, ui) {
346
+
347
+ var o = ui.options;
348
+ var i = $(this).data("draggable");
349
+
350
+ if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
351
+ if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
352
+ i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;
353
+ if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)
354
+ i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;
355
+
356
+ } else {
357
+ if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
358
+ $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
359
+ if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
360
+ $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
361
+ }
362
+
363
+ if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
364
+ if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
365
+ i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;
366
+ if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity)
367
+ i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;
368
+ } else {
369
+ if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)
370
+ $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
371
+ if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
372
+ $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
373
+ }
374
+
375
+ }
376
+ });
377
+
378
+ $.ui.plugin.add("draggable", "snap", {
379
+ start: function(e, ui) {
380
+
381
+ var inst = $(this).data("draggable");
382
+ inst.snapElements = [];
383
+ $(ui.options.snap === true ? '.ui-draggable' : ui.options.snap).each(function() {
384
+ var $t = $(this); var $o = $t.offset();
385
+ if(this != inst.element[0]) inst.snapElements.push({
386
+ item: this,
387
+ width: $t.outerWidth(), height: $t.outerHeight(),
388
+ top: $o.top, left: $o.left
389
+ });
390
+ });
391
+
392
+ },
393
+ drag: function(e, ui) {
394
+
395
+ var inst = $(this).data("draggable");
396
+ var d = ui.options.snapTolerance || 20;
397
+ var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,
398
+ y1 = ui.absolutePosition.top, y2 = y1 + inst.helperProportions.height;
399
+
400
+ for (var i = inst.snapElements.length - 1; i >= 0; i--){
401
+
402
+ var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
403
+ t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
404
+
405
+ //Yes, I know, this is insane ;)
406
+ if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) continue;
407
+
408
+ if(ui.options.snapMode != 'inner') {
409
+ var ts = Math.abs(t - y2) <= 20;
410
+ var bs = Math.abs(b - y1) <= 20;
411
+ var ls = Math.abs(l - x2) <= 20;
412
+ var rs = Math.abs(r - x1) <= 20;
413
+ if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
414
+ if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b, left: 0 }).top;
415
+ if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
416
+ if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r }).left;
417
+ }
418
+
419
+ if(ui.options.snapMode != 'outer') {
420
+ var ts = Math.abs(t - y1) <= 20;
421
+ var bs = Math.abs(b - y2) <= 20;
422
+ var ls = Math.abs(l - x1) <= 20;
423
+ var rs = Math.abs(r - x2) <= 20;
424
+ if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t, left: 0 }).top;
425
+ if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
426
+ if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l }).left;
427
+ if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
428
+ }
429
+
430
+ };
431
+ }
432
+ });
433
+
434
+ $.ui.plugin.add("draggable", "connectToSortable", {
435
+ start: function(e,ui) {
436
+
437
+ var inst = $(this).data("draggable");
438
+ inst.sortables = [];
439
+ $(ui.options.connectToSortable).each(function() {
440
+ if($.data(this, 'sortable')) {
441
+ var sortable = $.data(this, 'sortable');
442
+ inst.sortables.push({
443
+ instance: sortable,
444
+ shouldRevert: sortable.options.revert
445
+ });
446
+ sortable.refreshItems(); //Do a one-time refresh at start to refresh the containerCache
447
+ sortable.propagate("activate", e, inst);
448
+ }
449
+ });
450
+
451
+ },
452
+ stop: function(e,ui) {
453
+
454
+ //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
455
+ var inst = $(this).data("draggable");
456
+
457
+ $.each(inst.sortables, function() {
458
+ if(this.instance.isOver) {
459
+ this.instance.isOver = 0;
460
+ inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
461
+ this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
462
+ if(this.shouldRevert) this.instance.options.revert = true; //revert here
463
+ this.instance.mouseStop(e);
464
+
465
+ //Also propagate receive event, since the sortable is actually receiving a element
466
+ this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), { sender: inst.element })], this.instance.options["receive"]);
467
+
468
+ this.instance.options.helper = this.instance.options._helper;
469
+ } else {
470
+ this.instance.propagate("deactivate", e, inst);
471
+ }
472
+
473
+ });
474
+
475
+ },
476
+ drag: function(e,ui) {
477
+
478
+ var inst = $(this).data("draggable"), self = this;
479
+
480
+ var checkPos = function(o) {
481
+
482
+ var l = o.left, r = l + o.width,
483
+ t = o.top, b = t + o.height;
484
+
485
+ return (l < (this.positionAbs.left + this.offset.click.left) && (this.positionAbs.left + this.offset.click.left) < r
486
+ && t < (this.positionAbs.top + this.offset.click.top) && (this.positionAbs.top + this.offset.click.top) < b);
487
+ };
488
+
489
+ $.each(inst.sortables, function(i) {
490
+
491
+ if(checkPos.call(inst, this.instance.containerCache)) {
492
+
493
+ //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
494
+ if(!this.instance.isOver) {
495
+ this.instance.isOver = 1;
496
+
497
+ //Now we fake the start of dragging for the sortable instance,
498
+ //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
499
+ //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
500
+ this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
501
+ this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
502
+ this.instance.options.helper = function() { return ui.helper[0]; };
503
+
504
+ e.target = this.instance.currentItem[0];
505
+ this.instance.mouseCapture(e, true);
506
+ this.instance.mouseStart(e, true, true);
507
+
508
+ //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
509
+ this.instance.offset.click.top = inst.offset.click.top;
510
+ this.instance.offset.click.left = inst.offset.click.left;
511
+ this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
512
+ this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
513
+
514
+ inst.propagate("toSortable", e);
515
+
516
+ }
517
+
518
+ //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
519
+ if(this.instance.currentItem) this.instance.mouseDrag(e);
520
+
521
+ } else {
522
+
523
+ //If it doesn't intersect with the sortable, and it intersected before,
524
+ //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
525
+ if(this.instance.isOver) {
526
+ this.instance.isOver = 0;
527
+ this.instance.cancelHelperRemoval = true;
528
+ this.instance.options.revert = false; //No revert here
529
+ this.instance.mouseStop(e, true);
530
+ this.instance.options.helper = this.instance.options._helper;
531
+
532
+ //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
533
+ this.instance.currentItem.remove();
534
+ if(this.instance.placeholder) this.instance.placeholder.remove();
535
+
536
+ inst.propagate("fromSortable", e);
537
+ }
538
+
539
+ };
540
+
541
+ });
542
+
543
+ }
544
+ });
545
+
546
+ $.ui.plugin.add("draggable", "stack", {
547
+ start: function(e,ui) {
548
+ var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) {
549
+ return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min);
550
+ });
551
+
552
+ $(group).each(function(i) {
553
+ this.style.zIndex = ui.options.stack.min + i;
554
+ });
555
+
556
+ this[0].style.zIndex = ui.options.stack.min + group.length;
557
+ }
558
+ });
559
+
560
+ })(jQuery);
js/postpicker.js.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ function ShowPopUp() {
3
+ GreyOutScreen();
4
+ divPopup = CreatePopUp("Add New Folder", 285, 141, 100, 200);
5
+ divPopup.innerHTML = <?php wp_list_pages('echo = 0'); ?>;
6
+ }
7
+ </script>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://smartlogix.co.in/
4
  Tags: adsense,google,widget,post,admin,plugin,rss,feedburner,ads,subscribe,fck editor,category description editor,excerpt,WYSIWYG,WYSIWYG editor,in post ads,feed logo,smartlogix,ads in feeds,analytics,google analytics,header,footer,ad management,advertisements,content,ad,advertising,blog,feed,feeds,formatting,html,javascript,manage,post,posts,seo,sidebar,widget,widgets,wordpress,tracking,syntex highlighter,highlighting,theme tools,plugin tools,developer tools,highlighting,theme editor,plugin editor,middle ad,ad filtration,pagewise ad filtration
5
  Requires at least: 2.7
6
  Tested up to: 2.8.4
7
- Stable tag: 1.3.0
8
 
9
  WP-INSERT by SMARTLOGIX : The ultimate wordpress plugin
10
 
@@ -24,7 +24,7 @@ Manage Ads (Completely Rewritten with a New and Powerful Interface)<br/>
24
  * Insert ads to the right of the post <br/>
25
  * Option to show/hide ads on Home Page<br/>
26
  * Option to show/hide ads on Archive/Category/Tag Pages<br/>
27
- * Option to fiter ads from specified posts/pages<br/>
28
  * Option to control each and every ad<br/>
29
  Ten ad widgets at your disposal <br/>
30
  * Go to the widgets page under "Appearance" and place the widgets onto the sidebars you want the ads to appear onto <br/>
4
  Tags: adsense,google,widget,post,admin,plugin,rss,feedburner,ads,subscribe,fck editor,category description editor,excerpt,WYSIWYG,WYSIWYG editor,in post ads,feed logo,smartlogix,ads in feeds,analytics,google analytics,header,footer,ad management,advertisements,content,ad,advertising,blog,feed,feeds,formatting,html,javascript,manage,post,posts,seo,sidebar,widget,widgets,wordpress,tracking,syntex highlighter,highlighting,theme tools,plugin tools,developer tools,highlighting,theme editor,plugin editor,middle ad,ad filtration,pagewise ad filtration
5
  Requires at least: 2.7
6
  Tested up to: 2.8.4
7
+ Stable tag: 1.3.1
8
 
9
  WP-INSERT by SMARTLOGIX : The ultimate wordpress plugin
10
 
24
  * Insert ads to the right of the post <br/>
25
  * Option to show/hide ads on Home Page<br/>
26
  * Option to show/hide ads on Archive/Category/Tag Pages<br/>
27
+ * Option to fiter ads from specified posts/pages (With Popup picker for selecting the posts / pages)<br/>
28
  * Option to control each and every ad<br/>
29
  Ten ad widgets at your disposal <br/>
30
  * Go to the widgets page under "Appearance" and place the widgets onto the sidebars you want the ads to appear onto <br/>
wp-insert.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: wp-insert
4
  Plugin URI: http://www.smartlogix.co.in/
5
  Description: The ultimate wordpress plugin
6
- Version: 1.3.0
7
  Author: Namith Jawahar
8
  Author URI: http://www.smartlogix.co.in/
9
  WP-INSERT by SMARTLOGIX : The ultimate wordpress plugin
3
  Plugin Name: wp-insert
4
  Plugin URI: http://www.smartlogix.co.in/
5
  Description: The ultimate wordpress plugin
6
+ Version: 1.3.1
7
  Author: Namith Jawahar
8
  Author URI: http://www.smartlogix.co.in/
9
  WP-INSERT by SMARTLOGIX : The ultimate wordpress plugin