Hormold

VK Change (#1383578103)

Nov 4th, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 137.26 KB | None | 0 0
  1. Файл - ads.js (Старый размер - 91741 | Новый - 0):
  2. 0.  - var Ads = {};
  3. 1.  -
  4. 2.  - Ads.init = function() {
  5. 3.  -   showBackLink();
  6. 4.  - }
  7. 5.  -
  8. 6.  - Ads.initOfficesMenu = function(event) {
  9. 7.  -
  10. 8.  -   if (!window.DropdownMenu || !cur.mainNavigationOfficesItems) {
  11. 9.  -     return;
  12. 10.  -   }
  13. 11.  -
  14. 12.  -   if (cur.navigationOficesMenu) {
  15. 13.  -     return;
  16. 14.  -   }
  17. 15.  -
  18. 16.  -   ge('ads_navigation_offices_menu').removeAttribute('onmouseover');
  19. 17.  -
  20. 18.  -   function hideMenu() {
  21. 19.  -     cur.navigationOficesMenu.hide();
  22. 20.  -   }
  23. 21.  -
  24. 22.  -   var realLocation = '';
  25. 23.  -   if (location.hash.indexOf('#/') != -1 || location.hash.indexOf('#!') != -1) {
  26. 24.  -     realLocation = location.hash.replace('#/', '').replace('#!', '');
  27. 25.  -   } else {
  28. 26.  -     realLocation = location.pathname + location.search;
  29. 27.  -   }
  30. 28.  -
  31. 29.  -   var unionId;
  32. 30.  -   var unionIdReal;
  33. 31.  -   var unionIdParam = '';
  34. 32.  -   var curItems = [];
  35. 33.  -   for (var i in cur.mainNavigationOfficesItems) {
  36. 34.  -     curItems[i] = {};
  37. 35.  -     curItems[i].onClick = hideMenu;
  38. 36.  -     for (var j in cur.mainNavigationOfficesItems[i]) {
  39. 37.  -       curItems[i][j] = cur.mainNavigationOfficesItems[i][j];
  40. 38.  -     }
  41. 39.  -     if (curItems[i].i == 'all') {
  42. 40.  -       curItems[i].h = "/ads?act=offices_list";
  43. 41.  -     } else {
  44. 42.  -       unionId = '';
  45. 43.  -       unionIdReal = intval(curItems[i].i);
  46. 44.  -       unionIdParam = '';
  47. 45.  -       if (curItems[i].i.indexOf('default') == -1) {
  48. 46.  -         unionId = unionIdReal;
  49. 47.  -         unionIdParam = "&union_id=" + unionIdReal;
  50. 48.  -       }
  51. 49.  -
  52. 50.  -       var link = "/ads?act=office" + unionIdParam;
  53. 51.  -       if (!unionIdReal) {
  54. 52.  -         link = "/ads?act=no_office";
  55. 53.  -       } else if (cur.getOfficeLink) {
  56. 54.  -         link = cur.getOfficeLink(unionId);
  57. 55.  -       } else if (realLocation.match(/act=budget(&|$)/)) {
  58. 56.  -         link = "/ads?act=budget" + unionIdParam;
  59. 57.  -       } else if (realLocation.match(/act=export_stats(&|$)/)) {
  60. 58.  -         link = "/ads?act=export_stats" + unionIdParam;
  61. 59.  -       } else if (realLocation.match(/act=settings(&|$)/)) {
  62. 60.  -         link = "/ads?act=settings" + unionIdParam;
  63. 61.  -       }
  64. 62.  -
  65. 63.  -       curItems[i].h = link;
  66. 64.  -     }
  67. 65.  -   }
  68. 66.  -
  69. 67.  -   var options = {
  70. 68.  -     title: '<span id="ads_navigation_dd_menu_header_text">' + ge('ads_navigation_offices_menu_text').innerHTML + '</span>',
  71. 69.  -     containerClass: 'ads_navigation_dd_menu_header_wrap',
  72. 70.  -     target: ge('ads_navigation_offices_menu'),
  73. 71.  -     showHover: false,
  74. 72.  -     updateTarget: false,
  75. 73.  -     onSelect: function(e) {
  76. 74.  -     }
  77. 75.  -   };
  78. 76.  -   cur.navigationOficesMenu = new DropdownMenu(curItems, options);
  79. 77.  -   cur.destroy.push(function(){ cur.navigationOficesMenu.destroy(); });
  80. 78.  - }
  81. 79.  -
  82. 80.  - Ads.lock = function(lockKey, onLock, onUnlock) {
  83. 81.  -   if (!cur.locks) {
  84. 82.  -     cur.locks = {};
  85. 83.  -   }
  86. 84.  -   if (cur.locks[lockKey]) {
  87. 85.  -     return false;
  88. 86.  -   }
  89. 87.  -   cur.locks[lockKey] = {onLock: onLock, onUnlock: onUnlock};
  90. 88.  -   if (isFunction(cur.locks[lockKey].onLock)) {
  91. 89.  -     cur.locks[lockKey].onLock();
  92. 90.  -   }
  93. 91.  -   return true;
  94. 92.  - }
  95. 93.  -
  96. 94.  - Ads.unlock = function(lockKey) {
  97. 95.  -   if (!cur.locks) {
  98. 96.  -     cur.locks = {};
  99. 97.  -   }
  100. 98.  -   if (cur.locks[lockKey] && isFunction(cur.locks[lockKey].onUnlock)) {
  101. 99.  -     cur.locks[lockKey].onUnlock();
  102. 100.  -   }
  103. 101.  -   delete cur.locks[lockKey];
  104. 102.  - }
  105. 103.  -
  106. 104.  - Ads.simpleAjax = function(url, elem) {
  107. 105.  -   if (elem) {
  108. 106.  -     var elemRect = elem.getBoundingClientRect();
  109. 107.  -     var imgTop   = (elemRect.bottom - elemRect.top - 8) / 2;
  110. 108.  -     var span     = ce('span', {}, {position: 'relative'})
  111. 109.  -     var img      = ce('img', {src:'/images/upload.gif'}, {position: 'absolute', top: imgTop + 'px'});
  112. 110.  -     span.appendChild(img);
  113. 111.  -     elem.appendChild(span);
  114. 112.  -   }
  115. 113.  -
  116. 114.  -   ajax.post(url, {}, {onDone: onComplete, onFail: onComplete});
  117. 115.  -   function onComplete(response) {
  118. 116.  -     if (elem) {
  119. 117.  -       elem.removeChild(span);
  120. 118.  -     }
  121. 119.  -     if (response && response.html) {
  122. 120.  -       var boxOptions = {};
  123. 121.  -       boxOptions.title  = '���������';
  124. 122.  -       boxOptions.onHide = nav.reload;
  125. 123.  -       showFastBox(boxOptions, response.html);
  126. 124.  -     } else {
  127. 125.  -       nav.reload();
  128. 126.  -     }
  129. 127.  -     return true;
  130. 128.  -   }
  131. 129.  - }
  132. 130.  -
  133. 131.  - Ads.escapeValue = function(value) {
  134. 132.  -   return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  135. 133.  - }
  136. 134.  -
  137. 135.  - Ads.onInputEvent = function(event, func) {
  138. 136.  -   if (event.keyCode == KEY.RETURN) {
  139. 137.  -     func();
  140. 138.  -     return false;
  141. 139.  -   }
  142. 140.  -   return true;
  143. 141.  - }
  144. 142.  -
  145. 143.  - Ads.onSubLinkEvent = function(event) {
  146. 144.  -   event = normEvent(event);
  147. 145.  -   var elem = event.target
  148. 146.  -   var newLink = elem.getAttribute('href_');
  149. 147.  -   if (!newLink) {
  150. 148.  -     return;
  151. 149.  -   }
  152. 150.  -   var linkElem = elem;
  153. 151.  -   while (linkElem && linkElem.nodeName !== 'A') {
  154. 152.  -     linkElem = linkElem.parentNode;
  155. 153.  -   }
  156. 154.  -   if (!linkElem) {
  157. 155.  -     return;
  158. 156.  -   }
  159. 157.  -   if (event.type === 'mouseover') {
  160. 158.  -     elem.setAttribute('href_old', linkElem.href);
  161. 159.  -     linkElem.href = newLink;
  162. 160.  -   } else if (event.type === 'mouseout') {
  163. 161.  -     var oldLink = elem.getAttribute('href_old');
  164. 162.  -     if (oldLink) {
  165. 163.  -       linkElem.href = oldLink;
  166. 164.  -     } else {
  167. 165.  -       linkElem.removeAttribute('href');
  168. 166.  -     }
  169. 167.  -   }
  170. 168.  - }
  171. 169.  -
  172. 170.  - Ads.onBoxFail = function(message) {
  173. 171.  -   if (!message) {
  174. 172.  -     message = getLang('global_unknown_error');
  175. 173.  -   }
  176. 174.  -   setTimeout(function(){
  177. 175.  -     showFastBox(getLang('ads_error_box_title'), message);
  178. 176.  -   }, 1);
  179. 177.  -   return true;
  180. 178.  - }
  181. 179.  -
  182. 180.  - Ads.setLoginHandlers = function(onLoginDoneNew, onLoginFailedNew) {
  183. 181.  -   var restoreOnLoginDone = function(handler) {
  184. 182.  -     if (cur.onLoginDoneWindowOld && window.onLoginDone == handler) {
  185. 183.  -       window.onLoginDone = cur.onLoginDoneWindowOld;
  186. 184.  -       delete cur.onLoginDoneWindowOld;
  187. 185.  -     }
  188. 186.  -   }
  189. 187.  -   var restoreOnLoginFailed = function(handler) {
  190. 188.  -     if (cur.onLoginFailedWindowOld && window.onLoginFailed == handler) {
  191. 189.  -       window.onLoginFailed = cur.onLoginFailedWindowOld;
  192. 190.  -       delete cur.onLoginFailedWindowOld;
  193. 191.  -     }
  194. 192.  -   }
  195. 193.  -
  196. 194.  -   if (onLoginDoneNew) {
  197. 195.  -     if (window.onLoginDone != onLoginDoneNew) {
  198. 196.  -       cur.onLoginDoneWindowOld = window.onLoginDone;
  199. 197.  -       window.onLoginDone = onLoginDoneNew;
  200. 198.  -       cur.destroy.push(restoreOnLoginDone.pbind(onLoginDoneNew));
  201. 199.  -     }
  202. 200.  -   } else {
  203. 201.  -     restoreOnLoginDone(window.onLoginDone);
  204. 202.  -   }
  205. 203.  -
  206. 204.  -   if (onLoginFailedNew) {
  207. 205.  -     if (window.onLoginFailed != onLoginFailedNew) {
  208. 206.  -       cur.onLoginFailedWindowOld = window.onLoginFailed;
  209. 207.  -       window.onLoginFailed = onLoginFailedNew;
  210. 208.  -       cur.destroy.push(restoreOnLoginFailed.pbind(onLoginFailedNew));
  211. 209.  -     }
  212. 210.  -   } else {
  213. 211.  -     restoreOnLoginFailed(window.onLoginFailed);
  214. 212.  -   }
  215. 213.  - }
  216. 214.  -
  217. 215.  - Ads.scrollToError = function(errorElem) {
  218. 216.  -   errorElem = ge(errorElem);
  219. 217.  -   var scrollY = scrollGetY();
  220. 218.  -   var errorY = getXY(errorElem)[1];
  221. 219.  -   if (errorY < scrollY || errorY > (scrollY + lastWindowHeight / 2)) {
  222. 220.  -     errorY -= 15;
  223. 221.  -     scrollToY(errorY);
  224. 222.  -   }
  225. 223.  - }
  226. 224.  -
  227. 225.  - Ads.onFormEdit = function() {
  228. 226.  -   if (window.wkcur) {
  229. 227.  -     wkcur.noClickHide = true;
  230. 228.  -   }
  231. 229.  - }
  232. 230.  -
  233. 231.  - Ads.initFixed = function(elemWrap) {
  234. 232.  -   elemWrap = ge(elemWrap);
  235. 233.  -   if (!elemWrap) return;
  236. 234.  -   var elemFixed = elemWrap.firstChild;
  237. 235.  -   if (!elemFixed) return;
  238. 236.  -
  239. 237.  -   var scrolledNode = browser.msie6 ? pageNode : window;
  240. 238.  -   addEvent(scrolledNode, 'scroll', onScroll);
  241. 239.  -   cur.destroy.push(function() { removeEvent(scrolledNode, 'scroll', onScroll); });
  242. 240.  -
  243. 241.  -   var poistionTop = 20;
  244. 242.  -
  245. 243.  -   var elemWrapSize = getSize(elemWrap);
  246. 244.  -   setStyle(elemWrap, {width: elemWrapSize[0] + 'px', height: elemWrapSize[1] + 'px'});
  247. 245.  -
  248. 246.  -   onScroll();
  249. 247.  -
  250. 248.  -   function onScroll() {
  251. 249.  -     var elemWrapXY = getXY(elemWrap);
  252. 250.  -     var scrollY = scrollGetY();
  253. 251.  -     if (scrollY + poistionTop < elemWrapXY[1]) {
  254. 252.  -       setStyle(elemFixed, {position: 'static', top: 'auto', left: 'auto'});
  255. 253.  -     } else {
  256. 254.  -       setStyle(elemFixed, {position: 'fixed', top: poistionTop, left: elemWrapXY[0]});
  257. 255.  -     }
  258. 256.  -   }
  259. 257.  - }
  260. 258.  -
  261. 259.  - Ads.initIntroPage = function(widgetParamsMore) {
  262. 260.  -   var widgetParams = {}
  263. 261.  -   widgetParams.mode    = 2;
  264. 262.  -   widgetParams.width   = 212;
  265. 263.  -   widgetParams.height  = 340;
  266. 264.  -   widgetParams.no_head = 1;
  267. 265.  -   extend(widgetParams, widgetParamsMore);
  268. 266.  -   VK.Widgets.Group('ads_intro_news_widget', widgetParams, 19542789);
  269. 267.  - }
  270. 268.  -
  271. 269.  - //////////////////////////////////////////////////////////////////////
  272. 270.  - // OLD
  273. 271.  - //////////////////////////////////////////////////////////////////////
  274. 272.  -
  275. 273.  - Ads.updateUnionName = function(unionId, unionName) {
  276. 274.  -   var elemsTitle = geByClass('title_union_name_' + unionId);
  277. 275.  -   for (var i in elemsTitle) {
  278. 276.  -     elemsTitle[i].innerHTML = Ads.escapeValue(unionName);
  279. 277.  -   }
  280. 278.  -
  281. 279.  -   var elemNavigation = ge('ads_navigation_union_' + unionId);
  282. 280.  -   if (elemNavigation) {
  283. 281.  -     unionName = replaceEntities(unionName);
  284. 282.  -     unionName = (unionName.length > 40 ? unionName.substr(0, 40) + '...' : unionName);
  285. 283.  -     elemNavigation.innerHTML = Ads.escapeValue(unionName);
  286. 284.  -   }
  287. 285.  -
  288. 286.  -   var elemGeneralInfoHeader = ge('general_info_header_name_' + unionId);
  289. 287.  -   if (elemGeneralInfoHeader) {
  290. 288.  -     elemGeneralInfoHeader.innerHTML = Ads.escapeValue(unionName);
  291. 289.  -   }
  292. 290.  - }
  293. 291.  -
  294. 292.  - Ads.openUnionsGeneralInfoBox = function(unionId, params) {
  295. 293.  -   var ajaxParams = {};
  296. 294.  -   ajaxParams.union_id = unionId;
  297. 295.  -   ajaxParams = extend({}, ajaxParams, params);
  298. 296.  -
  299. 297.  -   var showOptions = {params: {}};
  300. 298.  -   showOptions.onFail = Ads.onBoxFail;
  301. 299.  -   showOptions.params.width = 300;
  302. 300.  -
  303. 301.  -   showBox('/ads?act=a_unions_general_info_box', ajaxParams, showOptions);
  304. 302.  - }
  305. 303.  -
  306. 304.  - Ads.openUnionCreateBox = function(unionId) {
  307. 305.  -   var ajaxParams = {}
  308. 306.  -   ajaxParams.union_id = unionId;
  309. 307.  -
  310. 308.  -   var showOptions = {params: {}};
  311. 309.  -   showOptions.onFail = Ads.onBoxFail;
  312. 310.  -   showOptions.params.width = 250;
  313. 311.  -
  314. 312.  -   showBox('/ads?act=a_union_create_box', ajaxParams, showOptions);
  315. 313.  - }
  316. 314.  -
  317. 315.  - Ads.openDeleteUnionBox = function(unionType, unionId, hash, lock, unlock, updateStatus, newclass) {
  318. 316.  -   var boxTitle = '';
  319. 317.  -   var boxContent = '';
  320. 318.  -   switch (unionType) {
  321. 319.  -     case 'ad':
  322. 320.  -       boxTitle = getLang('ads_archive_box_ad_title');
  323. 321.  -       boxContent = getLang('ads_archive_box_ad_warning');
  324. 322.  -       break;
  325. 323.  -     case 'campaign':
  326. 324.  -       boxTitle = getLang('ads_archive_box_campaign_title');
  327. 325.  -       boxContent = getLang('ads_archive_box_campaign_warning');
  328. 326.  -       break;
  329. 327.  -     case 'client':
  330. 328.  -       boxTitle = getLang('ads_archive_box_client_title');
  331. 329.  -       boxContent = getLang('ads_archive_box_client_warning');
  332. 330.  -       break;
  333. 331.  -   }
  334. 332.  -
  335. 333.  -   var boxOptions = {};
  336. 334.  -   boxOptions.title = boxTitle;
  337. 335.  -   boxOptions.bodyStyle = 'line-height: 160%;';
  338. 336.  -
  339. 337.  -   cur.deleteConfirmBox = new MessageBox();
  340. 338.  -   cur.deleteConfirmBox.setOptions(boxOptions);
  341. 339.  -   cur.deleteConfirmBox.content(boxContent);
  342. 340.  -   cur.deleteConfirmBox.removeButtons();
  343. 341.  -   cur.deleteConfirmBox.addButton(getLang('box_cancel'), false, 'no');
  344. 342.  -   cur.deleteConfirmBox.addButton(getLang('ads_archive_box_action'), function() { Ads.deleteUnion(unionType, unionId, hash, lock, unlock, updateStatus, newclass); });
  345. 343.  -   cur.deleteConfirmBox.setControlsText('<img id="delete_union_progress" src="/images/upload.gif" style="top: 1px; display: none;">');
  346. 344.  -   cur.deleteConfirmBox.show();
  347. 345.  - }
  348. 346.  -
  349. 347.  - Ads.deleteUnion = function(unionType, unionId, hash, lock, unlock, updateStatus, newclass) {
  350. 348.  -   if (!lockDeletion()) {
  351. 349.  -     return;
  352. 350.  -   }
  353. 351.  -
  354. 352.  -   var ajaxParams = {};
  355. 353.  -   ajaxParams.union_id = unionId;
  356. 354.  -   ajaxParams.hash = hash;
  357. 355.  -   if (newclass) ajaxParams.newclass = 1;
  358. 356.  -
  359. 357.  -   ajax.post('/ads?act=a_union_delete', ajaxParams, {onDone: onRequestComplete, onFail: onRequestComplete});
  360. 358.  -
  361. 359.  -   function onRequestComplete(response) {
  362. 360.  -     unlockDeletion();
  363. 361.  -     if (!isObject(response) || response.error) {
  364. 362.  -       if (!isObject(response)) {
  365. 363.  -         showMessage(getLang('ads_error_unexpected_error_try_later'));
  366. 364.  -       } else {
  367. 365.  -         showMessage(response.error);
  368. 366.  -       }
  369. 367.  -       return true;
  370. 368.  -     }
  371. 369.  -     if (response && (response.ok || newclass == 2)) {
  372. 370.  -       var completeMessage = '';
  373. 371.  -       switch (unionType) {
  374. 372.  -         case 'ad':       completeMessage = getLang('ads_archive_box_ad_complete'); break;
  375. 373.  -         case 'campaign': completeMessage = getLang('ads_archive_box_campaign_complete'); break;
  376. 374.  -         case 'client':   completeMessage = getLang('ads_archive_box_client_complete'); break;
  377. 375.  -       }
  378. 376.  -       if (updateStatus) {
  379. 377.  -         if (newclass == 2) {
  380. 378.  -           updateStatus(response);
  381. 379.  -         } else {
  382. 380.  -           updateStatus(response.status, response.status_class, response.status_type, response.status_variants);
  383. 381.  -         }
  384. 382.  -       } else {
  385. 383.  -         showMessage(completeMessage, true, function() { nav.reload(); }, unionType);
  386. 384.  -       }
  387. 385.  -     }
  388. 386.  -     return true;
  389. 387.  -   }
  390. 388.  -
  391. 389.  -   function showMessage(message, isSuccess, onHide, unionType) {
  392. 390.  -     var boxTitle = '';
  393. 391.  -     switch (unionType) {
  394. 392.  -       case 'ad':       boxTitle = getLang('ads_archive_box_ad_title'); break;
  395. 393.  -       case 'campaign': boxTitle = getLang('ads_archive_box_campaign_title'); break;
  396. 394.  -       case 'client':   boxTitle = getLang('ads_archive_box_client_title'); break;
  397. 395.  -     }
  398. 396.  -
  399. 397.  -     var boxOptions = {};
  400. 398.  -     boxOptions.title = (isSuccess ? boxTitle : '������');
  401. 399.  -     boxOptions.width = 350;
  402. 400.  -     boxOptions.onHide = onHide;
  403. 401.  -     showFastBox(boxOptions, message);
  404. 402.  -   }
  405. 403.  -
  406. 404.  -   function lockDeletion() {
  407. 405.  -     if (lock) {
  408. 406.  -       if (!lock()) {
  409. 407.  -         return false;
  410. 408.  -       }
  411. 409.  -       cur.deleteConfirmBox.hide();
  412. 410.  -     } else {
  413. 411.  -       if (cur.deleteUnionLocked) {
  414. 412.  -         return false;
  415. 413.  -       }
  416. 414.  -       cur.deleteUnionLocked = true;
  417. 415.  -       show('delete_union_progress');
  418. 416.  -     }
  419. 417.  -     return true;
  420. 418.  -   }
  421. 419.  -   function unlockDeletion() {
  422. 420.  -     if (unlock) {
  423. 421.  -       unlock()
  424. 422.  -     } else {
  425. 423.  -       cur.deleteUnionLocked = false;
  426. 424.  -       hide('delete_union_progress');
  427. 425.  -     }
  428. 426.  -   }
  429. 427.  - }
  430. 428.  -
  431. 429.  - Ads.openHelpBox = function(type, unionId) {
  432. 430.  -   var ajaxParams = {}
  433. 431.  -   ajaxParams.type = type;
  434. 432.  -   ajaxParams.union_id = unionId;
  435. 433.  -
  436. 434.  -   var showOptions = {params: {}};
  437. 435.  -   showOptions.onFail = Ads.onBoxFail;
  438. 436.  -   showOptions.cache = 1;
  439. 437.  -   showOptions.params.width = 450;
  440. 438.  -
  441. 439.  -   showBox('/ads?act=a_help_text', ajaxParams, showOptions);
  442. 440.  - }
  443. 441.  -
  444. 442.  - Ads.openCreateOfficeBox = function() {
  445. 443.  -   var ajaxParams = {};
  446. 444.  -
  447. 445.  -   var showOptions = {params: {}};
  448. 446.  -   showOptions.onFail = Ads.onBoxFail;
  449. 447.  -   showOptions.params.width = 350;
  450. 448.  -
  451. 449.  -   showBox('/ads?act=a_create_office_box', ajaxParams, showOptions);
  452. 450.  - }
  453. 451.  -
  454. 452.  - Ads.openDisableOfficeBox = function(unionId, hash, isCompany) {
  455. 453.  -   cur.lang.ads_disable_office_box_title       = '�������� ���������� ��������';
  456. 454.  -   cur.lang.ads_disable_office_box_button      = '������� �������';
  457. 455.  -   cur.lang.ads_disable_office_confirm_message = '�� ������� ��� ������ ������� ��������� �������?<br><br>����� �������� �������� � ��� ��������� ������ � ����������, �� ����� �������� �������� ����� ����������.';
  458. 456.  -   if (isCompany) {
  459. 457.  -     cur.lang.ads_disable_office_confirm_message += '<br><br>������ ����� �������� �������� ���� �������� ������ ���������� �����, ������������ � ����� ��������.';
  460. 458.  -   }
  461. 459.  -   var messageBox = showFastBox(getLang('ads_disable_office_box_title'), getLang('ads_disable_office_confirm_message'), getLang('ads_disable_office_box_button'), function() { Ads.disableOffice(unionId, hash, messageBox); }, getLang('box_cancel'));
  462. 460.  - }
  463. 461.  -
  464. 462.  - Ads.disableOffice = function(unionId, hash, box) {
  465. 463.  -   var ajaxParams = {};
  466. 464.  -   ajaxParams.union_id = unionId;
  467. 465.  -   ajaxParams.hash = hash;
  468. 466.  -
  469. 467.  -   ajax.post('/adsmoder?act=a_disable_office', ajaxParams, {onDone: onRequestComplete, onFail: onRequestComplete});
  470. 468.  -
  471. 469.  -   function onRequestComplete(response) {
  472. 470.  -     if (response && response.redirect) {
  473. 471.  -       nav.reload();
  474. 472.  -     } else {
  475. 473.  -       box.hide();
  476. 474.  -       showFastBox(getLang('ads_error_box_title'), getLang('ads_error_text'));
  477. 475.  -     }
  478. 476.  -     return true;
  479. 477.  -   }
  480. 478.  - }
  481. 479.  -
  482. 480.  - Ads.createExportSubmitButton = function(elem, bindingId, topUnionId) {
  483. 481.  -   var postIframe = ce((browser.msie && browser.version < 9.0) ? '<iframe name="secret_iframe">' : 'iframe', {name: 'secret_iframe', id: 'secret_iframe'});
  484. 482.  -   postIframe.style.display = 'none';
  485. 483.  -   document.body.appendChild(postIframe);
  486. 484.  -   var topUnionIdParam = (topUnionId ? '&union_id=' + topUnionId : '');
  487. 485.  -   var postForm = ce('form', {method: 'post', action: '/ads?act=get_export_stats' + topUnionIdParam, target: 'secret_iframe'});
  488. 486.  -   document.body.appendChild(postForm);
  489. 487.  -   var valueNames = [
  490. 488.  -     'group_time',
  491. 489.  -     'group_ads',
  492. 490.  -     'method',
  493. 491.  -     'stats_type',
  494. 492.  -     'from_day',
  495. 493.  -     'from_month',
  496. 494.  -     'from_year',
  497. 495.  -     'to_day',
  498. 496.  -     'to_month',
  499. 497.  -     'to_year',
  500. 498.  -     'Ids'
  501. 499.  -   ];
  502. 500.  -   var valueContainers = {};
  503. 501.  -   for (var i = 0; i < valueNames.length; i++) {
  504. 502.  -     var curName = valueNames[i];
  505. 503.  -     valueContainers[curName] = ce('input', {
  506. 504.  -       type: 'hidden',
  507. 505.  -       id: curName + '_container_' + bindingId,
  508. 506.  -       name: curName
  509. 507.  -     });
  510. 508.  -     postForm.appendChild(valueContainers[curName]);
  511. 509.  -   }
  512. 510.  -
  513. 511.  -   var errorBox;
  514. 512.  -   var action = function() {
  515. 513.  -     var postData = {}, elem, day;
  516. 514.  -     elem = geByClass('grouping_time_' + bindingId)[0];
  517. 515.  -     if (!elem) return;
  518. 516.  -     valueContainers.group_time.value = elem.getIndex();
  519. 517.  -
  520. 518.  -     elem = geByClass('grouping_ads_' + bindingId)[0];
  521. 519.  -     if (!elem) return;
  522. 520.  -     valueContainers.group_ads.value = elem.getIndex();
  523. 521.  -
  524. 522.  -     elem = geByClass('client_choose_' + bindingId);
  525. 523.  -     if (elem.length > 0) {
  526. 524.  -       elem = elem[0];
  527. 525.  -       var curClientId = elem.getIndex();
  528. 526.  -     }
  529. 527.  -
  530. 528.  -     elem = geByClass('export_method_' + bindingId)[0];
  531. 529.  -     if (!elem) return;
  532. 530.  -     valueContainers.method.value = elem.getIndex();
  533. 531.  -     if (valueContainers.method.value == 3/*Web-interface*/) {
  534. 532.  -       postForm.target = '';
  535. 533.  -     }
  536. 534.  -
  537. 535.  -     elem = geByClass('stats_type_' + bindingId)[0];
  538. 536.  -     if (!elem) return;
  539. 537.  -     valueContainers.stats_type.value = elem.getIndex();
  540. 538.  -
  541. 539.  -     day = cur.exportParamsData.start_time;
  542. 540.  -     valueContainers.from_day.value = day.day;
  543. 541.  -     valueContainers.from_month.value = day.month;
  544. 542.  -     valueContainers.from_year.value = day.year;
  545. 543.  -
  546. 544.  -     day = cur.exportParamsData.stop_time;
  547. 545.  -     valueContainers.to_day.value = day.day;
  548. 546.  -     valueContainers.to_month.value = day.month;
  549. 547.  -     valueContainers.to_year.value = day.year;
  550. 548.  -
  551. 549.  -     if ((new Date(valueContainers.to_year.value,   valueContainers.to_month.value,   valueContainers.to_day.value)) <
  552. 550.  -         (new Date(valueContainers.from_year.value, valueContainers.from_month.value, valueContainers.from_day.value))) {
  553. 551.  -       showFastBox(getLang('ads_error_box_title'), getLang('ads_error_export_stat_invalid_period'));
  554. 552.  -       return;
  555. 553.  -     }
  556. 554.  -
  557. 555.  -     var ids = [];
  558. 556.  -
  559. 557.  -     elem = ge('paginated_table');
  560. 558.  -     var pt = elem.tableObj;
  561. 559.  -     var selection = pt.getSelection(0);
  562. 560.  -     switch (parseInt(valueContainers.group_ads.value)) {
  563. 561.  -       case 0:
  564. 562.  -         ids.push(elem.topId);
  565. 563.  -         break;
  566. 564.  -       case 1:
  567. 565.  -         for (var j = 0; j < selection.length; j++) {
  568. 566.  -           var clId = pt.content.extra['union_id'][selection[j]];
  569. 567.  -           ids.push(clId);
  570. 568.  -         }
  571. 569.  -         break;
  572. 570.  -       case 2:
  573. 571.  -         if (curClientId == 'aca') {
  574. 572.  -           for (var p in elem.contentDep) {
  575. 573.  -             if (!isNaN(Number(p))) {
  576. 574.  -               for (var i in elem.contentDep[p].extra['union_id']) {
  577. 575.  -                 ids.push(elem.contentDep[p].extra['union_id'][i]);
  578. 576.  -               }
  579. 577.  -             }
  580. 578.  -           }
  581. 579.  -         } else {
  582. 580.  -           for (var i = 0; i < selection.length; i++) {
  583. 581.  -             ids.push(pt.content.extra['union_id'][selection[i]]);
  584. 582.  -           }
  585. 583.  -         }
  586. 584.  -         break;
  587. 585.  -       case 3:
  588. 586.  -         for (var i = 0; i < selection.length; i++) {
  589. 587.  -           ids.push(pt.content.extra['union_id'][selection[i]]);
  590. 588.  -         }
  591. 589.  -         break;
  592. 590.  -       default:
  593. 591.  -         return;
  594. 592.  -     }
  595. 593.  -
  596. 594.  -     if (ids.length == 0) {
  597. 595.  -       showFastBox(getLang('ads_error_box_title'), getLang('ads_error_export_stat_no_campaigns_selected'));
  598. 596.  -       return;
  599. 597.  -
  600. 598.  -     }
  601. 599.  -
  602. 600.  -     valueContainers.Ids.value = '' + ids.join(',');
  603. 601.  -
  604. 602.  -     postForm.submit();
  605. 603.  -   };
  606. 604.  -
  607. 605.  -   createButton(elem, action);
  608. 606.  - }
  609. 607.  -
  610. 608.  - Ads.createStaticDatePicker = function(elem, bindingId, classid, defaultDate) {
  611. 609.  -   elem = ge(elem);
  612. 610.  -   if (classid) elem.className = classid + '_' + bindingId;
  613. 611.  -
  614. 612.  -   var spanDay   = ce('span', {id: elem.id + '_day'}),
  615. 613.  -       spanMonth = ce('span', {id: elem.id + '_month'});
  616. 614.  -
  617. 615.  -   if (!cur.exportParamsData) {
  618. 616.  -     cur.exportParamsData = {};
  619. 617.  -   }
  620. 618.  -   cur.exportParamsData[classid] = defaultDate;
  621. 619.  -
  622. 620.  -   var params = {
  623. 621.  -     mode: 'd',
  624. 622.  -     day: defaultDate.day,
  625. 623.  -     month: defaultDate.month,
  626. 624.  -     year: defaultDate.year,
  627. 625.  -     width: 124,
  628. 626.  -     pastActive: true,
  629. 627.  -     onUpdate: function(d, m) {
  630. 628.  -       if (m == 'h') {
  631. 629.  -         cur.exportParamsData[classid].day = defaultDate.day;
  632. 630.  -         cur.exportParamsData[classid].month = defaultDate.month;
  633. 631.  -         cur.exportParamsData[classid].year = defaultDate.year;
  634. 632.  -         return;
  635. 633.  -       }
  636. 634.  -       if (m == 'd') {
  637. 635.  -         cur.exportParamsData[classid].day = d.d;
  638. 636.  -       } else if (m == 'm') {
  639. 637.  -         cur.exportParamsData[classid].day = 1;
  640. 638.  -       }
  641. 639.  -       cur.exportParamsData[classid].month = d.m;
  642. 640.  -       cur.exportParamsData[classid].year = d.y;
  643. 641.  -     }
  644. 642.  -   };
  645. 643.  -
  646. 644.  -   if (!cur.exportUi) {
  647. 645.  -     cur.exportUi = {};
  648. 646.  -   }
  649. 647.  -   cur.exportUi[classid] = new Datepicker(elem, params);
  650. 648.  - }
  651. 649.  -
  652. 650.  - Ads.openInnerTable = function(id, bindingId) {
  653. 651.  -   if (!id) id = 'acl';
  654. 652.  -
  655. 653.  -   var tab = ge('paginated_table');
  656. 654.  -
  657. 655.  -   var newOptions;
  658. 656.  -   switch (id) {
  659. 657.  -     case 'cli':
  660. 658.  -       newOptions = tab.optionsDep['cli'];
  661. 659.  -       break;
  662. 660.  -     case 'aca':
  663. 661.  -     case 'acl':
  664. 662.  -       newOptions = tab.optionsDep['default'];
  665. 663.  -       break;
  666. 664.  -     default:
  667. 665.  -       newOptions = tab.optionsDep['cam'];
  668. 666.  -       break;
  669. 667.  -   }
  670. 668.  -
  671. 669.  -   if (id in tab.contentDep && tab.contentDep[id]) {
  672. 670.  -     var newContent = tab.contentDep[id];
  673. 671.  -     tab.tableObj.setOptions(newOptions);
  674. 672.  -     tab.tableObj.setContent(newContent);
  675. 673.  -     tab.tableObj.applyData();
  676. 674.  -   } else {
  677. 675.  -     function onDone(data) {
  678. 676.  -       var newContent = data;
  679. 677.  -       tab.contentDep[id] = newContent;
  680. 678.  -       tab.tableObj.setOptions(newOptions);
  681. 679.  -       tab.tableObj.setContent(newContent);
  682. 680.  -       tab.tableObj.applyData();
  683. 681.  -       hide('getting_campaigns_upload');
  684. 682.  -     }
  685. 683.  -     function onFail() {
  686. 684.  -       hide('getting_campaigns_upload');
  687. 685.  -       return true;
  688. 686.  -     };
  689. 687.  -     show('getting_campaigns_upload');
  690. 688.  -     ajax.post('/ads?act=a_get_client_children', {client_id: id}, {onDone: onDone, onFail: onFail});
  691. 689.  -   }
  692. 690.  - }
  693. 691.  -
  694. 692.  - Ads.createStaticDropdownMenuAds = function(elem, bindingId, values, params) {
  695. 693.  -   elem = ge(elem);
  696. 694.  -
  697. 695.  -   if (params.classname) elem.className = params.classname + '_' + bindingId;
  698. 696.  -   elem.className = elem.className + ' dd_link';
  699. 697.  -
  700. 698.  -   elem.valueList = values;
  701. 699.  -   elem.getValue = function() {return elem.value;}
  702. 700.  -   elem.getIndex = function() {
  703. 701.  -     if (elem.index !== undefined) return elem.index;
  704. 702.  -
  705. 703.  -     for (var i = 0; i < elem.valueList.length; i++) {
  706. 704.  -       if (elem.valueList[i][1] == elem.value) {
  707. 705.  -         return elem.valueList[i][0];
  708. 706.  -       }
  709. 707.  -     }
  710. 708.  -     return -1;
  711. 709.  -   }
  712. 710.  -
  713. 711.  -   if (params.classname == 'client_choose') {
  714. 712.  -     onDomReady(function() {
  715. 713.  -       hide(geByClass('client_choose_row_' + bindingId)[0]);
  716. 714.  -     });
  717. 715.  -   }
  718. 716.  -   params.updateHeader = function(i, t) {
  719. 717.  -     if (!i) i = 'aca';
  720. 718.  -     Ads.openInnerTable(i, bindingId);
  721. 719.  -     elem.index = i;
  722. 720.  -     elem.value = t;
  723. 721.  -     return t;
  724. 722.  -   }
  725. 723.  -   params.onSelect = function(value) {
  726. 724.  -     if (value === undefined) value = uiDropdown.val();
  727. 725.  -     elem.value = value;
  728. 726.  -     elem.innerHTML = value;
  729. 727.  -   };
  730. 728.  -   params.target = elem;
  731. 729.  -   params.showHover = true;
  732. 730.  -   //params.alwaysMenuToUp = true;
  733. 731.  -
  734. 732.  -   params.onSelect(values[0][1]);
  735. 733.  -
  736. 734.  -   elem.uiDropdown = new DropdownMenu(values, params);
  737. 735.  -   Ads.makeDDScrollable(elem.uiDropdown);
  738. 736.  - }
  739. 737.  -
  740. 738.  - // threshold is height of container
  741. 739.  - Ads.makeDDScrollable = function(dd, threshold) {
  742. 740.  -   if (!dd) return;
  743. 741.  -   if (threshold === undefined) {
  744. 742.  -     threshold = 300;
  745. 743.  -   }
  746. 744.  -
  747. 745.  -   var uiBody = dd.body,
  748. 746.  -       uiTable = geByClass('dd_menu_rows', uiBody)[0].firstChild,
  749. 747.  -       uiTableS = getSize(uiBody),
  750. 748.  -       uiTableW = uiTableS[0],
  751. 749.  -       uiTableH = uiTableS[1] - 4, // dont understand why
  752. 750.  -       barW = 6,
  753. 751.  -       barH = Math.max(20, intval(threshold * threshold / uiTableH)),
  754. 752.  -       scrollBar = ce('div', {className: 'ads_dropdown_menu_scrollbar'}, {
  755. 753.  -         top: barH / 10,
  756. 754.  -         right: 3,
  757. 755.  -         width: barW,
  758. 756.  -         height: barH
  759. 757.  -       });
  760. 758.  -
  761. 759.  -   if (uiTableH < threshold) {
  762. 760.  -     return;
  763. 761.  -   }
  764. 762.  -
  765. 763.  -   setStyle(uiTable.parentNode, {
  766. 764.  -     overflowY: 'hidden',
  767. 765.  -     height: threshold
  768. 766.  -   });
  769. 767.  -   uiBody.appendChild(scrollBar);
  770. 768.  -   setStyle(uiTable, 'position', 'relative');
  771. 769.  -
  772. 770.  -   var startY = null,
  773. 771.  -       startTop = 0,
  774. 772.  -       hoverState = 0,
  775. 773.  -       hoverTimer = null;
  776. 774.  -   var onScroll = function(e) {
  777. 775.  -     var oldTop = parseFloat(getStyle(uiTable, 'top'));
  778. 776.  -     if (isNaN(oldTop)) {
  779. 777.  -       oldTop = 0;
  780. 778.  -     }
  781. 779.  -
  782. 780.  -     var delta = e.wheelDelta ? e.wheelDelta / 120 : -e.detail / 3;
  783. 781.  -     scrollBody(oldTop + delta * 20);
  784. 782.  -
  785. 783.  -     if (hoverTimer) {
  786. 784.  -       clearTimeout(hoverTimer);
  787. 785.  -     } else {
  788. 786.  -       doHover(1);
  789. 787.  -     }
  790. 788.  -     hoverTimer = setTimeout(function() {
  791. 789.  -       hoverTimer = null;
  792. 790.  -       doHover(-1);
  793. 791.  -       }, 200);
  794. 792.  -
  795. 793.  -     cancelEvent(e);
  796. 794.  -     return false;
  797. 795.  -   }
  798. 796.  -   var onMouseMove = function(e) {
  799. 797.  -     if (startY === null) return;
  800. 798.  -     var y = e.pageY;
  801. 799.  -     var localD = startY - y,
  802. 800.  -         delta = 1.0 * localD * (uiTableH - threshold) / (threshold - barH - 5);
  803. 801.  -     scrollBody(startTop + delta);
  804. 802.  -   }
  805. 803.  -   var scrollBody = function(newTop) {
  806. 804.  -     newTop = Math.min(0, newTop);
  807. 805.  -     newTop = Math.max(-uiTableH + threshold, newTop);
  808. 806.  -
  809. 807.  -     var barTop = 3 - 1.0 * newTop / (uiTableH - threshold) * (threshold - barH - 5);
  810. 808.  -     setStyle(uiTable, 'top', newTop);
  811. 809.  -     setStyle(scrollBar, 'top', barTop);
  812. 810.  -   }
  813. 811.  -   var onDown = function(e) {
  814. 812.  -     startY = e.pageY;
  815. 813.  -     startTop = parseFloat(getStyle(uiTable, 'top'));
  816. 814.  -     if (isNaN(startTop)) startTop = 0;
  817. 815.  -
  818. 816.  -     doHover(1);
  819. 817.  -     cancelEvent(e);
  820. 818.  -   }
  821. 819.  -   var onUp = function(e) {
  822. 820.  -     if (startY !== null) {
  823. 821.  -       doHover(-1);
  824. 822.  -     }
  825. 823.  -     startY = null;
  826. 824.  -   }
  827. 825.  -   var doHover = function(dh) {
  828. 826.  -     hoverState += dh;
  829. 827.  -     if (hoverState == 0) removeClass(scrollBar, 'hovered');
  830. 828.  -     if (hoverState == 1) addClass(scrollBar, 'hovered');
  831. 829.  -   }
  832. 830.  -
  833. 831.  -   dd.options.onShow = function() {
  834. 832.  -     scrollBody(100000);
  835. 833.  -   }
  836. 834.  -   addEvent(uiBody, 'mousewheel DOMMouseScroll', onScroll);
  837. 835.  -   addEvent(scrollBar, 'mousedown', onDown);
  838. 836.  -   addEvent(document.body, 'mouseup dragend', onUp);
  839. 837.  -   addEvent(uiBody, 'mousemove', onMouseMove);
  840. 838.  -
  841. 839.  -   cur.destroy.push(function() {
  842. 840.  -     removeEvent(uiBody, 'mousewheel DOMMouseScroll', onScroll);
  843. 841.  -     removeEvent(scrollBar, 'mousedown', onDown);
  844. 842.  -     removeEvent(document.body, 'mouseup dragend', onUp);
  845. 843.  -     removeEvent(uiBody, 'mousemove', onMouseMove);
  846. 844.  -   });
  847. 845.  - }
  848. 846.  -
  849. 847.  - // params must be ready to go to contructor
  850. 848.  - Ads.createStaticDropdown = function(elem, bindingId, values, params) {
  851. 849.  -   elem = ge(elem);
  852. 850.  -   if (params.classname) elem.className = params.classname + '_' + bindingId;
  853. 851.  -   elem.className = elem.className + ' dd_link';
  854. 852.  -
  855. 853.  -   elem.valueList = values;
  856. 854.  -   elem.getValue = function() {return elem.value;}
  857. 855.  -   elem.getIndex = function() {
  858. 856.  -     if (elem.index !== undefined) return elem.index;
  859. 857.  -
  860. 858.  -     for (var i = 0; i < elem.valueList.length; i++) {
  861. 859.  -       if (elem.valueList[i][1] == elem.value) {
  862. 860.  -         return elem.valueList[i][0];
  863. 861.  -       }
  864. 862.  -     }
  865. 863.  -     return -1;
  866. 864.  -   }
  867. 865.  -
  868. 866.  -   if (params.classname == 'client_choose') {
  869. 867.  -     onDomReady(function() {
  870. 868.  -       hide(geByClass('client_choose_row_' + bindingId)[0]);
  871. 869.  -     });
  872. 870.  -   }
  873. 871.  -
  874. 872.  -   params.updateHeader = function(i, t) {
  875. 873.  -     if (!i) i = 0;
  876. 874.  -     //
  877. 875.  -     // grouping_time
  878. 876.  -     //
  879. 877.  -     if (elem.className.substring(0, 'grouping_time'.length) == 'grouping_time') {
  880. 878.  -       var modes = ['d', 'm', 'h'];
  881. 879.  -       cur.exportUi['start_time'].setMode(modes[i]);
  882. 880.  -       cur.exportUi['stop_time'].setMode(modes[i]);
  883. 881.  -     } else
  884. 882.  -     //
  885. 883.  -     // client_choose
  886. 884.  -     //
  887. 885.  -     if (elem.className.substring(0, 'client_choose'.length) == 'client_choose') {
  888. 886.  -       if (!i) i = 'aca';
  889. 887.  -       Ads.openInnerTable(i, bindingId);
  890. 888.  -     } else
  891. 889.  -     //
  892. 890.  -     // grouping_ads
  893. 891.  -     //
  894. 892.  -     if (elem.className.substring(0, 'grouping_ads'.length) == 'grouping_ads') {
  895. 893.  -       var label_el;
  896. 894.  -       switch (i) {
  897. 895.  -         case 0:
  898. 896.  -           hide(geByClass('client_choose_row_' + bindingId)[0]);
  899. 897.  -           Ads.openInnerTable('acl', bindingId);
  900. 898.  -
  901. 899.  -           label_el = ge('unions_table_label_' + bindingId);
  902. 900.  -           label_el.innerHTML = getLang('ads_export_stat_data_title_campaigns');
  903. 901.  -           break;
  904. 902.  -         case 1:
  905. 903.  -           hide(geByClass('client_choose_row_' + bindingId)[0]);
  906. 904.  -           Ads.openInnerTable('cli', bindingId);
  907. 905.  -
  908. 906.  -           label_el = ge('unions_table_label_' + bindingId);
  909. 907.  -           label_el.innerHTML = getLang('ads_export_stat_data_title_clients');
  910. 908.  -           break;
  911. 909.  -         case 2:
  912. 910.  -           var chser = geByClass('client_choose_' + bindingId)[0];
  913. 911.  -           var dd = chser.uiDropdown;
  914. 912.  -
  915. 913.  -           var text = dd.options.updateHeader(0, chser.valueList[0][1]);
  916. 914.  -           dd.header.innerHTML = '<div>' + text + '</div>';
  917. 915.  -           if (dd.options.target) dd.options.target.innerHTML = text;
  918. 916.  -
  919. 917.  -           show(geByClass('client_choose_row_' + bindingId)[0]);
  920. 918.  -           Ads.openInnerTable('aca', bindingId);
  921. 919.  -
  922. 920.  -           label_el = ge('unions_table_label_' + bindingId);
  923. 921.  -           label_el.innerHTML = getLang('ads_export_stat_data_title_campaigns');
  924. 922.  -           break;
  925. 923.  -         case 3:
  926. 924.  -           Ads.openInnerTable('cam', bindingId);
  927. 925.  -         default:
  928. 926.  -           break;
  929. 927.  -       }
  930. 928.  -     }
  931. 929.  -
  932. 930.  -     elem.index = i;
  933. 931.  -     elem.value = t;
  934. 932.  -     return t;
  935. 933.  -   }
  936. 934.  -   params.onSelect = function(value) {
  937. 935.  -     if (value === undefined) value = uiDropdown.val();
  938. 936.  -     elem.value = value;
  939. 937.  -     elem.innerHTML = value;
  940. 938.  -   };
  941. 939.  -   params.target = elem;
  942. 940.  -   params.showHover = true;
  943. 941.  -   //params.alwaysMenuToUp = true;
  944. 942.  -
  945. 943.  -   params.onSelect(values[0][1]);
  946. 944.  -
  947. 945.  -   elem.uiDropdown = new DropdownMenu(values, params);
  948. 946.  - }
  949. 947.  -
  950. 948.  - Ads.createInlineStaticEdit = function(editElem, bindingId, params) {
  951. 949.  -   if (!params) params = {};
  952. 950.  -   editElem = ge(editElem);
  953. 951.  -   if (params.classname) editElem.className = params.classname + '_' + bindingId;
  954. 952.  -
  955. 953.  -   var uiTimeDay, uiTimeMonth, uiTimeYear, uiAbstractDropdown;
  956. 954.  -
  957. 955.  -   if (!params['type'] && !params['values']) return false;
  958. 956.  -
  959. 957.  -   var defaultValue;
  960. 958.  -   if (params['default']) {
  961. 959.  -     defaultValue = params['default'];
  962. 960.  -   }
  963. 961.  -
  964. 962.  -   var type = params['type'] || 'dropdown';
  965. 963.  -
  966. 964.  -   switch (type) {
  967. 965.  -     case 'dropdown':
  968. 966.  -       if (params['values'] === undefined) {
  969. 967.  -         return false;
  970. 968.  -       }
  971. 969.  -       if (defaultValue === undefined) {
  972. 970.  -         defaultValue = 0;
  973. 971.  -       }
  974. 972.  -       break;
  975. 973.  -     case 'time':
  976. 974.  -       break;
  977. 975.  -     default:
  978. 976.  -       break;
  979. 977.  -   }
  980. 978.  -
  981. 979.  -   monthNames = [
  982. 980.  -     getLang('ads_jan'),
  983. 981.  -     getLang('ads_feb'),
  984. 982.  -     getLang('ads_mar'),
  985. 983.  -     getLang('ads_apr'),
  986. 984.  -     getLang('ads_may'),
  987. 985.  -     getLang('ads_jun'),
  988. 986.  -     getLang('ads_jul'),
  989. 987.  -     getLang('ads_aug'),
  990. 988.  -     getLang('ads_sep'),
  991. 989.  -     getLang('ads_oct'),
  992. 990.  -     getLang('ads_nov'),
  993. 991.  -     getLang('ads_dec')
  994. 992.  -   ];
  995. 993.  -   saveValue(defaultValue);
  996. 994.  -
  997. 995.  -   function saveValue(newValue) {
  998. 996.  -     editElem.value = newValue;
  999. 997.  -
  1000. 998.  -     var newText = '';
  1001. 999.  -     switch (type) {
  1002. 1000.  -       case 'time':
  1003. 1001.  -         if (newValue && newValue.day && newValue.month && newValue.year) {
  1004. 1002.  -           newText = newValue.day + ' ' + monthNames[newValue.month - 1] + ' ' + newValue.year;
  1005. 1003.  -         }
  1006. 1004.  -         break;
  1007. 1005.  -       case 'dropdown':
  1008. 1006.  -         if (parseInt(newValue) !== undefined) {
  1009. 1007.  -           newText = params['values'][parseInt(newValue)];
  1010. 1008.  -         } else
  1011. 1009.  -         if (typeof newValue == 'string') {
  1012. 1010.  -           newText = newValue;
  1013. 1011.  -         }  else {
  1014. 1012.  -           for (var index in newValue) {
  1015. 1013.  -             saveValue.call(this, newValue[index]);
  1016. 1014.  -             return;
  1017. 1015.  -           }
  1018. 1016.  -         }
  1019. 1017.  -         break;
  1020. 1018.  -       default:
  1021. 1019.  -         break;
  1022. 1020.  -     }
  1023. 1021.  -
  1024. 1022.  -     applyNewValue.call(this, newValue, newText);
  1025. 1023.  -   }
  1026. 1024.  -   function applyNewValue(newValue, newText) {
  1027. 1025.  -     editElem.value = newValue;
  1028. 1026.  -     editElem.innerHTML = newText;
  1029. 1027.  -   }
  1030. 1028.  -   function checkValue(value) {
  1031. 1029.  -     return true;
  1032. 1030.  -   }
  1033. 1031.  -   function showLongError(error) {
  1034. 1032.  -     showFastBox(getLang('ads_error_box_title'), error);
  1035. 1033.  -   }
  1036. 1034.  -   function updateTimeDays(month) {
  1037. 1035.  -     uiTimeDay.setData(getDays(month));
  1038. 1036.  -   }
  1039. 1037.  -
  1040. 1038.  -   //
  1041. 1039.  -   // Helpers
  1042. 1040.  -   //
  1043. 1041.  -   function getDays(month, year) {
  1044. 1042.  -     var ret = [], days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  1045. 1043.  -     if (!year) year = (new Date()).getFullYear();
  1046. 1044.  -     if (month == 2 && year % 4 == 0) {
  1047. 1045.  -       days[2] = 29
  1048. 1046.  -     }
  1049. 1047.  -     for (var i = 1, days = days[month]; i <= days; i++) {
  1050. 1048.  -       ret.push(i);
  1051. 1049.  -     }
  1052. 1050.  -     return ret;
  1053. 1051.  -   }
  1054. 1052.  -   function getMonths() {
  1055. 1053.  -     var months = [];
  1056. 1054.  -     for (var i = 1; i <= 12; i++) {
  1057. 1055.  -       months.push([i, monthNames[i - 1]]);
  1058. 1056.  -     }
  1059. 1057.  -     return months;
  1060. 1058.  -   }
  1061. 1059.  -   function getYears() {
  1062. 1060.  -     var ret = [];
  1063. 1061.  -     var curY = (new Date()).getFullYear();
  1064. 1062.  -     for (var i = curY; i >= curY - 10; i--) {
  1065. 1063.  -       ret.push(i);
  1066. 1064.  -     }
  1067. 1065.  -     return ret;
  1068. 1066.  -   }
  1069. 1067.  -   function getAssocFromValues(array) {
  1070. 1068.  -     var res = [];
  1071. 1069.  -     for (var i = 0; i < array.length; i++) {
  1072. 1070.  -       res.push([i, array[i]]);
  1073. 1071.  -     }
  1074. 1072.  -     return res;
  1075. 1073.  -   }
  1076. 1074.  -
  1077. 1075.  -   //
  1078. 1076.  -   // Events
  1079. 1077.  -   //
  1080. 1078.  -   function afterInit() {
  1081. 1079.  -     var self = this;
  1082. 1080.  -
  1083. 1081.  -     switch (type) {
  1084. 1082.  -       case 'time':
  1085. 1083.  -         uiTimeDay = new Dropdown(
  1086. 1084.  -           geByClass('inline_time_day', this.contentTable)[0],
  1087. 1085.  -           getDays(1),
  1088. 1086.  -           {width: 45, height: 150, selectedItem: 1}
  1089. 1087.  -         );
  1090. 1088.  -         uiTimeMonth = new Dropdown(
  1091. 1089.  -           geByClass('inline_time_month', this.contentTable)[0],
  1092. 1090.  -           getMonths(),
  1093. 1091.  -           {width: 80, height: 150, selectedItem: 1, onChange: function(value) { updateTimeDays.call(this, value); }}
  1094. 1092.  -         );
  1095. 1093.  -         uiTimeYear = new Dropdown(
  1096. 1094.  -           geByClass('inline_time_year', this.contentTable)[0],
  1097. 1095.  -           getYears(),
  1098. 1096.  -           {width: 65, height: 150, selectedItem: (new Date()).getFullYear()}
  1099. 1097.  -         );
  1100. 1098.  -         break;
  1101. 1099.  -
  1102. 1100.  -       case 'dropdown':
  1103. 1101.  -         uiAbstractDropdown = new Dropdown(
  1104. 1102.  -           geByClass('ads_inline_dropdown', this.contentTable)[0],
  1105. 1103.  -           getAssocFromValues(params['values']),
  1106. 1104.  -           {height: 150, selectedItem: 0}
  1107. 1105.  -         );
  1108. 1106.  -         break;
  1109. 1107.  -
  1110. 1108.  -       default:
  1111. 1109.  -         break;
  1112. 1110.  -     }
  1113. 1111.  -   }
  1114. 1112.  -   function onBeforeShow() {
  1115. 1113.  -     switch (type) {
  1116. 1114.  -       case 'time':
  1117. 1115.  -         if (defaultValue && defaultValue.day && defaultValue.month && defaultValue.year) {
  1118. 1116.  -           uiTimeDay.val(defaultValue.day);
  1119. 1117.  -           uiTimeMonth.val(defaultValue.month);
  1120. 1118.  -           uiTimeYear.val(defaultValue.year);
  1121. 1119.  -         } else {
  1122. 1120.  -           editElem.innerHTML = "�� ������";
  1123. 1121.  -         }
  1124. 1122.  -         break;
  1125. 1123.  -
  1126. 1124.  -       case 'dropdown':
  1127. 1125.  -         uiAbstractDropdown.val(defaultValue);
  1128. 1126.  -         break;
  1129. 1127.  -
  1130. 1128.  -       default:
  1131. 1129.  -         break;
  1132. 1130.  -     }
  1133. 1131.  -   }
  1134. 1132.  -   function onShow() {
  1135. 1133.  -   }
  1136. 1134.  -   function onConfirm() {
  1137. 1135.  -     var newValue;
  1138. 1136.  -     if (type == 'time') {
  1139. 1137.  -       newValue = {};
  1140. 1138.  -       newValue.day   = uiTimeDay.val();
  1141. 1139.  -       newValue.month = uiTimeMonth.val();
  1142. 1140.  -       newValue.year  = uiTimeYear.val();
  1143. 1141.  -     } else
  1144. 1142.  -     if (type == 'dropdown') {
  1145. 1143.  -       newValue = uiAbstractDropdown.val();
  1146. 1144.  -     }
  1147. 1145.  -
  1148. 1146.  -     saveValue.call(this, newValue);
  1149. 1147.  -     return true;
  1150. 1148.  -   }
  1151. 1149.  -
  1152. 1150.  -   var options = {
  1153. 1151.  -     afterInit: afterInit,
  1154. 1152.  -     onBeforeShow: onBeforeShow,
  1155. 1153.  -     onShow: onShow,
  1156. 1154.  -     onConfirm: onConfirm
  1157. 1155.  -   };
  1158. 1156.  -
  1159. 1157.  -   switch (type) {
  1160. 1158.  -     case 'time':
  1161. 1159.  -       options.contentHTML =
  1162. 1160.  -         '<tr>' +
  1163. 1161.  -         '<td colspan="2">' +
  1164. 1162.  -         '<table class="ads_inline_edit_table">' +
  1165. 1163.  -         '<tr>' +
  1166. 1164.  -           '<td style="white-space: nowrap; width: 200px;">' +
  1167. 1165.  -             '<table class="ads_inline_edit_table">' +
  1168. 1166.  -             '<tr>' +
  1169. 1167.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_day text" style="width: 30px;" /></td>' +
  1170. 1168.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_month text" style="width: 30px;" /></td>' +
  1171. 1169.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_year text" style="width: 30px;" /></td>' +
  1172. 1170.  -             '</tr>' +
  1173. 1171.  -             '</table>' +
  1174. 1172.  -           '</td>' +
  1175. 1173.  -         '</tr>' +
  1176. 1174.  -         '</table>' +
  1177. 1175.  -         '</td>' +
  1178. 1176.  -         '</tr>';
  1179. 1177.  -       break;
  1180. 1178.  -     case 'dropdown':
  1181. 1179.  -       options.contentHTML =
  1182. 1180.  -         '<tr>' +
  1183. 1181.  -         '<td colspan="2">' +
  1184. 1182.  -         '<table class="ads_inline_edit_table" style="width: 100%;">' +
  1185. 1183.  -           '<tr><td><input type="text" class="ads_inline_dropdown text" /></td></tr>' +
  1186. 1184.  -         '</table>' +
  1187. 1185.  -         '</td>' +
  1188. 1186.  -         '</tr>';
  1189. 1187.  -       break;
  1190. 1188.  -     default:
  1191. 1189.  -       break;
  1192. 1190.  -   }
  1193. 1191.  -
  1194. 1192.  -   new InlineEdit(editElem, options);
  1195. 1193.  - }
  1196. 1194.  -
  1197. 1195.  - Ads.onInlineEditClick = function(elem, callback, rown, coln) {
  1198. 1196.  -   var _t = this;
  1199. 1197.  -
  1200. 1198.  -   var editElem = elem,
  1201. 1199.  -       progressElem = _t.content.extra.progress_elem[rown][coln],
  1202. 1200.  -       unionId = _t.content.extra.union_id[rown][coln],
  1203. 1201.  -       unionType = _t.content.extra.union_type[rown][coln],
  1204. 1202.  -       valueType = _t.content.extra.value_type[rown][coln],
  1205. 1203.  -       initValue = _t.content.extra.init_value[rown][coln],
  1206. 1204.  -       hash = _t.content.extra.hash[rown][coln],
  1207. 1205.  -       additionalParams = extend(_t.content.extra.additional_params[rown][coln], {
  1208. 1206.  -         valCallback: function(val) {
  1209. 1207.  -           callback({
  1210. 1208.  -             value: val,
  1211. 1209.  -             extra: {
  1212. 1210.  -               init_value: val
  1213. 1211.  -             }
  1214. 1212.  -           });
  1215. 1213.  -         }
  1216. 1214.  -       });
  1217. 1215.  -
  1218. 1216.  -   var ret = Ads.createInlineEdit(editElem, progressElem, unionType, unionId, valueType, initValue, hash, additionalParams);
  1219. 1217.  -   ret.obj.show();
  1220. 1218.  - }
  1221. 1219.  -
  1222. 1220.  - Ads.createInlineEdit = function(editElem, progressElem, unionType, unionId, valueType, initValue, hash, additionalParams) {
  1223. 1221.  -   editElem     = ge(editElem);
  1224. 1222.  -   progressElem = ge(progressElem);
  1225. 1223.  -   var defaultValue = initValue;
  1226. 1224.  -   var bad_this = this;
  1227. 1225.  -
  1228. 1226.  -   var uiTimeDay, uiTimeMonth, uiTimeHour;
  1229. 1227.  -
  1230. 1228.  -   var valueGeneralType;
  1231. 1229.  -   switch (valueType) {
  1232. 1230.  -     case 'cost_per_click':
  1233. 1231.  -       valueGeneralType = 'cost_per_click';
  1234. 1232.  -       break;
  1235. 1233.  -     case 'day_limit':
  1236. 1234.  -     case 'month_limit':
  1237. 1235.  -     case 'all_limit':
  1238. 1236.  -     case 'contract_limit':
  1239. 1237.  -       valueGeneralType = 'limit';
  1240. 1238.  -       break;
  1241. 1239.  -     case 'start_time':
  1242. 1240.  -     case 'stop_time':
  1243. 1241.  -       valueGeneralType = 'time';
  1244. 1242.  -       break;
  1245. 1243.  -     default:
  1246. 1244.  -       valueGeneralType = 'text';
  1247. 1245.  -       break;
  1248. 1246.  -   }
  1249. 1247.  -
  1250. 1248.  -   function saveValue(newValue, isRemoveValue) {
  1251. 1249.  -
  1252. 1250.  -     if (valueGeneralType == 'limit') {
  1253. 1251.  -       if ((!isRemoveValue && defaultValue == newValue) || (isRemoveValue && defaultValue == 0)) {
  1254. 1252.  -         if (isRemoveValue) {
  1255. 1253.  -           this.hide();
  1256. 1254.  -         }
  1257. 1255.  -         return;
  1258. 1256.  -       }
  1259. 1257.  -     } else {
  1260. 1258.  -       if (defaultValue == newValue) {
  1261. 1259.  -         return;
  1262. 1260.  -       }
  1263. 1261.  -     }
  1264. 1262.  -
  1265. 1263.  -     var unknownError = getLang('ads_error_unexpected_error_try_later');
  1266. 1264.  -
  1267. 1265.  -     var params = {};
  1268. 1266.  -     params.union_id = unionId;
  1269. 1267.  -     params.hash = hash;
  1270. 1268.  -     extend(params, additionalParams);
  1271. 1269.  -
  1272. 1270.  -     if (isRemoveValue) {
  1273. 1271.  -       params[valueType] = 0;
  1274. 1272.  -     } else {
  1275. 1273.  -       if (valueGeneralType == 'time') {
  1276. 1274.  -         params[valueType + '_day'] = newValue.day;
  1277. 1275.  -         params[valueType + '_month'] = newValue.month;
  1278. 1276.  -         params[valueType + '_hour'] = newValue.hour;
  1279. 1277.  -       } else {
  1280. 1278.  -         params[valueType] = newValue;
  1281. 1279.  -       }
  1282. 1280.  -     }
  1283. 1281.  -
  1284. 1282.  -     var self = this;
  1285. 1283.  -
  1286. 1284.  -     function onAjaxComplete(response) {
  1287. 1285.  -       if (isObject(response)) {
  1288. 1286.  -         if (response.error) {
  1289. 1287.  -           showLongError.call(self, response.error);
  1290. 1288.  -         } else if (!response.not_changed) {
  1291. 1289.  -           if ((valueType + '_value') in response) {
  1292. 1290.  -             applyNewValue.call(self, response[valueType + '_value'], response[valueType + '_text']);
  1293. 1291.  -           } else if (response[valueType + '_value_day']) {
  1294. 1292.  -             var newValue = {};
  1295. 1293.  -             newValue.day   = response[valueType + '_value_day'];
  1296. 1294.  -             newValue.month = response[valueType + '_value_month'];
  1297. 1295.  -             newValue.hour  = response[valueType + '_value_hour'];
  1298. 1296.  -             applyNewValue.call(self, newValue, response[valueType + '_text']);
  1299. 1297.  -           } else {
  1300. 1298.  -             showLongError.call(self, unknownError);
  1301. 1299.  -           }
  1302. 1300.  -         }
  1303. 1301.  -       } else {
  1304. 1302.  -         showLongError.call(self, unknownError);
  1305. 1303.  -       }
  1306. 1304.  -
  1307. 1305.  -       hide(progressElem);
  1308. 1306.  -       show(editElem);
  1309. 1307.  -
  1310. 1308.  -       return true;
  1311. 1309.  -     }
  1312. 1310.  -     ajax.post('/ads?act=a_unions_general_info_save', params, {onDone: onAjaxComplete, onFail: onAjaxComplete});
  1313. 1311.  -
  1314. 1312.  -     hide(editElem);
  1315. 1313.  -     show(progressElem);
  1316. 1314.  -     if (isRemoveValue) {
  1317. 1315.  -       this.hide();
  1318. 1316.  -     }
  1319. 1317.  -   }
  1320. 1318.  -   function applyNewValue(newValue, newText) {
  1321. 1319.  -     if (valueType == 'name') {
  1322. 1320.  -       Ads.updateUnionName(unionId, newText);
  1323. 1321.  -     }
  1324. 1322.  -     defaultValue = newValue;
  1325. 1323.  -     if (additionalParams.valCallback) {
  1326. 1324.  -       additionalParams.valCallback(newValue);
  1327. 1325.  -     } else {
  1328. 1326.  -       editElem.innerHTML = newText;
  1329. 1327.  -     }
  1330. 1328.  -   }
  1331. 1329.  -   function checkValue(value) {
  1332. 1330.  -     switch (valueGeneralType) {
  1333. 1331.  -       case 'cost_per_click':
  1334. 1332.  -         if (value == '' || value == '0' || value == 0) {
  1335. 1333.  -           return (additionalParams.is_cost_per_click ? getLang('ads_error_cost_per_click_no_value') : getLang('ads_error_cost_per_views_no_value'));
  1336. 1334.  -         }
  1337. 1335.  -         if (!value.match(/[0-9.,]/)) {
  1338. 1336.  -           return (additionalParams.is_cost_per_click ? getLang('ads_error_cost_per_click_invalid_value') : getLang('ads_error_cost_per_views_invalid_value'));
  1339. 1337.  -         }
  1340. 1338.  -         value = value.replace(',', '.');
  1341. 1339.  -
  1342. 1340.  -         var valueFloat      = parseFloat(value);
  1343. 1341.  -         var suffixesAll     = '';
  1344. 1342.  -         suffixesAll        += (additionalParams.is_cost_per_click ? '_click' : '_views');
  1345. 1343.  -         suffixesAll        += (additionalParams.is_exclusive_ad ? '_exclusive' : '');
  1346. 1344.  -         suffixesAll        += (additionalParams.is_app_admin ? '_app' : '');
  1347. 1345.  -         var minValue        = cur.unionsLimits['cost_per' + suffixesAll + '_min'];
  1348. 1346.  -         var maxValue        = cur.unionsLimits['cost_per' + suffixesAll + '_max'];
  1349. 1347.  -         var minErrorLangKey = (additionalParams.is_cost_per_click ? 'ads_error_cost_per_click_min_value' : 'ads_error_cost_per_views_min_value');
  1350. 1348.  -         var maxErrorLangKey = (additionalParams.is_cost_per_click ? 'ads_error_cost_per_click_max_value' : 'ads_error_cost_per_views_max_value');
  1351. 1349.  -         if (valueFloat < minValue) {
  1352. 1350.  -           return getLang(minErrorLangKey).replace('{money}', getLang('global_money_amount_rub', minValue));
  1353. 1351.  -         }
  1354. 1352.  -         if (valueFloat > maxValue) {
  1355. 1353.  -           return getLang(maxErrorLangKey).replace('{money}', getLang('global_money_amount_rub', maxValue));
  1356. 1354.  -         }
  1357. 1355.  -
  1358. 1356.  -         if (!value.match(cur.unionsLimits.cost_per_click_pattern)) {
  1359. 1357.  -           return (additionalParams.is_cost_per_click ? getLang('ads_error_cost_per_click_invalid_value') : getLang('ads_error_cost_per_views_invalid_value'));
  1360. 1358.  -         }
  1361. 1359.  -         return true;
  1362. 1360.  -       case 'limit':
  1363. 1361.  -         if (value == '' || value == '0' || value == 0) {
  1364. 1362.  -           return getLang('ads_error_limit_no_value');
  1365. 1363.  -         }
  1366. 1364.  -         if (!value.match(/[0-9.,]/)) {
  1367. 1365.  -           return getLang('ads_error_limit_invalid_value');
  1368. 1366.  -         }
  1369. 1367.  -         if (value.indexOf('.') != -1 || value.indexOf(',') != -1) {
  1370. 1368.  -           return getLang('ads_error_limit_integer_value');
  1371. 1369.  -         }
  1372. 1370.  -         if (parseInt(value) < cur.unionsLimits.limit_min) {
  1373. 1371.  -           return getLang('ads_error_limit_min_value').replace('{money}', getLang('global_money_amount_rub', cur.unionsLimits.limit_min));
  1374. 1372.  -         }
  1375. 1373.  -         if (parseInt(value) > cur.unionsLimits.limit_max) {
  1376. 1374.  -           return getLang('ads_error_limit_large_value');
  1377. 1375.  -         }
  1378. 1376.  -         if (!value.match(cur.unionsLimits.limit_pattern)) {
  1379. 1377.  -           return getLang('ads_error_limit_invalid_value');
  1380. 1378.  -         }
  1381. 1379.  -         return true;
  1382. 1380.  -     }
  1383. 1381.  -     switch (valueType) {
  1384. 1382.  -       case 'name':
  1385. 1383.  -         if (value == '') {
  1386. 1384.  -           if (unionType == 4) { // Top union
  1387. 1385.  -             // Nothing
  1388. 1386.  -           } else if (unionType == 2) {
  1389. 1387.  -             return getLang('ads_error_client_name_no_value');
  1390. 1388.  -           } else if (unionType == 1) {
  1391. 1389.  -             return getLang('ads_error_campaign_name_no_value');
  1392. 1390.  -           }
  1393. 1391.  -         }
  1394. 1392.  -         return true;
  1395. 1393.  -     }
  1396. 1394.  -     if (additionalParams.server_check) {
  1397. 1395.  -       return true;
  1398. 1396.  -     } else {
  1399. 1397.  -       return false;
  1400. 1398.  -     }
  1401. 1399.  -   }
  1402. 1400.  -
  1403. 1401.  -   function showFastError(error) {
  1404. 1402.  -     geByClass('ads_inline_fast_error', this.fastErrorRow)[0].innerHTML = error;
  1405. 1403.  -     show(this.fastErrorRow);
  1406. 1404.  -   }
  1407. 1405.  -   function hideFastError() {
  1408. 1406.  -     hide(this.fastErrorRow);
  1409. 1407.  -     geByClass('ads_inline_fast_error', this.fastErrorRow)[0].innerHTML = '';
  1410. 1408.  -   }
  1411. 1409.  -   function showLongError(error) {
  1412. 1410.  -     showFastBox(getLang('ads_error_box_title'), error);
  1413. 1411.  -   }
  1414. 1412.  -   function removeValue() {
  1415. 1413.  -     saveValue.call(this, false, true);
  1416. 1414.  -     return true;
  1417. 1415.  -   }
  1418. 1416.  -   function updateTimeDays(month) {
  1419. 1417.  -     uiTimeDay.setData(getDays(month));
  1420. 1418.  -   }
  1421. 1419.  -
  1422. 1420.  -   //
  1423. 1421.  -   // Helpers
  1424. 1422.  -   //
  1425. 1423.  -   function getDays(month) {
  1426. 1424.  -     var ret = [], days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  1427. 1425.  -     if (month == 2 && (new Date()).getFullYear() % 4 == 0) {
  1428. 1426.  -       days[2] = 29
  1429. 1427.  -     }
  1430. 1428.  -     for (var i = 1, days = days[month]; i <= days; i++) {
  1431. 1429.  -       ret.push(i);
  1432. 1430.  -     }
  1433. 1431.  -     return ret;
  1434. 1432.  -   }
  1435. 1433.  -   function getMonths() {
  1436. 1434.  -     var months = [];
  1437. 1435.  -     months.push([1,  getLang('ads_jan')]);
  1438. 1436.  -     months.push([2,  getLang('ads_feb')]);
  1439. 1437.  -     months.push([3,  getLang('ads_mar')]);
  1440. 1438.  -     months.push([4,  getLang('ads_apr')]);
  1441. 1439.  -     months.push([5,  getLang('ads_may')]);
  1442. 1440.  -     months.push([6,  getLang('ads_jun')]);
  1443. 1441.  -     months.push([7,  getLang('ads_jul')]);
  1444. 1442.  -     months.push([8,  getLang('ads_aug')]);
  1445. 1443.  -     months.push([9,  getLang('ads_sep')]);
  1446. 1444.  -     months.push([10, getLang('ads_oct')]);
  1447. 1445.  -     months.push([11, getLang('ads_nov')]);
  1448. 1446.  -     months.push([12, getLang('ads_dec')]);
  1449. 1447.  -     return months;
  1450. 1448.  -   }
  1451. 1449.  -   function getHours() {
  1452. 1450.  -     var ret = [];
  1453. 1451.  -     for (var i = 0; i < 24; i++) {
  1454. 1452.  -       ret.push([i, i + ':00']);
  1455. 1453.  -     }
  1456. 1454.  -     return ret;
  1457. 1455.  -   }
  1458. 1456.  -
  1459. 1457.  -   //
  1460. 1458.  -   // Events
  1461. 1459.  -   //
  1462. 1460.  -   function afterInit() {
  1463. 1461.  -     var self = this;
  1464. 1462.  -
  1465. 1463.  -     if (valueGeneralType == 'limit' || valueGeneralType == 'time') {
  1466. 1464.  -       this.removeValueAnchor = geByClass('ads_inline_edit_remove_value', this.contentTable)[0];
  1467. 1465.  -       addEvent(this.removeValueAnchor, 'click', function() { removeValue.call(self); return false; });
  1468. 1466.  -     }
  1469. 1467.  -
  1470. 1468.  -     if (valueGeneralType == 'time') {
  1471. 1469.  -       uiTimeDay = new Dropdown(
  1472. 1470.  -         geByClass('inline_time_day', this.contentTable)[0],
  1473. 1471.  -         getDays(1),
  1474. 1472.  -         {width: 45, height: 150, selectedItem: 1}
  1475. 1473.  -       );
  1476. 1474.  -       uiTimeMonth = new Dropdown(
  1477. 1475.  -         geByClass('inline_time_month', this.contentTable)[0],
  1478. 1476.  -         getMonths(),
  1479. 1477.  -         {width: 80, height: 150, selectedItem: 1, onChange: function(value) { updateTimeDays.call(this, value); }}
  1480. 1478.  -       );
  1481. 1479.  -       uiTimeHour = new Dropdown(
  1482. 1480.  -         geByClass('inline_time_hour', this.contentTable)[0],
  1483. 1481.  -         getHours(),
  1484. 1482.  -         {width: 65, height: 150, selectedItem: 0}
  1485. 1483.  -       );
  1486. 1484.  -     }
  1487. 1485.  -
  1488. 1486.  -     this.fastErrorRow = geByClass('ads_inline_fast_error_row', this.contentTable)[0];
  1489. 1487.  -
  1490. 1488.  -     if (this.input) {
  1491. 1489.  -       this.is_user_action = true;
  1492. 1490.  -       addEvent(this.input, 'keyup', function(event) {
  1493. 1491.  -           if (event.keyCode != 13) {
  1494. 1492.  -             hideFastError.call(self);
  1495. 1493.  -           }
  1496. 1494.  -         }
  1497. 1495.  -       );
  1498. 1496.  -     }
  1499. 1497.  -   }
  1500. 1498.  -   function onBeforeShow() {
  1501. 1499.  -     if (this.input) {
  1502. 1500.  -       this.input.value = defaultValue;
  1503. 1501.  -     }
  1504. 1502.  -
  1505. 1503.  -     if (valueGeneralType == 'time') {
  1506. 1504.  -       uiTimeDay.val(defaultValue.day);
  1507. 1505.  -       uiTimeMonth.val(defaultValue.month);
  1508. 1506.  -       uiTimeHour.val(defaultValue.hour);
  1509. 1507.  -     }
  1510. 1508.  -
  1511. 1509.  -     hideFastError.call(this);
  1512. 1510.  -
  1513. 1511.  -     var self = this;
  1514. 1512.  -     if (valueGeneralType == 'cost_per_click' && !this.recommended_cost_loaded) {
  1515. 1513.  -       var recommendedCostProgress = geByClass('inline_recommended_cost_progress', this.contentTable)[0];
  1516. 1514.  -       var recommendedCostText     = geByClass('ads_inline_recommended_cost_text',     this.contentTable)[0];
  1517. 1515.  -
  1518. 1516.  -       function onDone(response) {
  1519. 1517.  -         if (response && response.recommended_costs && response.recommended_costs.cost_text) {
  1520. 1518.  -           recommendedCostText.innerHTML = response.recommended_costs.cost_text;
  1521. 1519.  -           hide(recommendedCostProgress);
  1522. 1520.  -           show(recommendedCostText);
  1523. 1521.  -           if (!this.is_user_action && self.input.value == '0') {
  1524. 1522.  -             self.input.value = response.recommended_costs.cost_value;
  1525. 1523.  -           }
  1526. 1524.  -           self.recommended_cost_loaded = true;
  1527. 1525.  -         }
  1528. 1526.  -       };
  1529. 1527.  -       var ajaxParams = {ad_id: unionId};
  1530. 1528.  -       ajax.post('/ads?act=a_get_recommended_cost', ajaxParams, {onDone: onDone});
  1531. 1529.  -     }
  1532. 1530.  -   }
  1533. 1531.  -   function onShow() {
  1534. 1532.  -     if (this.input) {
  1535. 1533.  -       elfocus(this.input);
  1536. 1534.  -     }
  1537. 1535.  -   }
  1538. 1536.  -   function onConfirm() {
  1539. 1537.  -     var newValue;
  1540. 1538.  -     if (valueGeneralType == 'time') {
  1541. 1539.  -       newValue = {};
  1542. 1540.  -       newValue.day   = uiTimeDay.val();
  1543. 1541.  -       newValue.month = uiTimeMonth.val();
  1544. 1542.  -       newValue.hour  = uiTimeHour.val();
  1545. 1543.  -     } else {
  1546. 1544.  -       newValue = this.input.value;
  1547. 1545.  -
  1548. 1546.  -       var checkResult = checkValue.call(this, newValue, valueType);
  1549. 1547.  -       if (typeof(checkResult) == 'string') {
  1550. 1548.  -         showFastError.call(this, checkResult);
  1551. 1549.  -         return false;
  1552. 1550.  -       }
  1553. 1551.  -       if (checkResult !== true) {
  1554. 1552.  -         showFastError.call(this, getLang('ads_error_unknown_error'));
  1555. 1553.  -         return false;
  1556. 1554.  -       }
  1557. 1555.  -     }
  1558. 1556.  -
  1559. 1557.  -     saveValue.call(this, newValue, false);
  1560. 1558.  -     return true;
  1561. 1559.  -   }
  1562. 1560.  -
  1563. 1561.  -   var options = {
  1564. 1562.  -     afterInit: afterInit,
  1565. 1563.  -     onBeforeShow: onBeforeShow,
  1566. 1564.  -     onShow: onShow,
  1567. 1565.  -     onConfirm: onConfirm
  1568. 1566.  -   };
  1569. 1567.  -
  1570. 1568.  -   switch (valueGeneralType) {
  1571. 1569.  -     case 'cost_per_click':
  1572. 1570.  -       options.contentHTML =
  1573. 1571.  -         '<tr>' +
  1574. 1572.  -         '<td colspan="2">' +
  1575. 1573.  -         '<table class="ads_inline_edit_table" style="width: 100%;">' +
  1576. 1574.  -         '<tr><td><input class="inlInput text" type="text" /></td></tr>' +
  1577. 1575.  -         '<tr><td style="padding-top: 7px; height: 22px;">' +
  1578. 1576.  -           '<img class="inline_recommended_cost_progress" src="/images/upload.gif" />' +
  1579. 1577.  -           '<span class="ads_inline_recommended_cost_text"></span>' +
  1580. 1578.  -           '<div style="width: 275px; height: 1px;"></div>' +
  1581. 1579.  -           '</td></tr>' +
  1582. 1580.  -         '<tr class="ads_inline_fast_error_row"><td><div class="ads_inline_fast_error"></div></td></tr>' +
  1583. 1581.  -         '</table>' +
  1584. 1582.  -         '</td>' +
  1585. 1583.  -         '</tr>';
  1586. 1584.  -       break;
  1587. 1585.  -     case 'limit':
  1588. 1586.  -       options.contentHTML =
  1589. 1587.  -         '<tr>' +
  1590. 1588.  -         '<td colspan="2">' +
  1591. 1589.  -         '<table class="ads_inline_edit_table">' +
  1592. 1590.  -         '<tr>' +
  1593. 1591.  -         '<td><input class="inlInput text" type="text" /></td>' +
  1594. 1592.  -         '<td><a class="ads_inline_edit_remove_value" href="#">' + getLang('ads_inline_edit_remove_limit') + '</a></td>' +
  1595. 1593.  -         '</tr>' +
  1596. 1594.  -         '<tr class="ads_inline_fast_error_row"><td colspan="2"><div class="ads_inline_fast_error"></div></td></tr>' +
  1597. 1595.  -         '</table>' +
  1598. 1596.  -         '</td>' +
  1599. 1597.  -         '</tr>';
  1600. 1598.  -       break;
  1601. 1599.  -     case 'time':
  1602. 1600.  -       var removeValueText;
  1603. 1601.  -       switch (valueType) {
  1604. 1602.  -         case 'start_time': removeValueText = getLang('ads_inline_edit_remove_start_time'); break;
  1605. 1603.  -         case 'stop_time': removeValueText = getLang('ads_inline_edit_remove_stop_time'); break;
  1606. 1604.  -       }
  1607. 1605.  -       options.contentHTML =
  1608. 1606.  -         '<tr>' +
  1609. 1607.  -         '<td colspan="2">' +
  1610. 1608.  -         '<table class="ads_inline_edit_table">' +
  1611. 1609.  -         '<tr>' +
  1612. 1610.  -           '<td style="white-space: nowrap; width: 200px;">' +
  1613. 1611.  -             '<table class="ads_inline_edit_table">' +
  1614. 1612.  -             '<tr>' +
  1615. 1613.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_day text" style="width: 30px;" /></td>' +
  1616. 1614.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_month text" style="width: 30px;" /></td>' +
  1617. 1615.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_hour text" style="width: 30px;" /></td>' +
  1618. 1616.  -             '</tr>' +
  1619. 1617.  -             '</table>' +
  1620. 1618.  -           '</td>' +
  1621. 1619.  -         '</tr>' +
  1622. 1620.  -         '<tr><td style="padding-top: 7px;"><a class="ads_inline_edit_remove_value" style="padding-left: 0;" href="#">' + removeValueText + '</a></td></tr>' +
  1623. 1621.  -         '<tr class="ads_inline_fast_error_row"><td colspan="2"><div class="ads_inline_fast_error"></div></td></tr>' +
  1624. 1622.  -         '</table>' +
  1625. 1623.  -         '</td>' +
  1626. 1624.  -         '</tr>';
  1627. 1625.  -       break;
  1628. 1626.  -     case 'text':
  1629. 1627.  -       options.contentHTML =
  1630. 1628.  -         '<tr>' +
  1631. 1629.  -         '<td colspan="2">' +
  1632. 1630.  -         '<table class="ads_inline_edit_table" style="width: 100%;">' +
  1633. 1631.  -         '<tr><td><input class="inlInput text" type="text" /></td></tr>' +
  1634. 1632.  -         '<tr class="ads_inline_fast_error_row"><td><div class="ads_inline_fast_error"></div></td></tr>' +
  1635. 1633.  -         '</table>' +
  1636. 1634.  -         '</td>' +
  1637. 1635.  -         '</tr>';
  1638. 1636.  -       break;
  1639. 1637.  -   }
  1640. 1638.  -
  1641. 1639.  -   var ret = {
  1642. 1640.  -     target: editElem,
  1643. 1641.  -     options: options
  1644. 1642.  -   };
  1645. 1643.  -   if (this.getOptionsOnly) { // dirty hack.
  1646. 1644.  -     return ret;
  1647. 1645.  -   }
  1648. 1646.  -   ret.obj = new InlineEdit(editElem, options);
  1649. 1647.  -
  1650. 1648.  -   var accessFunctions = {
  1651. 1649.  -     applyNewValue: applyNewValue
  1652. 1650.  -   }
  1653. 1651.  -
  1654. 1652.  -   if (!cur.inlineEditControls) {
  1655. 1653.  -     cur.inlineEditControls = {};
  1656. 1654.  -   }
  1657. 1655.  -   cur.inlineEditControls[valueType + '_' + unionId] = accessFunctions;
  1658. 1656.  -
  1659. 1657.  -   return ret;
  1660. 1658.  - }
  1661. 1659.  -
  1662. 1660.  - Ads.createInlineDropdownMenu = function(menuElem, boxElem, progressElem, unionId, valueType, items, initValue, hash, additionalParams) {
  1663. 1661.  -   menuElem     = ge(menuElem);
  1664. 1662.  -   boxElem      = ge(boxElem);
  1665. 1663.  -   progressElem = ge(progressElem);
  1666. 1664.  -   var defaultValue = initValue;
  1667. 1665.  -
  1668. 1666.  -   var self;
  1669. 1667.  -
  1670. 1668.  -   function saveValue(newValue) {
  1671. 1669.  -
  1672. 1670.  -     if (newValue == defaultValue) {
  1673. 1671.  -       return;
  1674. 1672.  -     }
  1675. 1673.  -
  1676. 1674.  -     var unknownError = getLang('ads_error_unexpected_error_try_later');
  1677. 1675.  -
  1678. 1676.  -     var params = {};
  1679. 1677.  -     params.union_id = unionId;
  1680. 1678.  -     params.hash = hash;
  1681. 1679.  -     extend(params, additionalParams);
  1682. 1680.  -     params[valueType] = newValue;
  1683. 1681.  -
  1684. 1682.  -     function onAjaxComplete(response) {
  1685. 1683.  -       if (isObject(response)) {
  1686. 1684.  -         if (response.error) {
  1687. 1685.  -           showLongError.call(self, response.error);
  1688. 1686.  -         } else if (!response.not_changed) {
  1689. 1687.  -           if (response[valueType + '_value'] !== undefined) {
  1690. 1688.  -             applyNewValue(response[valueType + '_value'], response[valueType + '_text']);
  1691. 1689.  -             if (additionalParams.reload) {
  1692. 1690.  -               nav.reload();
  1693. 1691.  -             }
  1694. 1692.  -           } else {
  1695. 1693.  -             showLongError.call(self, unknownError);
  1696. 1694.  -           }
  1697. 1695.  -         }
  1698. 1696.  -       } else {
  1699. 1697.  -         showLongError.call(self, unknownError);
  1700. 1698.  -       }
  1701. 1699.  -
  1702. 1700.  -       hide(progressElem);
  1703. 1701.  -       show(boxElem);
  1704. 1702.  -
  1705. 1703.  -       return true;
  1706. 1704.  -     }
  1707. 1705.  -     ajax.post('/ads?act=a_unions_general_info_save', params, {onDone: onAjaxComplete, onFail: onAjaxComplete});
  1708. 1706.  -
  1709. 1707.  -     hide(boxElem);
  1710. 1708.  -     show(progressElem);
  1711. 1709.  -   }
  1712. 1710.  -
  1713. 1711.  -   function applyNewValue(newValue, newText) {
  1714. 1712.  -     defaultValue = newValue;
  1715. 1713.  -     self.setOptions({title: newText});
  1716. 1714.  -     menuElem.innerHTML = newText;
  1717. 1715.  -   }
  1718. 1716.  -   function showLongError(error) {
  1719. 1717.  -     showFastBox(getLang('ads_error_box_title'), error);
  1720. 1718.  -   }
  1721. 1719.  -
  1722. 1720.  -   function onMenuChange(event) {
  1723. 1721.  -     var newValue = event.target.index;
  1724. 1722.  -     saveValue(newValue);
  1725. 1723.  -   }
  1726. 1724.  -
  1727. 1725.  -   var options = {};
  1728. 1726.  -   options.target = menuElem;
  1729. 1727.  -   options.onSelect = onMenuChange;
  1730. 1728.  -   options.showHover = false;
  1731. 1729.  -   options.updateTarget = false;
  1732. 1730.  -   self = new DropdownMenu(items, options);
  1733. 1731.  - }
  1734. 1732.  -
  1735. 1733.  - Ads.MultiDropdownMenu = function(items, options) {
  1736. 1734.  -   var dropdownMenu;
  1737. 1735.  -   var selectedItems = {};
  1738. 1736.  -   var curItems = [];
  1739. 1737.  -
  1740. 1738.  -   function onItemClick(e) {
  1741. 1739.  -     if (e.target.className == 'ads_dd_menu_item_checkbox_on') {
  1742. 1740.  -       selectedItems[e.target.index] = false;
  1743. 1741.  -       e.target.className = 'ads_dd_menu_item_checkbox_off';
  1744. 1742.  -     } else {
  1745. 1743.  -       selectedItems[e.target.index] = true;
  1746. 1744.  -       e.target.className = 'ads_dd_menu_item_checkbox_on';
  1747. 1745.  -     }
  1748. 1746.  -     return false;
  1749. 1747.  -   }
  1750. 1748.  -
  1751. 1749.  -   for (var i in items) {
  1752. 1750.  -     curItems[i] = {};
  1753. 1751.  -     for (var j in items[i]) {
  1754. 1752.  -       curItems[i][j] = items[i][j];
  1755. 1753.  -     }
  1756. 1754.  -     curItems[i].onClick = onItemClick;
  1757. 1755.  -     curItems[i].c = 'ads_dd_menu_item_checkbox_off';
  1758. 1756.  -     selectedItems[curItems[i].i] = false;
  1759. 1757.  -   }
  1760. 1758.  -
  1761. 1759.  -   dropdownMenu = new DropdownMenu(curItems, options);
  1762. 1760.  -   dropdownMenu.getSelectedItems = function() {
  1763. 1761.  -     var selectedItemsResult = [];
  1764. 1762.  -     for (var i in selectedItems) {
  1765. 1763.  -       if (selectedItems[i]) {
  1766. 1764.  -         selectedItemsResult.push(i);
  1767. 1765.  -       }
  1768. 1766.  -     }
  1769. 1767.  -     return selectedItemsResult;
  1770. 1768.  -   }
  1771. 1769.  -
  1772. 1770.  -   return dropdownMenu;
  1773. 1771.  - }
  1774. 1772.  -
  1775. 1773.  - Ads.getCampaignsTotalLabel = function(total) {
  1776. 1774.  -   var type = this._curFilter;
  1777. 1775.  -   if (typeof type == 'object') type = type[0];
  1778. 1776.  -   if (!this._curSearchString || this._curSearchString == '') {
  1779. 1777.  -     switch (type) {
  1780. 1778.  -       case 0: return getLang('ads_stopped_campaigns_total', total);
  1781. 1779.  -       case 1: return getLang('ads_running_campaigns_total', total);
  1782. 1780.  -       case 3: return getLang('ads_planned_campaigns_total', total);
  1783. 1781.  -       case 4: return getLang('ads_archived_campaigns_total', total);
  1784. 1782.  -       default: return getLang('ads_active_campaigns_total', total);
  1785. 1783.  -     }
  1786. 1784.  -   } else {
  1787. 1785.  -     switch (type) {
  1788. 1786.  -       case 0: return getLang('ads_stopped_campaigns_found', total);
  1789. 1787.  -       case 1: return getLang('ads_running_campaigns_found', total);
  1790. 1788.  -       case 3: return getLang('ads_planned_campaigns_found', total);
  1791. 1789.  -       case 4: return getLang('ads_archived_campaigns_found', total);
  1792. 1790.  -       default: return getLang('ads_active_campaigns_found', total);
  1793. 1791.  -     }
  1794. 1792.  -   }
  1795. 1793.  - }
  1796. 1794.  -
  1797. 1795.  - Ads.getNoCampaignsLabel = function() {
  1798. 1796.  -   var type = this._curFilter;
  1799. 1797.  -   if (typeof type == 'object') type = type[0];
  1800. 1798.  -   if (!this._curSearchString || this._curSearchString == '') {
  1801. 1799.  -     switch (type) {
  1802. 1800.  -       case 0: return getLang('ads_no_stopped_campaigns');
  1803. 1801.  -       case 1: return getLang('ads_no_running_campaigns');
  1804. 1802.  -       case 3: return getLang('ads_no_planned_campaigns');
  1805. 1803.  -       case 4: return getLang('ads_no_archived_campaigns');
  1806. 1804.  -       default: return getLang('ads_no_active_campaigns');
  1807. 1805.  -     }
  1808. 1806.  -   } else {
  1809. 1807.  -     switch (type) {
  1810. 1808.  -       case 0: return getLang('ads_no_stopped_campaigns_found');
  1811. 1809.  -       case 1: return getLang('ads_no_running_campaigns_found');
  1812. 1810.  -       case 3: return getLang('ads_no_planned_campaigns_found');
  1813. 1811.  -       case 4: return getLang('ads_no_archived_campaigns_found');
  1814. 1812.  -       default: return getLang('ads_no_active_campaigns_found');
  1815. 1813.  -     }
  1816. 1814.  -   }
  1817. 1815.  - }
  1818. 1816.  -
  1819. 1817.  - Ads.getAdsTotalLabel = function(total) {
  1820. 1818.  -   var type = this._curFilter;
  1821. 1819.  -   if (typeof type == 'object') type = type[0];
  1822. 1820.  -   if (!this._curSearchString || this._curSearchString == '') {
  1823. 1821.  -     switch (type) {
  1824. 1822.  -       case 0: return getLang('ads_stopped_ads_total', total);
  1825. 1823.  -       case 1: return getLang('ads_running_ads_total', total);
  1826. 1824.  -       case 3: return getLang('ads_planned_ads_total', total);
  1827. 1825.  -       case 4: return getLang('ads_archived_ads_total', total);
  1828. 1826.  -       default: return getLang('ads_active_ads_total', total);
  1829. 1827.  -     }
  1830. 1828.  -   } else {
  1831. 1829.  -     switch (type) {
  1832. 1830.  -       case 0: return getLang('ads_stopped_ads_found', total);
  1833. 1831.  -       case 1: return getLang('ads_running_ads_found', total);
  1834. 1832.  -       case 3: return getLang('ads_planned_ads_found', total);
  1835. 1833.  -       case 4: return getLang('ads_archived_ads_found', total);
  1836. 1834.  -       default: return getLang('ads_active_ads_found', total);
  1837. 1835.  -     }
  1838. 1836.  -   }
  1839. 1837.  - }
  1840. 1838.  -
  1841. 1839.  - Ads.getNoAdsLabel = function() {
  1842. 1840.  -   var type = this._curFilter;
  1843. 1841.  -   if (typeof type == 'object') type = type[0];
  1844. 1842.  -   if (!this._curSearchString || this._curSearchString == '') {
  1845. 1843.  -     switch (type) {
  1846. 1844.  -       case 0: return getLang('ads_no_stopped_ads');
  1847. 1845.  -       case 1: return getLang('ads_no_running_ads');
  1848. 1846.  -       case 3: return getLang('ads_no_planned_ads');
  1849. 1847.  -       case 4: return getLang('ads_no_archived_ads');
  1850. 1848.  -       default: return getLang('ads_no_active_ads');
  1851. 1849.  -     }
  1852. 1850.  -   } else {
  1853. 1851.  -     switch (type) {
  1854. 1852.  -       case 0: return getLang('ads_no_stopped_ads_found');
  1855. 1853.  -       case 1: return getLang('ads_no_running_ads_found');
  1856. 1854.  -       case 3: return getLang('ads_no_planned_ads_found');
  1857. 1855.  -       case 4: return getLang('ads_no_archived_ads_found');
  1858. 1856.  -       default: return getLang('ads_no_active_ads_found');
  1859. 1857.  -     }
  1860. 1858.  -   }
  1861. 1859.  - }
  1862. 1860.  -
  1863. 1861.  - Ads.getClientsTotalLabel = function(total) {
  1864. 1862.  -   var type = this._curFilter;
  1865. 1863.  -   if (typeof type == 'object') type = type[0];
  1866. 1864.  -   if (!this._curSearchString || this._curSearchString == '') {
  1867. 1865.  -     switch (type) {
  1868. 1866.  -       case 4: return getLang('ads_archived_clients_total', total);
  1869. 1867.  -       default: return getLang('ads_active_clients_total', total);
  1870. 1868.  -     }
  1871. 1869.  -   } else {
  1872. 1870.  -     switch (type) {
  1873. 1871.  -       case 4: return getLang('ads_archived_clients_found', total);
  1874. 1872.  -       default: return getLang('ads_active_clients_found', total);
  1875. 1873.  -     }
  1876. 1874.  -   }
  1877. 1875.  - }
  1878. 1876.  -
  1879. 1877.  - Ads.getNoClientsLabel = function() {
  1880. 1878.  -   var type = this._curFilter;
  1881. 1879.  -   if (typeof type == 'object') type = type[0];
  1882. 1880.  -   if (!this._curSearchString || this._curSearchString == '') {
  1883. 1881.  -     switch (type) {
  1884. 1882.  -       case 4: return getLang('ads_no_archived_clients');
  1885. 1883.  -       default: return getLang('ads_no_active_clients');
  1886. 1884.  -     }
  1887. 1885.  -   } else {
  1888. 1886.  -     switch (type) {
  1889. 1887.  -       case 4: return getLang('ads_no_archived_clients_found');
  1890. 1888.  -       default: return getLang('ads_no_active_clients_found');
  1891. 1889.  -     }
  1892. 1890.  -   }
  1893. 1891.  - }
  1894. 1892.  -
  1895. 1893.  - Ads.addOfficeFormatFunctions = function(options) {
  1896. 1894.  -   var arrFind = function(arr, val) {
  1897. 1895.  -     var i = 0;
  1898. 1896.  -     for (; i < arr.length; i++) {
  1899. 1897.  -       if (arr[i] === val) {
  1900. 1898.  -         return i;
  1901. 1899.  -       }
  1902. 1900.  -     }
  1903. 1901.  -     return -1;
  1904. 1902.  -   }
  1905. 1903.  -
  1906. 1904.  -   var ind = arrFind(options.columnClasses, 'column_name_view');
  1907. 1905.  -   options.columnFormatting[ind] = function(data, rown) {
  1908. 1906.  -     if (rown == -1) return data;
  1909. 1907.  -     var unionId = this.content.extra.unionId[rown];
  1910. 1908.  -     return '<div class="ads_paginated_table_name"><a href="/ads?act=office&union_id=' + unionId + '">' + data + '</a></div>';
  1911. 1909.  -   }
  1912. 1910.  -
  1913. 1911.  -   var limitFormat = function(data, rown, coln) {
  1914. 1912.  -     if (rown == -1) return data;
  1915. 1913.  -     var wrap;
  1916. 1914.  -     try {
  1917. 1915.  -       var uid = this.content.extra.uid[rown][coln];
  1918. 1916.  -       if (uid) {
  1919. 1917.  -         wrap = "<img id=\"inline_edit_progress" + uid + "\" src=\"/images/upload.gif\" style=\"display: none;\" /><a id=\"inline_edit_value" + uid + "\" >{value}</a>";
  1920. 1918.  -       }
  1921. 1919.  -     } catch (e) {
  1922. 1920.  -       // Nothing
  1923. 1921.  -     }
  1924. 1922.  -     if (!wrap) {
  1925. 1923.  -       wrap = '{value}';
  1926. 1924.  -     }
  1927. 1925.  -     var value = data;
  1928. 1926.  -     if (data == 0) {
  1929. 1927.  -       value = getLang('ads_no_money_limit');
  1930. 1928.  -     } else {
  1931. 1929.  -       value = this._formatData(data, 'currency_int');
  1932. 1930.  -     }
  1933. 1931.  -     return wrap.replace('{value}', value);
  1934. 1932.  -   }
  1935. 1933.  -   ind = arrFind(options.columnClasses, 'column_day_limit_view');
  1936. 1934.  -   if (ind != -1) options.columnFormatting[ind] = limitFormat;
  1937. 1935.  -   ind = arrFind(options.columnClasses, 'column_month_limit_view');
  1938. 1936.  -   if (ind != -1) options.columnFormatting[ind] = limitFormat;
  1939. 1937.  -   ind = arrFind(options.columnClasses, 'column_all_limit_view');
  1940. 1938.  -   if (ind != -1) options.columnFormatting[ind] = limitFormat;
  1941. 1939.  -
  1942. 1940.  -   return options;
  1943. 1941.  - }
  1944. 1942.  -
  1945. 1943.  - Ads.createOfficePaginatedTable = function(container, options, content) {
  1946. 1944.  -   var getButton = function(label, callback) {
  1947. 1945.  -     var div = ce('div', {className: 'button_blue'});
  1948. 1946.  -     var butt = ce('button', {innerHTML: label, onclick: callback});
  1949. 1947.  -     div.appendChild(butt);
  1950. 1948.  -     return div;
  1951. 1949.  -   }
  1952. 1950.  -
  1953. 1951.  -   var statusCol = 1;
  1954. 1952.  -
  1955. 1953.  -   var selected;
  1956. 1954.  -
  1957. 1955.  -   var buttons = [],
  1958. 1956.  -       labels = [getLang('ads_status_do_disable'),
  1959. 1957.  -                 getLang('ads_status_do_enable'),
  1960. 1958.  -                 getLang('ads_status_do_archive')];
  1961. 1959.  -
  1962. 1960.  -
  1963. 1961.  -   var changeStatus = function(val) {
  1964. 1962.  -     return function() {
  1965. 1963.  -       var unionIds = [],
  1966. 1964.  -           hashes = [],
  1967. 1965.  -           hashesDel = [],
  1968. 1966.  -           enable = val; // 1 - on, 0 - off, 2 - delete
  1969. 1967.  -       var i;
  1970. 1968.  -       for (i in selected) {
  1971. 1969.  -         unionIds.push(pt.content.extra.union_id[selected[i]][statusCol]);
  1972. 1970.  -         hashes.push(pt.content.extra.hash[selected[i]][statusCol]);
  1973. 1971.  -         hashesDel.push(pt.content.extra.hash_delete[selected[i]][statusCol]);
  1974. 1972.  -       }
  1975. 1973.  -
  1976. 1974.  -       unionIds = unionIds.join(',');
  1977. 1975.  -       hashes = hashes.join(',');
  1978. 1976.  -       hashesDel = hashesDel.join(',');
  1979. 1977.  -
  1980. 1978.  -       if (val == 2) { // delete
  1981. 1979.  -         Ads.openDeleteUnionBox(cur.tableUnionTypeForDelete, unionIds, hashesDel, lockChangeStatus, unlockChangeStatus, updateStatusInTable, 2);
  1982. 1980.  -         return;
  1983. 1981.  -       }
  1984. 1982.  -
  1985. 1983.  -       var params = {
  1986. 1984.  -         union_id: unionIds,
  1987. 1985.  -         hash: hashes,
  1988. 1986.  -         newclass: 1,
  1989. 1987.  -         enable: val
  1990. 1988.  -       };
  1991. 1989.  -
  1992. 1990.  -       lockChangeStatus();
  1993. 1991.  -
  1994. 1992.  -       function lockChangeStatus() {
  1995. 1993.  -         lockButton(buttons[val]);
  1996. 1994.  -         return true;
  1997. 1995.  -       };
  1998. 1996.  -       function unlockChangeStatus() {
  1999. 1997.  -         unlockButton(buttons[val]);
  2000. 1998.  -       }
  2001. 1999.  -       function updateStatusInTable(ans) {
  2002. 2000.  -         if (ans['status_class']) ans = [ans];
  2003. 2001.  -
  2004. 2002.  -         var errored = 0;
  2005. 2003.  -         for (var i in selected) {
  2006. 2004.  -           if (!ans[i]) continue;
  2007. 2005.  -           if (!ans[i]['status_class']) {
  2008. 2006.  -             if (ans[i]['error'] && !errored) {
  2009. 2007.  -               errored = 1;
  2010. 2008.  -               showFastBox(getLang('ads_cant_start_ad_box_title'), ans[i]['error']);
  2011. 2009.  -             }
  2012. 2010.  -             continue;
  2013. 2011.  -           }
  2014. 2012.  -           pt.content.types[selected[i]] = ans[i]['status_type'];
  2015. 2013.  -           pt.content.extra.status_text[selected[i]][statusCol] = ans[i]['status'];
  2016. 2014.  -           pt.content.extra.status_variants[selected[i]][statusCol] = ans[i]['status_variants'];
  2017. 2015.  -           pt._updateValue(selected[i], statusCol, ans[i]['status_class']);
  2018. 2016.  -         }
  2019. 2017.  -         updateButtons.apply(pt);
  2020. 2018.  -       }
  2021. 2019.  -
  2022. 2020.  -       function onRequestComplete(response) {
  2023. 2021.  -         // response may be object or array
  2024. 2022.  -
  2025. 2023.  -         unlockChangeStatus();
  2026. 2024.  -
  2027. 2025.  -         if (!response || response.error) { // no isObject or isArray check here
  2028. 2026.  -           debugLog('onFail change status');
  2029. 2027.  -           var errorMessage = ((response && response.error) ? response.error : getLang('ads_error_unexpected_error_try_later'));
  2030. 2028.  -           showFastBox(getLang('ads_cant_start_ad_box_title'), errorMessage);
  2031. 2029.  -           return true;
  2032. 2030.  -         }
  2033. 2031.  -
  2034. 2032.  -         var info = '';
  2035. 2033.  -         if (response && response.info) {
  2036. 2034.  -           info = response.info;
  2037. 2035.  -         }
  2038. 2036.  -         debugLog('onDone change status, ' + info);
  2039. 2037.  -
  2040. 2038.  -         updateStatusInTable(response);
  2041. 2039.  -         return true;
  2042. 2040.  -       }
  2043. 2041.  -
  2044. 2042.  -       ajax.post('/ads?act=a_union_change_status', params, {onDone: onRequestComplete, onFail: onRequestComplete});
  2045. 2043.  -     };
  2046. 2044.  -   }
  2047. 2045.  -
  2048. 2046.  -   var updateButtons = function() {
  2049. 2047.  -     selected = this.getSelection(0, 1);
  2050. 2048.  -     var i;
  2051. 2049.  -     for (i in buttons) {
  2052. 2050.  -       hide(buttons[i]);
  2053. 2051.  -     }
  2054. 2052.  -     if (selected.length == 0) {
  2055. 2053.  -     } else {
  2056. 2054.  -       var was = [false, false];
  2057. 2055.  -       var on = {on: 1, pending: 1},
  2058. 2056.  -           off = {off: 1, off_red: 1, cross: 1};
  2059. 2057.  -       for (i in selected) {
  2060. 2058.  -         var stat = this.content.data[selected[i]][statusCol];
  2061. 2059.  -         if (on[stat]) was[0] = 1;
  2062. 2060.  -         if (off[stat]) was[1] = 1;
  2063. 2061.  -       }
  2064. 2062.  -       if (was[0]) show(buttons[0]);
  2065. 2063.  -       if (was[1]) show(buttons[1]);
  2066. 2064.  -       show(buttons[2]);
  2067. 2065.  -     }
  2068. 2066.  -   }
  2069. 2067.  -
  2070. 2068.  -   options.onCheckboxPick = updateButtons;
  2071. 2069.  -   options.onRefresh = updateButtons;
  2072. 2070.  -
  2073. 2071.  -   options = Ads.addOfficeFormatFunctions(options);
  2074. 2072.  -
  2075. 2073.  -   var i;
  2076. 2074.  -   for (i = 0; i < 3; i++) {
  2077. 2075.  -     buttons[i] = getButton(labels[i], changeStatus(i));
  2078. 2076.  -   }
  2079. 2077.  -
  2080. 2078.  -   var pt = new PaginatedTable(container, options, content);
  2081. 2079.  - //  pt.getData('/ads?act=a_unions_table&union_id=1000157403&period_key=20111018&sort_key=default_r&offset={offset}&limit={limit}');
  2082. 2080.  -
  2083. 2081.  -   // mass actions
  2084. 2082.  -   var container = ge('pt_' + pt.globalNum + '_mass_act_default_container');
  2085. 2083.  -   if (container) {
  2086. 2084.  -     addClass(container, 'ads_mass_act_container');
  2087. 2085.  -     container.appendChild(buttons[1]);
  2088. 2086.  -     container.appendChild(buttons[0]);
  2089. 2087.  -     container.appendChild(buttons[2]);
  2090. 2088.  -     for (i in buttons) {
  2091. 2089.  -       hide(buttons[i]);
  2092. 2090.  -     }
  2093. 2091.  -     show(container);
  2094. 2092.  -   }
  2095. 2093.  -
  2096. 2094.  -   // selecting subclasses
  2097. 2095.  -   var selectSubclass = function(classes) {
  2098. 2096.  -     return function() {
  2099. 2097.  -       var corr = 1;
  2100. 2098.  -       for (i = 0; i < pt.tableSize; i++) {
  2101. 2099.  -         if (i < pt.curFrom || i > pt.curTo) continue;
  2102. 2100.  -         var j = pt.permutation[i];
  2103. 2101.  -         var curClass = pt.content.data[j][statusCol];
  2104. 2102.  -         corr &= ((pt.selection[j] == 1) == (classes[curClass] == 1));
  2105. 2103.  -       }
  2106. 2104.  -       var checked = 1 ^ corr;
  2107. 2105.  -       for (i = 0; i < pt.tableSize; i++) {
  2108. 2106.  -         if (i < pt.curFrom || i > pt.curTo) continue;
  2109. 2107.  -         var j = pt.permutation[i];
  2110. 2108.  -         var curClass = pt.content.data[j][statusCol];
  2111. 2109.  -         var curToggle = classes[curClass] ? checked : 0;
  2112. 2110.  -         var el = ge('cb_row_' + j + '_' + pt.globalNum);
  2113. 2111.  -         if (el) {
  2114. 2112.  -           window[curToggle ? 'addClass' : 'removeClass'](el, 'on');
  2115. 2113.  -         }
  2116. 2114.  -         pt.toggleCheckbox(false, j, curToggle);
  2117. 2115.  -       }
  2118. 2116.  -     };
  2119. 2117.  -   }
  2120. 2118.  -   container = ge('select_all_link');
  2121. 2119.  -   if (container) {
  2122. 2120.  -     container.onclick = selectSubclass({on: 1, off: 1, off_red: 1, cross: 1, pending: 1});
  2123. 2121.  -   }
  2124. 2122.  -   container = ge('select_running_link');
  2125. 2123.  -   if (container) {
  2126. 2124.  -     container.onclick = selectSubclass({on: 1});
  2127. 2125.  -   }
  2128. 2126.  -   container = ge('select_stopped_link');
  2129. 2127.  -   if (container) {
  2130. 2128.  -     container.onclick = selectSubclass({off: 1, off_red: 1, cross: 1});
  2131. 2129.  -   }
  2132. 2130.  - }
  2133. 2131.  -
  2134. 2132.  - Ads.onStatusHover = function(elem, callback, rown, coln) {
  2135. 2133.  -   var _t = this;
  2136. 2134.  -   var options = {
  2137. 2135.  -     status: {type: this.content.data[rown][coln], title: this.content.extra.status_text[rown][coln]},
  2138. 2136.  -     items: this.content.extra.status_variants[rown][coln],
  2139. 2137.  -     popupTime: -1,
  2140. 2138.  -     onSelect: function(event) { // copypasted
  2141. 2139.  -       var index = event.target.index,
  2142. 2140.  -           unionId = _t.content.extra.union_id[rown][coln],
  2143. 2141.  -           hash = _t.content.extra.hash[rown][coln],
  2144. 2142.  -           hashDelete = _t.content.extra.hash_delete[rown][coln];
  2145. 2143.  -
  2146. 2144.  -       if (index == 'archived') {
  2147. 2145.  -         setTimeout(function(){
  2148. 2146.  -           Ads.openDeleteUnionBox(cur.tableUnionTypeForDelete, unionId, hashDelete, lockChangeStatus, unlockChangeStatus, updateStatusInTable, 1);
  2149. 2147.  -         }, 1);
  2150. 2148.  -         return;
  2151. 2149.  -       }
  2152. 2150.  -
  2153. 2151.  -       var params = {};
  2154. 2152.  -       params.union_id = unionId;
  2155. 2153.  -       params.hash = hash;
  2156. 2154.  -       params.newclass = 1;
  2157. 2155.  -
  2158. 2156.  -       params.enable = ((index == 'on') ? 1 : 0);
  2159. 2157.  -
  2160. 2158.  -       lockChangeStatus();
  2161. 2159.  -
  2162. 2160.  -       function lockChangeStatus() {
  2163. 2161.  -         var selectorBox   = ge('union_' + unionId + '_status_selector_box');
  2164. 2162.  -         var progress      = ge('union_' + unionId + '_status_progress');
  2165. 2163.  -         hide(selectorBox);
  2166. 2164.  -         show(progress);
  2167. 2165.  -         return true;
  2168. 2166.  -       };
  2169. 2167.  -       function unlockChangeStatus() {
  2170. 2168.  -         var selectorBox   = ge('union_' + unionId + '_status_selector_box');
  2171. 2169.  -         var progress      = ge('union_' + unionId + '_status_progress');
  2172. 2170.  -         hide(progress)
  2173. 2171.  -         show(selectorBox);
  2174. 2172.  -       }
  2175. 2173.  -       function updateStatusInTable(status, status_class, status_type, status_variants) {
  2176. 2174.  -         if (!status && !status_class) return;
  2177. 2175.  -
  2178. 2176.  -         var ret = {
  2179. 2177.  -           value: status_class,
  2180. 2178.  -           extra: {
  2181. 2179.  -             status_text: status,
  2182. 2180.  -             status_variants: status_variants
  2183. 2181.  -           },
  2184. 2182.  -           type: status_type
  2185. 2183.  -         };
  2186. 2184.  -
  2187. 2185.  -         if (status_class == 'deleted') {
  2188. 2186.  -           ret.listeners = false;
  2189. 2187.  -           ret.extra.link_class = '';
  2190. 2188.  -         }
  2191. 2189.  -         callback(ret);
  2192. 2190.  -       }
  2193. 2191.  -
  2194. 2192.  -       function onRequestComplete(response) {
  2195. 2193.  -         unlockChangeStatus();
  2196. 2194.  -
  2197. 2195.  -         if (!isObject(response) || response.error) {
  2198. 2196.  -           debugLog('onFail change status');
  2199. 2197.  -           var errorMessage = (isObject(response) ? response.error : getLang('ads_error_unexpected_error_try_later'));
  2200. 2198.  -           showFastBox(getLang('ads_cant_start_ad_box_title'), errorMessage);
  2201. 2199.  -           return true;
  2202. 2200.  -         }
  2203. 2201.  -
  2204. 2202.  -         var info = '';
  2205. 2203.  -         if (response && response.info) {
  2206. 2204.  -           info = response.info;
  2207. 2205.  -         }
  2208. 2206.  -         debugLog('onDone change status, ' + info);
  2209. 2207.  -
  2210. 2208.  -         updateStatusInTable(response.status, response.status_class, response.status_type, response.status_variants);
  2211. 2209.  -         return true;
  2212. 2210.  -       }
  2213. 2211.  -
  2214. 2212.  -       ajax.post('/ads?act=a_union_change_status', params, {onDone: onRequestComplete, onFail: onRequestComplete});
  2215. 2213.  -     }
  2216. 2214.  -   };
  2217. 2215.  -
  2218. 2216.  -   var sdd;
  2219. 2217.  -   if (!cur._statusDropdown) {
  2220. 2218.  -     var handler = elem.getAttribute('onclick');
  2221. 2219.  -     sdd = cur._statusDropdown = Ads.statusDropdown(elem, options);
  2222. 2220.  -     elem.setAttribute('onclick', handler);
  2223. 2221.  -     elem.onclick = function(){eval(handler);};
  2224. 2222.  -   } else {
  2225. 2223.  -     sdd = cur._statusDropdown;
  2226. 2224.  -     sdd.hideHeader();
  2227. 2225.  -     clearTimeout(sdd.timer);
  2228. 2226.  -     sdd.setContainer(elem);
  2229. 2227.  -     sdd.setStatus(options.status);
  2230. 2228.  -     sdd.setItems(options.items);
  2231. 2229.  -     sdd.setHandler(options.onSelect);
  2232. 2230.  -   }
  2233. 2231.  -
  2234. 2232.  -   sdd.onOver();
  2235. 2233.  - }
  2236. 2234.  -
  2237. 2235.  - Ads.statusDropdown = function(container, options) {
  2238. 2236.  -   container = ge(container);
  2239. 2237.  -   if (!container) return false;
  2240. 2238.  -
  2241. 2239.  -   options = extend({
  2242. 2240.  -     popupTime: 200,   // -1 means 'always show entire body'
  2243. 2241.  -     status: {type: 'off', title: 'Disabled'},
  2244. 2242.  -     onSelect: function() {}
  2245. 2243.  -   }, options);
  2246. 2244.  -
  2247. 2245.  -   var compareTypes = function(type1, type2) {
  2248. 2246.  -     var same = {
  2249. 2247.  -       on: {
  2250. 2248.  -         on: 1,
  2251. 2249.  -         pending: 1
  2252. 2250.  -       },
  2253. 2251.  -       off: {
  2254. 2252.  -         off: 1,
  2255. 2253.  -         off_red: 1,
  2256. 2254.  -         cross: 1
  2257. 2255.  -       },
  2258. 2256.  -       archived: {
  2259. 2257.  -         deleted: 1
  2260. 2258.  -       }
  2261. 2259.  -     };
  2262. 2260.  -     if (!same[type1]) return 0;
  2263. 2261.  -     return same[type1][type2] || 0;
  2264. 2262.  -   }
  2265. 2263.  -
  2266. 2264.  -   var items = clone(options.items);
  2267. 2265.  -   for (var i in items) {
  2268. 2266.  -     if (compareTypes(items[i]['i'], options.status.type)) {
  2269. 2267.  -       delete items[i];
  2270. 2268.  -     }
  2271. 2269.  -   }
  2272. 2270.  -
  2273. 2271.  -   var imgSpanFake = {className: geByClass('ads_status_image_span', container)[0].className};
  2274. 2272.  -   var imgSpanHTML = '<span class="' + imgSpanFake.className + '"></span>';
  2275. 2273.  -
  2276. 2274.  -   var deltaTop = 0, deltaLeft = 0;
  2277. 2275.  -   if (browser.opera) deltaTop += -1;
  2278. 2276.  -   if (browser.mozilla) deltaTop += -1;
  2279. 2277.  -   if (browser.msie) { deltaTop += -1; deltaLeft += 1; }
  2280. 2278.  -
  2281. 2279.  -   var dd = new DropdownMenu(items, {
  2282. 2280.  -     title: imgSpanHTML + options.status.title,
  2283. 2281.  -     target: container,
  2284. 2282.  -     onSelect: options.onSelect,
  2285. 2283.  -     showHover: false,
  2286. 2284.  -     updateTarget: false,
  2287. 2285.  -     offsetTop: -2 + deltaTop,
  2288. 2286.  -     offsetLeft: -1 + deltaLeft
  2289. 2287.  -   });
  2290. 2288.  -   dd.hide();
  2291. 2289.  -   addClass(dd.header, 'ads_dd_wide');
  2292. 2290.  -   addClass(dd.body, 'ads_dd_wide');
  2293. 2291.  -
  2294. 2292.  -   var showTimer, hideTimer;
  2295. 2293.  -   var overListener = function() {
  2296. 2294.  -     if (hideTimer) {
  2297. 2295.  -       clearTimeout(hideTimer);
  2298. 2296.  -       hideTimer = false;
  2299. 2297.  -     }
  2300. 2298.  -     if (options.popupTime == -1) {
  2301. 2299.  -       dd.show();
  2302. 2300.  -       return true;
  2303. 2301.  -     }
  2304. 2302.  -     showTimer = setTimeout(function() {
  2305. 2303.  -       showTimer = false;
  2306. 2304.  -       ret.showHeader();
  2307. 2305.  -     }, options.popupTime);
  2308. 2306.  -   };
  2309. 2307.  -   var outListenerSoft = function() {
  2310. 2308.  -     if (showTimer) {
  2311. 2309.  -       clearTimeout(showTimer);
  2312. 2310.  -       showTimer = false;
  2313. 2311.  -     } else {
  2314. 2312.  -       hideTimer = setTimeout(function() {
  2315. 2313.  -         hideTimer = false;
  2316. 2314.  -         ret.hideHeader();
  2317. 2315.  -       }, 500);
  2318. 2316.  -     }
  2319. 2317.  -   };
  2320. 2318.  -   var outListenerHard = function() {
  2321. 2319.  -     hideTimer = setTimeout(function() {
  2322. 2320.  -       hideTimer = false;
  2323. 2321.  -       ret.hideHeader();
  2324. 2322.  -     }, 500);
  2325. 2323.  -   };
  2326. 2324.  -
  2327. 2325.  -   if (options.popupTime != -1) {
  2328. 2326.  -     addEvent(dd.header, 'click', function() {removeClass(dd.header, 'ads_dd_header_popup');});
  2329. 2327.  -     addEvent(container, 'click', function() {ret.showBody();});
  2330. 2328.  -
  2331. 2329.  -     addEvent(container, 'mouseover', overListener);
  2332. 2330.  -     addEvent(container, 'mouseout', outListenerSoft);
  2333. 2331.  -     addEvent(dd.header, 'mouseover', overListener);
  2334. 2332.  -     addEvent(dd.header, 'mouseout', outListenerHard);
  2335. 2333.  -     addEvent(dd.body, 'mouseover', overListener);
  2336. 2334.  -     addEvent(dd.body, 'mouseout', outListenerHard);
  2337. 2335.  -   }
  2338. 2336.  -
  2339. 2337.  -   var clearTimers = function() {
  2340. 2338.  -     if (showTimer) {
  2341. 2339.  -       clearTimeout(showTimer);
  2342. 2340.  -       showTimer = false;
  2343. 2341.  -     }
  2344. 2342.  -     if (hideTimer) {
  2345. 2343.  -       clearTimeout(hideTimer);
  2346. 2344.  -       hideTimer = false;
  2347. 2345.  -     }
  2348. 2346.  -   }
  2349. 2347.  -
  2350. 2348.  -   var ret = {
  2351. 2349.  -     getStatus: function() {
  2352. 2350.  -       return options.status;
  2353. 2351.  -     },
  2354. 2352.  -     setStatus: function(status) {
  2355. 2353.  -       removeClass(imgSpanFake, 'status_' + options.status.type);
  2356. 2354.  -       options.status = status;
  2357. 2355.  -       addClass(imgSpanFake, 'status_' + options.status.type);
  2358. 2356.  -       dd.setOptions({title: '<span class="' + imgSpanFake.className + '"></span>' + options.status.title});
  2359. 2357.  -     },
  2360. 2358.  -     setContainer: function(newContainer) {
  2361. 2359.  -       if (!newContainer) return false;
  2362. 2360.  -       clearTimers();
  2363. 2361.  -       if (options.popupTime != -1) {
  2364. 2362.  -         removeEvent(container, 'mouseover', overListener);
  2365. 2363.  -         removeEvent(container, 'mouseout', outListenerSoft);
  2366. 2364.  -         removeEvent(dd.header, 'mouseover', overListener);
  2367. 2365.  -         removeEvent(dd.header, 'mouseout', outListenerHard);
  2368. 2366.  -         removeEvent(dd.body, 'mouseover', overListener);
  2369. 2367.  -         removeEvent(dd.body, 'mouseout', outListenerHard);
  2370. 2368.  -       }
  2371. 2369.  -       container = newContainer;
  2372. 2370.  -       dd.setOptions({target: container});
  2373. 2371.  -       dd.moveToTarget();
  2374. 2372.  -       if (options.popupTime != -1) {
  2375. 2373.  -         addEvent(container, 'mouseover', overListener);
  2376. 2374.  -         addEvent(container, 'mouseout', outListenerSoft);
  2377. 2375.  -         addEvent(dd.header, 'mouseover', overListener);
  2378. 2376.  -         addEvent(dd.header, 'mouseout', outListenerHard);
  2379. 2377.  -         addEvent(dd.body, 'mouseover', overListener);
  2380. 2378.  -         addEvent(dd.body, 'mouseout', outListenerHard);
  2381. 2379.  -       }
  2382. 2380.  -     },
  2383. 2381.  -     setItems: function(newItems) {
  2384. 2382.  -       var items = clone(newItems);
  2385. 2383.  -       for (var i in items) {
  2386. 2384.  -         if (compareTypes(items[i]['i'], options.status.type)) {
  2387. 2385.  -           delete items[i];
  2388. 2386.  -         }
  2389. 2387.  -       }
  2390. 2388.  -       dd.setData(items);
  2391. 2389.  -     },
  2392. 2390.  -     setHandler: function(handler) {
  2393. 2391.  -       dd.setOptions({onSelect: handler});
  2394. 2392.  -     },
  2395. 2393.  -     showHeader: function() {
  2396. 2394.  -       if (!dd.visible) {
  2397. 2395.  -         addClass(dd.header, 'ads_dd_header_popup');
  2398. 2396.  -       }
  2399. 2397.  -       dd.moveToTarget();
  2400. 2398.  -       show(dd.header);
  2401. 2399.  -     },
  2402. 2400.  -     hideHeader: function() {
  2403. 2401.  -       dd.hide();
  2404. 2402.  -       hide(dd.header);
  2405. 2403.  -       removeClass(dd.header, 'ads_dd_header_popup');
  2406. 2404.  -     },
  2407. 2405.  -     showBody: function() {
  2408. 2406.  -       removeClass(dd.header, 'ads_dd_header_popup');
  2409. 2407.  -       dd.show();
  2410. 2408.  -     },
  2411. 2409.  -     hideBody: function() {
  2412. 2410.  -       dd.hide();
  2413. 2411.  -     },
  2414. 2412.  -     onOver: overListener,
  2415. 2413.  -     onOut: outListenerHard
  2416. 2414.  -   };
  2417. 2415.  -
  2418. 2416.  -   return ret;
  2419. 2417.  - }
  2420. 2418.  -
  2421. 2419.  - Ads.changeDemographyView = function(name, unionId, updateOnly) {
  2422. 2420.  -
  2423. 2421.  -   // Change navigation
  2424. 2422.  -   var navCur = ge('ads_demography_navigation_tab_' + name);
  2425. 2423.  -   if (!navCur) {
  2426. 2424.  -     return;
  2427. 2425.  -   }
  2428. 2426.  -   navCur = navCur.parentNode;
  2429. 2427.  -   var navCurSelected = hasClass(navCur, 'summary_tab_sel');
  2430. 2428.  -   if (navCurSelected && !updateOnly || !navCurSelected && updateOnly) {
  2431. 2429.  -     return;
  2432. 2430.  -   }
  2433. 2431.  -   var navElems = [
  2434. 2432.  -     ge('ads_demography_navigation_tab_bars_all').parentNode,
  2435. 2433.  -     ge('ads_demography_navigation_tab_graphs').parentNode
  2436. 2434.  -   ];
  2437. 2435.  -   for (var i in navElems) {
  2438. 2436.  -     var navElem = navElems[i];
  2439. 2437.  -     addClass(navElem, 'summary_tab');
  2440. 2438.  -     removeClass(navElem, 'summary_tab_sel');
  2441. 2439.  -   }
  2442. 2440.  -   addClass(navCur, 'summary_tab_sel');
  2443. 2441.  -   removeClass(navCur, 'summary_tab');
  2444. 2442.  -
  2445. 2443.  -   // Change graph
  2446. 2444.  -   var bars1   = ge('ads_demography_bars_all_wrap1');
  2447. 2445.  -   var bars2   = ge('ads_demography_bars_all_wrap2');
  2448. 2446.  -   var graphs1 = ge('ads_demography_graphs_wrap1');
  2449. 2447.  -   var graphs2 = ge('ads_demography_graphs_wrap2');
  2450. 2448.  -
  2451. 2449.  -   if (name === 'bars_all') {
  2452. 2450.  -     setStyle(bars1,   {visibility: 'visible', height: getSize(bars2)[1] + 'px'})
  2453. 2451.  -     setStyle(bars2,   {top: '0'})
  2454. 2452.  -     setStyle(graphs1, {visibility: 'hidden', height: '0'});
  2455. 2453.  -   } else if (name === 'graphs') {
  2456. 2454.  -     if (!Ads.loadDemography(unionId)) {
  2457. 2455.  -       return;
  2458. 2456.  -     }
  2459. 2457.  -
  2460. 2458.  -     !cur.graphUsersStatsSexEmpty && cur.pageGraphs['ads_graph_users_stats_day_sex'].loadGraph(intval(cur.lastDemographySourceOffset));
  2461. 2459.  -     !cur.graphUsersStatsAgeEmpty && cur.pageGraphs['ads_graph_users_stats_day_age'].loadGraph(intval(cur.lastDemographySourceOffset) * 3 + intval(cur.lastDemographyAgeOffset));
  2462. 2460.  -     !cur.graphUsersStatsCitiesEmpty && cur.pageGraphs['ads_graph_users_stats_day_cities'].loadGraph(intval(cur.lastDemographySourceOffset));
  2463. 2461.  -
  2464. 2462.  -     setStyle(graphs2, {width: getSize(graphs1)[0] + 'px'});
  2465. 2463.  -     setStyle(graphs1, {visibility: 'visible', height: getSize(graphs2)[1] + 'px'});
  2466. 2464.  -     setStyle(bars1,   {visibility: 'hidden', height: '0'});
  2467. 2465.  -     setStyle(bars2,   {position: 'absolute', top: '-100000px'});
  2468. 2466.  -   }
  2469. 2467.  - }
  2470. 2468.  -
  2471. 2469.  - Ads.changeDemographySource = function(name) {
  2472. 2470.  -
  2473. 2471.  -   // Change navigation
  2474. 2472.  -   var clicksSideNav = ge('ads_demography_navigation_clicks');
  2475. 2473.  -   var viewsSideNav  = ge('ads_demography_navigation_views');
  2476. 2474.  -   var clicksTabNav = ge('ads_demography_navigation_tab_clicks');
  2477. 2475.  -   var viewsTabNav  = ge('ads_demography_navigation_tab_views');
  2478. 2476.  -   if (clicksTabNav) {
  2479. 2477.  -     clicksTabNav = clicksTabNav.parentNode;
  2480. 2478.  -     viewsTabNav  = viewsTabNav.parentNode;
  2481. 2479.  -   }
  2482. 2480.  -   if (name == 'clicks') {
  2483. 2481.  -     if (clicksSideNav) {
  2484. 2482.  -       if (hasClass(clicksSideNav, 'nav_selected')) {
  2485. 2483.  -         return;
  2486. 2484.  -       }
  2487. 2485.  -       addClass(clicksSideNav, 'nav_selected');
  2488. 2486.  -       removeClass(viewsSideNav, 'nav_selected');
  2489. 2487.  -     }
  2490. 2488.  -     if (clicksTabNav) {
  2491. 2489.  -       if (hasClass(clicksTabNav, 'summary_tab_sel')) {
  2492. 2490.  -         return;
  2493. 2491.  -       }
  2494. 2492.  -       addClass(clicksTabNav, 'summary_tab_sel');
  2495. 2493.  -       addClass(viewsTabNav, 'summary_tab');
  2496. 2494.  -       removeClass(clicksTabNav, 'summary_tab');
  2497. 2495.  -       removeClass(viewsTabNav, 'summary_tab_sel');
  2498. 2496.  -     }
  2499. 2497.  -   } else {
  2500. 2498.  -     if (clicksSideNav) {
  2501. 2499.  -       if (hasClass(viewsSideNav, 'nav_selected')) {
  2502. 2500.  -         return;
  2503. 2501.  -       }
  2504. 2502.  -       addClass(viewsSideNav, 'nav_selected');
  2505. 2503.  -       removeClass(clicksSideNav, 'nav_selected');
  2506. 2504.  -     }
  2507. 2505.  -     if (clicksTabNav) {
  2508. 2506.  -       if (hasClass(viewsTabNav, 'summary_tab_sel')) {
  2509. 2507.  -         return;
  2510. 2508.  -       }
  2511. 2509.  -       addClass(viewsTabNav, 'summary_tab_sel');
  2512. 2510.  -       addClass(clicksTabNav, 'summary_tab');
  2513. 2511.  -       removeClass(viewsTabNav, 'summary_tab');
  2514. 2512.  -       removeClass(clicksTabNav, 'summary_tab_sel');
  2515. 2513.  -     }
  2516. 2514.  -   }
  2517. 2515.  -
  2518. 2516.  -   // Change graph
  2519. 2517.  -   if (name == 'clicks') {
  2520. 2518.  -     cur.lastDemographySourceOffset = 0;
  2521. 2519.  -     if (cur.isDemographySvg) {
  2522. 2520.  -       each(geByClass('ads_demography_bars_clicks'), function(i, el) { el.style.visibility = 'visible'; el.style.position = 'relative'; });
  2523. 2521.  -       each(geByClass('ads_demography_bars_views'),  function(i, el) { el.style.visibility = 'hidden';  el.style.position = 'absolute'; });
  2524. 2522.  -     } else {
  2525. 2523.  -       each(geByClass('ads_demography_bars_clicks'), show);
  2526. 2524.  -       each(geByClass('ads_demography_bars_views'),  hide);
  2527. 2525.  -     }
  2528. 2526.  -     try { cur.pageGraphs['ads_graph_users_stats_day_sex'].loadGraph(intval(cur.lastDemographySourceOffset)); } catch(e) {}
  2529. 2527.  -     try { cur.pageGraphs['ads_graph_users_stats_day_age'].loadGraph(intval(cur.lastDemographySourceOffset) * 3 + intval(cur.lastDemographyAgeOffset)); } catch(e) {}
  2530. 2528.  -     try { cur.pageGraphs['ads_graph_users_stats_day_cities'].loadGraph(intval(cur.lastDemographySourceOffset)); } catch(e) {}
  2531. 2529.  -   } else {
  2532. 2530.  -     cur.lastDemographySourceOffset = 1;
  2533. 2531.  -     if (cur.isDemographySvg) {
  2534. 2532.  -       each(geByClass('ads_demography_bars_views'),  function(i, el) { el.style.visibility = 'visible'; el.style.position = 'relative'; });
  2535. 2533.  -       each(geByClass('ads_demography_bars_clicks'), function(i, el) { el.style.visibility = 'hidden';  el.style.position = 'absolute'; });
  2536. 2534.  -     } else {
  2537. 2535.  -       each(geByClass('ads_demography_bars_views'),  show);
  2538. 2536.  -       each(geByClass('ads_demography_bars_clicks'), hide);
  2539. 2537.  -     }
  2540. 2538.  -     try { cur.pageGraphs['ads_graph_users_stats_day_sex'].loadGraph(intval(cur.lastDemographySourceOffset)); } catch(e) {}
  2541. 2539.  -     try { cur.pageGraphs['ads_graph_users_stats_day_age'].loadGraph(intval(cur.lastDemographySourceOffset) * 3 + intval(cur.lastDemographyAgeOffset)); } catch(e) {}
  2542. 2540.  -     try { cur.pageGraphs['ads_graph_users_stats_day_cities'].loadGraph(intval(cur.lastDemographySourceOffset)); } catch(e) {}
  2543. 2541.  -   }
  2544. 2542.  - }
  2545. 2543.  -
  2546. 2544.  - Ads.changeDemographyAge = function(name) {
  2547. 2545.  -   // Change navigation
  2548. 2546.  -   var allNav    = ge('ads_demography_navigation_tab_age_all').parentNode;
  2549. 2547.  -   var femaleNav = ge('ads_demography_navigation_tab_age_female').parentNode;
  2550. 2548.  -   var maleNav   = ge('ads_demography_navigation_tab_age_male').parentNode;
  2551. 2549.  -   switch (name) {
  2552. 2550.  -     case 'all':
  2553. 2551.  -       if (hasClass(allNav, 'summary_tab_sel')) {
  2554. 2552.  -         return;
  2555. 2553.  -       }
  2556. 2554.  -       addClass(allNav,       'summary_tab_sel');
  2557. 2555.  -       addClass(femaleNav,    'summary_tab');
  2558. 2556.  -       addClass(maleNav,      'summary_tab');
  2559. 2557.  -       removeClass(allNav,    'summary_tab');
  2560. 2558.  -       removeClass(femaleNav, 'summary_tab_sel');
  2561. 2559.  -       removeClass(maleNav,   'summary_tab_sel');
  2562. 2560.  -       break;
  2563. 2561.  -     case 'female':
  2564. 2562.  -       if (hasClass(femaleNav, 'summary_tab_sel')) {
  2565. 2563.  -         return;
  2566. 2564.  -       }
  2567. 2565.  -       addClass(femaleNav,    'summary_tab_sel');
  2568. 2566.  -       addClass(allNav,       'summary_tab');
  2569. 2567.  -       addClass(maleNav,      'summary_tab');
  2570. 2568.  -       removeClass(femaleNav, 'summary_tab');
  2571. 2569.  -       removeClass(allNav,    'summary_tab_sel');
  2572. 2570.  -       removeClass(maleNav,   'summary_tab_sel');
  2573. 2571.  -       break;
  2574. 2572.  -     case 'male':
  2575. 2573.  -       if (hasClass(maleNav, 'summary_tab_sel')) {
  2576. 2574.  -         return;
  2577. 2575.  -       }
  2578. 2576.  -       addClass(maleNav,      'summary_tab_sel');
  2579. 2577.  -       addClass(allNav,       'summary_tab');
  2580. 2578.  -       addClass(femaleNav,    'summary_tab');
  2581. 2579.  -       removeClass(maleNav,   'summary_tab');
  2582. 2580.  -       removeClass(allNav,    'summary_tab_sel');
  2583. 2581.  -       removeClass(femaleNav, 'summary_tab_sel');
  2584. 2582.  -       break;
  2585. 2583.  -     default:
  2586. 2584.  -       return;
  2587. 2585.  -   }
  2588. 2586.  -
  2589. 2587.  -   // Change graph
  2590. 2588.  -   switch (name) {
  2591. 2589.  -     case 'all':    cur.lastDemographyAgeOffset = 0; break;
  2592. 2590.  -     case 'female': cur.lastDemographyAgeOffset = 1; break;
  2593. 2591.  -     case 'male':   cur.lastDemographyAgeOffset = 2; break;
  2594. 2592.  -     default:       return;
  2595. 2593.  -   }
  2596. 2594.  -   try { cur.pageGraphs['ads_graph_users_stats_day_age'].loadGraph(intval(cur.lastDemographySourceOffset) * 3 + intval(cur.lastDemographyAgeOffset)); } catch(e) {}
  2597. 2595.  - }
  2598. 2596.  -
  2599. 2597.  - Ads.loadDemography = function(unionId) {
  2600. 2598.  -   if (!cur.demographyDelayed) {
  2601. 2599.  -     return true;
  2602. 2600.  -   }
  2603. 2601.  -   if (!Ads.lock('load_demography', lock, unlock)) {
  2604. 2602.  -     return false;
  2605. 2603.  -   }
  2606. 2604.  -
  2607. 2605.  -   var ajaxParams = {};
  2608. 2606.  -   ajaxParams.union_id = unionId;
  2609. 2607.  -
  2610. 2608.  -   ajax.post('/ads?act=a_users_stats', ajaxParams, {onDone: onComplete, onFail: onComplete});
  2611. 2609.  -
  2612. 2610.  -   function lock() {
  2613. 2611.  -     setStyle('ads_demography_navigation_tab_progress', {visibility: 'visible'});
  2614. 2612.  -   }
  2615. 2613.  -   function unlock() {
  2616. 2614.  -     setStyle('ads_demography_navigation_tab_progress', {visibility: 'hidden'});
  2617. 2615.  -   }
  2618. 2616.  -   function onComplete(response) {
  2619. 2617.  -     Ads.unlock('load_demography');
  2620. 2618.  -     if (response && response.graphs_html && response.graphs_js) {
  2621. 2619.  -       cur.demographyDelayed = false;
  2622. 2620.  -       ge('ads_demography_graphs_wrap2').innerHTML = response.graphs_html;
  2623. 2621.  -       eval(response.graphs_js);
  2624. 2622.  -       Ads.changeDemographyView('graphs', unionId, true);
  2625. 2623.  -     }
  2626. 2624.  -     return true;
  2627. 2625.  -   }
  2628. 2626.  -
  2629. 2627.  -   return false;
  2630. 2628.  - }
  2631. 2629.  -
  2632. 2630.  - Ads.showEditAdminBox = function(event, unionId, userId, userEmail, isRemove) {
  2633. 2631.  -   if (event && (event.which > 1 || event.button > 1 || event.ctrlKey)) {
  2634. 2632.  -     return;
  2635. 2633.  -   }
  2636. 2634.  -
  2637. 2635.  -   userId = intval(userId);
  2638. 2636.  -
  2639. 2637.  -   if (!userId && !userEmail) {
  2640. 2638.  -     var userLink = ge('ads_user_link').getValue();
  2641. 2639.  -     if (!userLink) {
  2642. 2640.  -       showFastBox(getLang('ads_error_box_title'), getLang('ads_edit_admin_no_user_link'));
  2643. 2641.  -       return;
  2644. 2642.  -     }
  2645. 2643.  -   }
  2646. 2644.  -
  2647. 2645.  -   if (isRemove) {
  2648. 2646.  -     cur.editAdminBoxTitle = getLang('ads_edit_admin_box_title_remove');
  2649. 2647.  -   } else {
  2650. 2648.  -     if (userId || userEmail) {
  2651. 2649.  -       cur.editAdminBoxTitle = getLang('ads_edit_admin_box_title_edit');
  2652. 2650.  -     } else {
  2653. 2651.  -       cur.editAdminBoxTitle = getLang('ads_edit_admin_box_title_add');
  2654. 2652.  -     }
  2655. 2653.  -   }
  2656. 2654.  -
  2657. 2655.  -   var ajaxParams = {};
  2658. 2656.  -   ajaxParams.union_id = unionId;
  2659. 2657.  -   if (isRemove) {
  2660. 2658.  -     ajaxParams.action = 'remove';
  2661. 2659.  -   } else {
  2662. 2660.  -     ajaxParams.action = 'edit';
  2663. 2661.  -   }
  2664. 2662.  -   if (userId) {
  2665. 2663.  -     ajaxParams.user_link = userId;
  2666. 2664.  -   } else if (userEmail) {
  2667. 2665.  -     ajaxParams.user_link = userEmail;
  2668. 2666.  -   } else {
  2669. 2667.  -     ajaxParams.user_link = userLink;
  2670. 2668.  -   }
  2671. 2669.  -
  2672. 2670.  -   var showOptions = {params: {}};
  2673. 2671.  -   showOptions.onFail = Ads.onBoxFail;
  2674. 2672.  -   showOptions.params.width = 440;
  2675. 2673.  -
  2676. 2674.  -   showBox('/ads?act=a_edit_admin_box', ajaxParams, showOptions);
  2677. 2675.  -
  2678. 2676.  -   return false;
  2679. 2677.  - }
  2680. 2678.  -
  2681. 2679.  - Ads.showRetargetingGroupBox = function(unionId, groupId) {
  2682. 2680.  -   groupId = intval(groupId);
  2683. 2681.  -
  2684. 2682.  -   var ajaxParams = {};
  2685. 2683.  -   ajaxParams.union_id = unionId;
  2686. 2684.  -   if (groupId) {
  2687. 2685.  -     ajaxParams.group_id = groupId;
  2688. 2686.  -   }
  2689. 2687.  -
  2690. 2688.  -   var showOptions = {params: {}};
  2691. 2689.  -   showOptions.onFail = Ads.onBoxFail;
  2692. 2690.  -   showOptions.params.width = 400;
  2693. 2691.  -
  2694. 2692.  -   showBox('/ads?act=a_retargeting_group_box', ajaxParams, showOptions);
  2695. 2693.  -
  2696. 2694.  -   return false;
  2697. 2695.  - }
  2698. 2696.  -
  2699. 2697.  - Ads.showRetargetingGroupPixel = function(unionId, groupId, hash) {
  2700. 2698.  -   groupId = intval(groupId);
  2701. 2699.  -
  2702. 2700.  -   var ajaxParams = {};
  2703. 2701.  -   ajaxParams.union_id = unionId;
  2704. 2702.  -   ajaxParams.group_id = groupId;
  2705. 2703.  -   ajaxParams.hash = hash;
  2706. 2704.  -
  2707. 2705.  -   var showOptions = {params: {}};
  2708. 2706.  -   showOptions.onFail = Ads.onBoxFail;
  2709. 2707.  -   showOptions.params.width = 400;
  2710. 2708.  -
  2711. 2709.  -   showBox('/ads?act=a_get_retargeting_pixel', ajaxParams, showOptions);
  2712. 2710.  -
  2713. 2711.  -   return false;
  2714. 2712.  - }
  2715. 2713.  -
  2716. 2714.  - Ads.deleteRetargetingGroup = function(unionId, groupId, hash) {
  2717. 2715.  -   groupId = intval(groupId);
  2718. 2716.  -
  2719. 2717.  -   curBox().hide();
  2720. 2718.  -   showFastBox(getLang('ads_retargeting_del_confirm_title'), getLang('ads_retargeting_del_confirm_message'), getLang('box_yes'), function() {
  2721. 2719.  -     ajax.post('/ads', {act: 'a_del_retargeting_group', union_id: unionId, group_id: groupId, hash: hash}, {
  2722. 2720.  -       onDone: function(html) {
  2723. 2721.  -         ge('ads_retargeting_groups_table').innerHTML = html;
  2724. 2722.  -         curBox().hide();
  2725. 2723.  -       }
  2726. 2724.  -     });
  2727. 2725.  -   }, getLang('box_no'));
  2728. 2726.  -
  2729. 2727.  -   return false;
  2730. 2728.  - }
  2731. 2729.  -
  2732. 2730.  - Ads.initContacts = function(selectData, ajaxParams, isBig) {
  2733. 2731.  -
  2734. 2732.  -   if (cur.contacts && cur.contacts.destroy) {
  2735. 2733.  -     cur.contacts.destroy();
  2736. 2734.  -   }
  2737. 2735.  -
  2738. 2736.  -   var destroy = [];
  2739. 2737.  -
  2740. 2738.  -   cur.contacts = {};
  2741. 2739.  -   cur.contacts.ajaxParams = ajaxParams;
  2742. 2740.  -
  2743. 2741.  -   cur.contacts.destroy = function() {
  2744. 2742.  -     for (var i in destroy) {
  2745. 2743.  -       destroy[i]();
  2746. 2744.  -     }
  2747. 2745.  -     destroy = [];
  2748. 2746.  -   }
  2749. 2747.  -   cur.destroy.push(function() { cur.contacts.destroy(); });
  2750. 2748.  -
  2751. 2749.  -   var interestingEvents = 'keydown keyup keypress change paste cut drop input blur';
  2752. 2750.  -
  2753. 2751.  -   var uiWidth = 250 + (isBig ? 22 : 0);
  2754. 2752.  -
  2755. 2753.  -   var uiCountry = null;
  2756. 2754.  -   var uiCity = null;
  2757. 2755.  -
  2758. 2756.  -   ge('country').removeAttribute('autocomplete');
  2759. 2757.  -   uiCountry = new Dropdown(ge('country'), selectData.countries, {
  2760. 2758.  -     selectedItem: [selectData.country_val],
  2761. 2759.  -
  2762. 2760.  -     big: isBig,
  2763. 2761.  -     width: uiWidth,
  2764. 2762.  -     multiselect: false,
  2765. 2763.  -
  2766. 2764.  -     onChange: function(value) {
  2767. 2765.  -       Ads.onFormEdit();
  2768. 2766.  -       if (value == 1) {
  2769. 2767.  -         hide('ads_contacts_form_nonresident', 'cis_msg');
  2770. 2768.  -         show('ads_contacts_form_rus');
  2771. 2769.  -       } else if (value > 1) {
  2772. 2770.  -         hide('ads_contacts_form_rus');
  2773. 2771.  -         show('ads_contacts_form_nonresident');
  2774. 2772.  -         if (value < 4) show('cis_msg');
  2775. 2773.  -         else hide('cis_msg');
  2776. 2774.  -       }
  2777. 2775.  -       if (value == -1) {
  2778. 2776.  -         getAllCountries();
  2779. 2777.  -         return;
  2780. 2778.  -       } else if (value > 3) {
  2781. 2779.  -         hide('city_row');
  2782. 2780.  -         return;
  2783. 2781.  -       }
  2784. 2782.  -       uiCity.clear();
  2785. 2783.  -       uiCity.setURL('/select_ajax.php?act=a_get_cities&country=' + value);
  2786. 2784.  -       selectsData.getCountryInfo(value, 1, function(response) {
  2787. 2785.  -         var new_options = {
  2788. 2786.  -           defaultItems: response.cities,
  2789. 2787.  -           dropdown: true
  2790. 2788.  -         };
  2791. 2789.  -         uiCity.setOptions(new_options);
  2792. 2790.  -         if (selectData.country == value) {
  2793. 2791.  -           uiCity.selectItem(selectData.city_val);
  2794. 2792.  -         }
  2795. 2793.  -       });
  2796. 2794.  -       show(ge('city_row'));
  2797. 2795.  -     }
  2798. 2796.  -   });
  2799. 2797.  -   destroy.push(function(){ uiCountry.destroy(); });
  2800. 2798.  -
  2801. 2799.  -   ge('city').removeAttribute('autocomplete');
  2802. 2800.  -   uiCity = new Selector(ge('city'), '/select_ajax.php?act=a_get_cities&country='+selectData.country, {
  2803. 2801.  -     defaultItems: selectData.cities,
  2804. 2802.  -     selectedItems: [selectData.city_val],
  2805. 2803.  -
  2806. 2804.  -     big: isBig,
  2807. 2805.  -     width: uiWidth,
  2808. 2806.  -     multiselect: false,
  2809. 2807.  -     dropdown: true,
  2810. 2808.  -
  2811. 2809.  -     placeholder: getLang('select_city_not_selected'),
  2812. 2810.  -     introText: getLang('select_city_select'),
  2813. 2811.  -     noResult: getLang('select_city_not_found'),
  2814. 2812.  -     otherCity: getLang('select_city_other_city'),
  2815. 2813.  -
  2816. 2814.  -     onChange: function(value) {
  2817. 2815.  -       Ads.onFormEdit();
  2818. 2816.  -     }
  2819. 2817.  -   });
  2820. 2818.  -   destroy.push(function(){ uiCity.destroy(); });
  2821. 2819.  -
  2822. 2820.  -   var uiAgency = new Checkbox(ge('agency'), {
  2823. 2821.  -     checked: 1,
  2824. 2822.  -     width: uiWidth,
  2825. 2823.  -     label: getLang('ads_help_contacts_agency'),
  2826. 2824.  -
  2827. 2825.  -     onChange: function(value) {
  2828. 2826.  -       Ads.onFormEdit();
  2829. 2827.  -       if (value == 1) {
  2830. 2828.  -         slideDown(ge("agency_fields"), 200);
  2831. 2829.  -       } else {
  2832. 2830.  -         if (isVisible('agency_fields')) {
  2833. 2831.  -           slideUp(ge("agency_fields"), 200);
  2834. 2832.  -         }
  2835. 2833.  -       }
  2836. 2834.  -     }
  2837. 2835.  -   });
  2838. 2836.  -   destroy.push(function(){ uiAgency.destroy(); });
  2839. 2837.  -
  2840. 2838.  -   var uiDating = new Checkbox(ge('dating'), {
  2841. 2839.  -     checked: 0,
  2842. 2840.  -     width: uiWidth,
  2843. 2841.  -     label: getLang('ads_help_contacts_dating'),
  2844. 2842.  -
  2845. 2843.  -     onChange: function(value) {
  2846. 2844.  -       Ads.onFormEdit();
  2847. 2845.  -     }
  2848. 2846.  -   });
  2849. 2847.  -   destroy.push(function(){ uiDating.destroy(); });
  2850. 2848.  -
  2851. 2849.  -   var uiMedicine = new Checkbox(ge('medicine'), {
  2852. 2850.  -     checked: 0,
  2853. 2851.  -     width: uiWidth,
  2854. 2852.  -     label: getLang('ads_help_contacts_medicine'),
  2855. 2853.  -
  2856. 2854.  -     onChange: function(value) {
  2857. 2855.  -       Ads.onFormEdit();
  2858. 2856.  -     }
  2859. 2857.  -   });
  2860. 2858.  -   destroy.push(function(){ uiMedicine.destroy(); });
  2861. 2859.  -
  2862. 2860.  -   ge('budget').removeAttribute('autocomplete');
  2863. 2861.  -   var uiBudget = new Dropdown(ge('budget'), selectData.budget, {
  2864. 2862.  -     selectedItems: '0',
  2865. 2863.  -     big: isBig,
  2866. 2864.  -     width: uiWidth,
  2867. 2865.  -     zeroPlaceholder: true,
  2868. 2866.  -     multiselect: false,
  2869. 2867.  -
  2870. 2868.  -     onChange: function(value) {
  2871. 2869.  -       Ads.onFormEdit();
  2872. 2870.  -     }
  2873. 2871.  -   });
  2874. 2872.  -   destroy.push(function(){ uiBudget.destroy(); });
  2875. 2873.  -
  2876. 2874.  -   ge('budget_nr').removeAttribute('autocomplete');
  2877. 2875.  -   var uiBudgetNr = new Dropdown(ge('budget_nr'), selectData.budget, {
  2878. 2876.  -     selectedItems: '0',
  2879. 2877.  -     big: isBig,
  2880. 2878.  -     width: uiWidth,
  2881. 2879.  -     zeroPlaceholder: true,
  2882. 2880.  -     multiselect: false,
  2883. 2881.  -
  2884. 2882.  -     onChange: function(value) {
  2885. 2883.  -       Ads.onFormEdit();
  2886. 2884.  -     }
  2887. 2885.  -   });
  2888. 2886.  -   destroy.push(function(){ uiBudgetNr.destroy(); });
  2889. 2887.  -
  2890. 2888.  -   if (selectData.offices) {
  2891. 2889.  -     ge('office').removeAttribute('autocomplete');
  2892. 2890.  -     var uiOffice = new Dropdown(ge('office'), selectData.offices, {
  2893. 2891.  -       selectedItems: selectData.office,
  2894. 2892.  -       big: isBig,
  2895. 2893.  -       width: uiWidth,
  2896. 2894.  -       multiselect: false,
  2897. 2895.  -
  2898. 2896.  -       onChange: function(value) {
  2899. 2897.  -         Ads.onFormEdit();
  2900. 2898.  -       }
  2901. 2899.  -     });
  2902. 2900.  -     destroy.push(function(){ uiOffice.destroy(); });
  2903. 2901.  -   }
  2904. 2902.  -
  2905. 2903.  -   addEvent(ge('organisation'), interestingEvents, Ads.onFormEdit);
  2906. 2904.  -   destroy.push(function(){ cleanElems(ge('organisation')); });
  2907. 2905.  -   addEvent(ge('contact'), interestingEvents, Ads.onFormEdit);
  2908. 2906.  -   destroy.push(function(){ cleanElems(ge('contact')); });
  2909. 2907.  -   addEvent(ge('email'), interestingEvents, Ads.onFormEdit);
  2910. 2908.  -   destroy.push(function(){ cleanElems(ge('email')); });
  2911. 2909.  -   addEvent(ge('phone'), interestingEvents, Ads.onFormEdit);
  2912. 2910.  -   destroy.push(function(){ cleanElems(ge('phone')); });
  2913. 2911.  -   addEvent(ge('message'), interestingEvents, Ads.onFormEdit);
  2914. 2912.  -   destroy.push(function(){ cleanElems(ge('message')); });
  2915. 2913.  -   addEvent(ge('organisation_nr'), interestingEvents, Ads.onFormEdit);
  2916. 2914.  -   destroy.push(function(){ cleanElems(ge('organisation_nr')); });
  2917. 2915.  -   addEvent(ge('contact_nr'), interestingEvents, Ads.onFormEdit);
  2918. 2916.  -   destroy.push(function(){ cleanElems(ge('contact_nr')); });
  2919. 2917.  -   addEvent(ge('requisites_nr'), interestingEvents, Ads.onFormEdit);
  2920. 2918.  -   destroy.push(function(){ cleanElems(ge('requisites_nr')); });
  2921. 2919.  -   addEvent(ge('email_nr'), interestingEvents, Ads.onFormEdit);
  2922. 2920.  -   destroy.push(function(){ cleanElems(ge('email_nr')); });
  2923. 2921.  -   addEvent(ge('phone_nr'), interestingEvents, Ads.onFormEdit);
  2924. 2922.  -   destroy.push(function(){ cleanElems(ge('phone_nr')); });
  2925. 2923.  -   addEvent(ge('clients_nr'), interestingEvents, Ads.onFormEdit);
  2926. 2924.  -   destroy.push(function(){ cleanElems(ge('clients_nr')); });
  2927. 2925.  -   addEvent(ge('message_nr'), interestingEvents, Ads.onFormEdit);
  2928. 2926.  -   destroy.push(function(){ cleanElems(ge('message_nr')); });
  2929. 2927.  -
  2930. 2928.  -   function getAllCountries() {
  2931. 2929.  -     function onDone(response) {
  2932. 2930.  -       if (response && isArray(response.countries)) {
  2933. 2931.  -         response.countries.splice(0, 1);
  2934. 2932.  -         uiCountry.setData(response.countries);
  2935. 2933.  -         uiCountry.val('');
  2936. 2934.  -         uiCity.clear();
  2937. 2935.  -         uiCity.setOptions({defaultItems: []});
  2938. 2936.  -       }
  2939. 2937.  -     }
  2940. 2938.  -     ajax.post('/ads?act=a_get_countries', {}, {onDone: onDone});
  2941. 2939.  -   }
  2942. 2940.  - }
  2943. 2941.  -
  2944. 2942.  - Ads.sendContactsForm = function(button) {
  2945. 2943.  -   if (!Ads.lock('sendContactsForm', onLock, onUnlock)) {
  2946. 2944.  -     return false;
  2947. 2945.  -   }
  2948. 2946.  -
  2949. 2947.  -   var ajaxParams = extend({}, cur.contacts.ajaxParams);
  2950. 2948.  -   ajaxParams.country  = ge('country').value;
  2951. 2949.  -   ajaxParams.city     = ge('city').value;
  2952. 2950.  -   ajaxParams.agency   = ge('agency').value;
  2953. 2951.  -   ajaxParams.dating   = ge('dating').value;
  2954. 2952.  -   ajaxParams.medicine = ge('medicine').value;
  2955. 2953.  -   ajaxParams = extend(ajaxParams, serializeForm(ge(ajaxParams.country == 1 ? 'ads_contacts_form_rus' : 'ads_contacts_form_nonresident')));
  2956. 2954.  -
  2957. 2955.  -   ajax.post('/ads?act=a_send_contacts', ajaxParams, {onDone: onDone, onFail: onDone});
  2958. 2956.  -
  2959. 2957.  -   function onDone(response) {
  2960. 2958.  -     Ads.unlock('sendContactsForm');
  2961. 2959.  -     if (!response || !response.result) {
  2962. 2960.  -       if (!response || !response.msg) {
  2963. 2961.  -         tryErrorBox(getLang('ads_error_unexpected_error_try_later'));
  2964. 2962.  -       } else {
  2965. 2963.  -         tryErrorBox(response.msg);
  2966. 2964.  -       }
  2967. 2965.  -       return true;
  2968. 2966.  -     }
  2969. 2967.  -     ge('ads_contacts_form').innerHTML = response.msg;
  2970. 2968.  -   }
  2971. 2969.  -   function tryErrorBox(message) {
  2972. 2970.  -     showFastBox(getLang('global_error'), message);
  2973. 2971.  -   }
  2974. 2972.  -   function onLock() {
  2975. 2973.  -     lockButton(button);
  2976. 2974.  -   }
  2977. 2975.  -   function onUnlock() {
  2978. 2976.  -     unlockButton(button);
  2979. 2977.  -   }
  2980. 2978.  - }
  2981. 2979.  -
  2982. 2980.  - try{stManager.done('ads.js');}catch(e){}
  2983. ------
  2984. Файл - dev.css (Старый размер - 16113 | Новый - 0):
  2985. 0.  - #dev_css {
  2986. 1.  -   display: none;
  2987. 2.  - }
  2988. 3.  - .dev_app {
  2989. 4.  -   width: 200px;
  2990. 5.  -   padding: 6px;
  2991. 6.  -   display: block;
  2992. 7.  -   height: 30px;
  2993. 8.  -   overflow: hidden;
  2994. 9.  -   text-overflow: ellipsis;
  2995. 10.  - }
  2996. 11.  - .dev_app:hover {
  2997. 12.  -   text-decoration: none;
  2998. 13.  -   background: #F7F7F7;
  2999. 14.  - }
  3000. 15.  -
  3001. 16.  - .dev_app:active {
  3002. 17.  -   background: #F1F1F1;
  3003. 18.  - }
  3004. 19.  - .dev_app_img {
  3005. 20.  -   width: 30px;
  3006. 21.  -   height: 30px;
  3007. 22.  -   position: absolute;
  3008. 23.  -   vertical-align: middle;
  3009. 24.  - }
  3010. 25.  - .dev_app_info {
  3011. 26.  -   padding-left: 40px;
  3012. 27.  - }
  3013. 28.  - .dev_app_name {
  3014. 29.  -   display: block;
  3015. 30.  -   color: #2B587A;
  3016. 31.  -   font-weight: bold;
  3017. 32.  -   line-height: 1.09em;
  3018. 33.  - }
  3019. 34.  - .dev_app_line {
  3020. 35.  -   display: inline-block;
  3021. 36.  -   color: #888;
  3022. 37.  -   padding-top: 4px;
  3023. 38.  - }
  3024. 39.  -
  3025. 40.  - .dev_app_line:hover {
  3026. 41.  -   text-decoration: underline;
  3027. 42.  - }
  3028. 43.  - .dev_sett_block {
  3029. 44.  -   background: #F1F5F8;
  3030. 45.  -   padding: 10px;
  3031. 46.  -   margin: 15px 0px 20px;
  3032. 47.  -   border-left: 4px solid #cad8e4;
  3033. 48.  - }
  3034. 49.  - .dev_page {
  3035. 50.  -   padding: 0px;
  3036. 51.  -   line-height: 160%;
  3037. 52.  - }
  3038. 53.  - .dev_header {
  3039. 54.  -   background: #edf1f5;
  3040. 55.  -   padding: 8px 10px 9px;
  3041. 56.  - }
  3042. 57.  - .dev_mlist_name {
  3043. 58.  -   display: block;
  3044. 59.  -   background: #e9e9e9;
  3045. 60.  -   padding: 6px;
  3046. 61.  -   color: #737373;
  3047. 62.  -   font-weight: bold;
  3048. 63.  -   margin: 6px 10px 0px;
  3049. 64.  -
  3050. 65.  - }
  3051. 66.  - .dev_mlist_name:hover {
  3052. 67.  -   background: #e1e1e1;
  3053. 68.  -   text-decoration: none;
  3054. 69.  - }
  3055. 70.  - .dev_mlist_name:active {
  3056. 71.  -   background: #2B587A;
  3057. 72.  -   color: #FFFFFF;
  3058. 73.  -   text-decoration: none;
  3059. 74.  - }
  3060. 75.  - .dev_mlist_item {
  3061. 76.  -   display: block;
  3062. 77.  -   padding: 4px 10px 5px 10px;
  3063. 78.  -   overflow: hidden;
  3064. 79.  -   text-overflow: ellipsis;
  3065. 80.  - }
  3066. 81.  - .is_rtl1 .dev_mlist_item {
  3067. 82.  -   padding: 4px 10px 5px 24px;
  3068. 83.  - }
  3069. 84.  - .dev_mlist_item:hover {
  3070. 85.  -   text-decoration: none;
  3071. 86.  -   background: #E0E5E9;
  3072. 87.  - }
  3073. 88.  - #dev_edit_desc, #dev_edit_res, #dev_edit_fulldesc, #dev_edit_params_info {
  3074. 89.  -   width: 507px;
  3075. 90.  - }
  3076. 91.  - #dev_edit_fulldesc {
  3077. 92.  -   width: 507px;
  3078. 93.  -   margin-top: 4px;
  3079. 94.  - }
  3080. 95.  - .dev_res_header {
  3081. 96.  -   margin-top: 10px;
  3082. 97.  - }
  3083. 98.  - .dev_method_buttons {
  3084. 99.  -   text-align: center;
  3085. 100.  -   padding: 10px;
  3086. 101.  - }
  3087. 102.  - .dev_const {
  3088. 103.  -   padding: 10px 0px;
  3089. 104.  - }
  3090. 105.  - .dev_params {
  3091. 106.  -   margin-top: 10px;
  3092. 107.  - }
  3093. 108.  - .dev_params_desc_cont {
  3094. 109.  -   width: 200px;
  3095. 110.  - }
  3096. 111.  - .dev_params_desc {
  3097. 112.  -   width: 192px;
  3098. 113.  - }
  3099. 114.  - .dev_textarea {
  3100. 115.  -   border: none;
  3101. 116.  -   outline: none;
  3102. 117.  -   resize: none;
  3103. 118.  -   background: #F7F7F7;
  3104. 119.  -   padding: 6px;
  3105. 120.  - }
  3106. 121.  - input.dev_input {
  3107. 122.  -   border: none;
  3108. 123.  -   outline: none;
  3109. 124.  -   resize: none;
  3110. 125.  -   background: none;
  3111. 126.  -   padding: 0px;
  3112. 127.  - }
  3113. 128.  - input.dev_input_simular {
  3114. 129.  -   border: none;
  3115. 130.  -   outline: none;
  3116. 131.  -   resize: none;
  3117. 132.  -   background: none;
  3118. 133.  -   background: #F7F7F7;
  3119. 134.  -   padding: 6px;
  3120. 135.  - }
  3121. 136.  - .dev_main_head {
  3122. 137.  -   padding: 20px 10px 20px 40px;
  3123. 138.  -   background: #edf1f5;
  3124. 139.  -
  3125. 140.  -   -webkit-box-shadow: inset 0 -4px 2px -2px rgba(0,0,0,0.03);
  3126. 141.  -   -moz-box-shadow: inset 0 -4px 2px -2px rgba(0,0,0,0.03);
  3127. 142.  -   box-shadow: inset 0 -4px 2px -2px rgba(0,0,0,0.03);
  3128. 143.  - }
  3129. 144.  - .dev_main_header {
  3130. 145.  -   color: #5c7b9b;
  3131. 146.  -   font-weight: bold;
  3132. 147.  -   font-size: 1.3em;
  3133. 148.  - }
  3134. 149.  - .dev_main_desc {
  3135. 150.  -   margin-top: 15px;
  3136. 151.  -   line-height: 160%;
  3137. 152.  - }
  3138. 153.  - .dev_main_narrow {
  3139. 154.  -   width: 180px;
  3140. 155.  -   height: 100px;
  3141. 156.  -   padding: 35px 38px 0px 38px;
  3142. 157.  -   text-align: center;
  3143. 158.  - }
  3144. 159.  - .dev_create_app_btn {
  3145. 160.  -   margin-bottom: 15px;
  3146. 161.  - }
  3147. 162.  - .dev_main_sections {
  3148. 163.  -   padding-top: 20px;
  3149. 164.  -   padding-bottom: 25px;
  3150. 165.  - }
  3151. 166.  - .dev_sect {
  3152. 167.  -   display: block;
  3153. 168.  -   width: 168px;
  3154. 169.  -   height: 142px;
  3155. 170.  -   padding: 10px;
  3156. 171.  -   background: #f7f9fb;
  3157. 172.  -   -webkit-border-radius: 3px;
  3158. 173.  -   -moz-border-radius: 3px;
  3159. 174.  -   border-radius: 3px;
  3160. 175.  -   position: absolute;
  3161. 176.  -   -webkit-box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.2);
  3162. 177.  -   -moz-box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.2);
  3163. 178.  -   box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.2);
  3164. 179.  -   color: #5c7b9b;
  3165. 180.  -   text-align: center;
  3166. 181.  -   font-weight: bold;
  3167. 182.  -   font-size: 1.2em;
  3168. 183.  -   line-height: 160%;
  3169. 184.  -
  3170. 185.  -   -webkit-transition: all 200ms ease-out;
  3171. 186.  -   -moz-transition: all 200ms ease-out;
  3172. 187.  -   -o-transition: all 200ms ease-out;
  3173. 188.  -   transition: all 200ms ease-out;
  3174. 189.  - }
  3175. 190.  - .dev_sect:hover {
  3176. 191.  -   text-decoration: none;
  3177. 192.  -   background: #fafafc;
  3178. 193.  -   margin-top: -8px;
  3179. 194.  -   -webkit-box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.15);
  3180. 195.  -   -moz-box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.15);
  3181. 196.  -   box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.15);
  3182. 197.  - }
  3183. 198.  - .dev_sect_games {
  3184. 199.  - }
  3185. 200.  - .dev_sect_standalone {
  3186. 201.  -   margin-left: 233px;
  3187. 202.  - }
  3188. 203.  - .dev_sect_widgets {
  3189. 204.  -   margin-left: 468px;
  3190. 205.  - }
  3191. 206.  - .dev_main_cont {
  3192. 207.  -   line-height: 160%;
  3193. 208.  -   padding-top: 130px;
  3194. 209.  - }
  3195. 210.  - .dev_sect_icon {
  3196. 211.  -   width: 95px;
  3197. 212.  -   height: 83px;
  3198. 213.  -   margin: 8px 35px 10px;
  3199. 214.  -   background: url('/images/icons/dev_icons.png') no-repeat;
  3200. 215.  - }
  3201. 216.  - .dev_sect_standalone .dev_sect_icon {
  3202. 217.  -   background-position: 0px -82px;
  3203. 218.  - }
  3204. 219.  - .dev_sect_widgets .dev_sect_icon {
  3205. 220.  -   background-position: 0px -163px;
  3206. 221.  - }
  3207. 222.  - .dev_header_name {
  3208. 223.  -   color: #607387;
  3209. 224.  -   font-weight: bold;
  3210. 225.  -   font-size: 1.1em;
  3211. 226.  - }
  3212. 227.  - .dev_raquo_parents {
  3213. 228.  -   color: #2B587A;
  3214. 229.  - }
  3215. 230.  - #dev_edit_name {
  3216. 231.  -   color: #2B587A;
  3217. 232.  -   font-weight: bold;
  3218. 233.  -   font-size: 1em;
  3219. 234.  -   width: 450px;
  3220. 235.  -   padding: 0px;
  3221. 236.  - }
  3222. 237.  - .dev_page_cont {
  3223. 238.  -   width: 520px;
  3224. 239.  -   padding: 16px 10px 16px 16px;
  3225. 240.  - }
  3226. 241.  - #dev_edit_text, #dev_edit_text_en, #dev_edit_ver_text, #dev_edit_ver_text_en {
  3227. 242.  -   width: 507px;
  3228. 243.  -   line-height: 160%;
  3229. 244.  - }
  3230. 245.  - #dev_edit_simular {
  3231. 246.  -   width: 507px;
  3232. 247.  -   line-height: 160%;
  3233. 248.  - }
  3234. 249.  - .dev_sel_section_cont {
  3235. 250.  -   padding: 10px 0px 0px 0px;
  3236. 251.  - }
  3237. 252.  - .dev_sel_section {
  3238. 253.  -   margin-right: 8px;
  3239. 254.  - }
  3240. 255.  - #dev_sections_progress {
  3241. 256.  -   margin-top: 3px;
  3242. 257.  - }
  3243. 258.  - .dev_param_name {
  3244. 259.  -   vertical-align: top;
  3245. 260.  -   min-width: 100px;
  3246. 261.  -   font-weight: bold;
  3247. 262.  -   overflow: hidden;
  3248. 263.  -   text-overflow: ellipsis;
  3249. 264.  - }
  3250. 265.  - .dev_params_desc {
  3251. 266.  -   width: 407px;
  3252. 267.  - }
  3253. 268.  - .dev_param_desc {
  3254. 269.  -   padding-bottom: 10px;
  3255. 270.  -   padding-left: 10px;
  3256. 271.  - }
  3257. 272.  - .dev_param_opts {
  3258. 273.  -   color: #888888;
  3259. 274.  - }
  3260. 275.  - .dev_sidebar {
  3261. 276.  -   margin: 12px 12px 12px 2px;
  3262. 277.  -   background: #F0F2F4;
  3263. 278.  -   width: 156px;
  3264. 279.  -   padding: 10px;
  3265. 280.  - }
  3266. 281.  - .dev_parts_list {
  3267. 282.  -   width: 472px;
  3268. 283.  -   padding: 20px 0px 20px 20px;
  3269. 284.  - }
  3270. 285.  - .dev_part {
  3271. 286.  -   display: block;
  3272. 287.  -   padding: 15px 20px;
  3273. 288.  - }
  3274. 289.  - .dev_part:hover {
  3275. 290.  -   text-decoration: none;
  3276. 291.  -   background: #F7F7F7;
  3277. 292.  - }
  3278. 293.  - .dev_part_name {
  3279. 294.  -   display: block;
  3280. 295.  -   padding-bottom: 8px;
  3281. 296.  -   color: #4d7199;
  3282. 297.  -   font-weight: bold;
  3283. 298.  -   font-size: 1.2em;
  3284. 299.  - }
  3285. 300.  - .dev_part_desc {
  3286. 301.  -   color: #808080;
  3287. 302.  - }
  3288. 303.  - .dev_result_obj {
  3289. 304.  -   padding-left: 15px;
  3290. 305.  - }
  3291. 306.  - .dev_result_key {
  3292. 307.  -   color: #000000;
  3293. 308.  - }
  3294. 309.  - .dev_result_num {
  3295. 310.  -   color: #0000CD;
  3296. 311.  - }
  3297. 312.  - .dev_result_bool {
  3298. 313.  -   color: #585CF6;
  3299. 314.  - }
  3300. 315.  - .dev_result_str,
  3301. 316.  - .dev_result_str a {
  3302. 317.  -   color: #036A07;
  3303. 318.  - }
  3304. 319.  - .dev_result_bracket {
  3305. 320.  -   color: #000000;
  3306. 321.  - }
  3307. 322.  - .dev_translate_date {
  3308. 323.  -   display: inline-block;
  3309. 324.  -   *display: inline;
  3310. 325.  -   zoom: 1;
  3311. 326.  -   color: #777777;
  3312. 327.  - }
  3313. 328.  - .dev_not_translated {
  3314. 329.  -   background: #EDF1F5;
  3315. 330.  - }
  3316. 331.  - .dev_translated_row {
  3317. 332.  -   display: block;
  3318. 333.  -   padding: 10px;
  3319. 334.  -   margin: 4px;
  3320. 335.  - }
  3321. 336.  - .dev_translated_row:hover {
  3322. 337.  -   text-decoration: none;
  3323. 338.  - }
  3324. 339.  - .dev_translated_name {
  3325. 340.  -   font-weight: bold;
  3326. 341.  - }
  3327. 342.  - .dev_translate_pic {
  3328. 343.  -   width: 27px;
  3329. 344.  -   height: 27px;
  3330. 345.  -   margin-top: -5px;
  3331. 346.  -   margin-right: -4px;
  3332. 347.  -   margin-left: 10px;
  3333. 348.  - }
  3334. 349.  - .dev_const_params {
  3335. 350.  -   width: 125px;
  3336. 351.  -   margin: 0px 0px 10px 0px;
  3337. 352.  -   padding: 8px;
  3338. 353.  -   background: #E4ECF4;
  3339. 354.  - }
  3340. 355.  - .dev_req_result {
  3341. 356.  -   background: #F1F5F8;
  3342. 357.  -   padding: 10px 15px 10px 0px;
  3343. 358.  -   margin: 0px 0px 20px;
  3344. 359.  -   width: 363px;
  3345. 360.  - }
  3346. 361.  - #dev_result {
  3347. 362.  -   word-break: break-all;
  3348. 363.  -   font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  3349. 364.  - }
  3350. 365.  - .dev_req_run_btn {
  3351. 366.  -   width: 124px;
  3352. 367.  - }
  3353. 368.  - .dev_req_run {
  3354. 369.  -   margin-top: 10px;
  3355. 370.  - }
  3356. 371.  - .dev_info_header {
  3357. 372.  -   display: block;
  3358. 373.  -   color: #4d7199;
  3359. 374.  -   font-weight: bold;
  3360. 375.  -   font-size: 1.2em;
  3361. 376.  -   border-bottom: 1px solid #DAE2E8;
  3362. 377.  -   margin-bottom: 8px;
  3363. 378.  - }
  3364. 379.  - .dev_last_news {
  3365. 380.  -   padding: 14px 16px 20px 16px;
  3366. 381.  -   width: 200px;
  3367. 382.  - }
  3368. 383.  - .dev_platform_info {
  3369. 384.  -   margin-top: 20px;
  3370. 385.  -   width: 200px;
  3371. 386.  -   padding: 15px 16px;
  3372. 387.  - }
  3373. 388.  - .dev_api_status_good {
  3374. 389.  -   color: #038A07;
  3375. 390.  -   font-weight: bold;
  3376. 391.  - }
  3377. 392.  - .dev_api_status_bad {
  3378. 393.  -   color: #8A0307;
  3379. 394.  -   font-weight: bold;
  3380. 395.  - }
  3381. 396.  - .dev_news_row_date {
  3382. 397.  -   color: #999999;
  3383. 398.  -   font-size: 0.8em;
  3384. 399.  - }
  3385. 400.  - .dev_news_row {
  3386. 401.  -   display: block;
  3387. 402.  -   border-bottom: 1px solid #F1F1F1;
  3388. 403.  -   padding: 2px 0px 2px 25px;
  3389. 404.  -   background: url("/images/note.gif") no-repeat scroll 1px 6px;
  3390. 405.  - }
  3391. 406.  - .dev_news_row:hover {
  3392. 407.  -   text-decoration: none;
  3393. 408.  -   background-color: #F7F7F7;
  3394. 409.  - }
  3395. 410.  - .dev_info_link {
  3396. 411.  -   margin-top: 4px;
  3397. 412.  -   display: block;
  3398. 413.  -   padding: 4px 0px 4px 25px;
  3399. 414.  - }
  3400. 415.  - .dev_info_link:hover {
  3401. 416.  -   text-decoration: none;
  3402. 417.  -   background: #F7F7F7;
  3403. 418.  - }
  3404. 419.  - .dev_section_menu_cont {
  3405. 420.  -   padding-bottom: 6px;
  3406. 421.  -   margin-bottom: 6px;
  3407. 422.  -   border-bottom: 1px solid #E0E5E9;
  3408. 423.  -   margin-top: 10px;
  3409. 424.  - }
  3410. 425.  - #dev_section_menu {
  3411. 426.  -   display: block;
  3412. 427.  -   font-weight: bold;
  3413. 428.  -   padding: 4px 10px 5px;
  3414. 429.  -   width: 136px;
  3415. 430.  -   background: url(/images/flydead.gif) no-repeat 135px 8px;
  3416. 431.  -   white-space: nowrap;
  3417. 432.  -   color: #45688E;
  3418. 433.  - }
  3419. 434.  - #dev_section_menu:hover {
  3420. 435.  -   text-decoration: none;
  3421. 436.  -   background-color: #E0E5E9;
  3422. 437.  - }
  3423. 438.  - .dev_section_dd .dd_menu_header {
  3424. 439.  -   margin: 3px 0px 0px 6px;
  3425. 440.  - }
  3426. 441.  - .dev_section_dd .dd_menu_body {
  3427. 442.  -   margin-left: 5px;
  3428. 443.  -   margin-top: 3px;
  3429. 444.  - }
  3430. 445.  - .dev_section_dd .dd_menu_rows a {
  3431. 446.  -   padding-left: 10px;
  3432. 447.  - }
  3433. 448.  - .dev_section_dd .dd_menu_header div {
  3434. 449.  -   font-weight: bold;
  3435. 450.  -   padding: 4px 9px 5px;
  3436. 451.  -   width: 134px;
  3437. 452.  -   background: #6D8FB3 url(/images/flydead.gif) no-repeat 134px -12px;
  3438. 453.  - }
  3439. 454.  - .dev_sect_load {
  3440. 455.  -   height: 17px;
  3441. 456.  -   margin-left: 122px;
  3442. 457.  - }
  3443. 458.  - .dev_deprecated {
  3444. 459.  -   padding: 10px;
  3445. 460.  -   background: #FFEEEE;
  3446. 461.  -   border-left: 4px solid #EACCCC;
  3447. 462.  -   margin-top: 2px;
  3448. 463.  -   margin-bottom: 12px;
  3449. 464.  - }
  3450. 465.  - input.dev_section_search {
  3451. 466.  -   background: #FFF url(/images/magglass.png) no-repeat 5px 7px;
  3452. 467.  -   outline: none;
  3453. 468.  -   width: 94px;
  3454. 469.  -   padding: 6px 40px 6px 20px;
  3455. 470.  - }
  3456. 471.  - .is_2x input.dev_section_search {
  3457. 472.  -   background-image: url(/images/magglass_2x.png);
  3458. 473.  -   background-size: 11px 11px;
  3459. 474.  - }
  3460. 475.  - #dev_search_suggest {
  3461. 476.  -   margin-top: -10px;
  3462. 477.  -   position: relative;
  3463. 478.  -   display: none;
  3464. 479.  -   width: 154px;
  3465. 480.  -   border: solid #C0CAD5;
  3466. 481.  -   border-width: 0px 1px 1px;
  3467. 482.  -   background: #FFFFFF;
  3468. 483.  -   position: absolute;
  3469. 484.  -   -webkit-box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.1);
  3470. 485.  -   -moz-box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.1);
  3471. 486.  -   box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.1);
  3472. 487.  - }
  3473. 488.  - #dev_search_suggest_list {
  3474. 489.  -   overflow: hidden;
  3475. 490.  -   max-height: 250px;
  3476. 491.  - }
  3477. 492.  - .dev_search_row {
  3478. 493.  -   display: block;
  3479. 494.  -   padding: 4px 10px;
  3480. 495.  -   overflow: hidden;
  3481. 496.  -   text-overflow: ellipsis;
  3482. 497.  - }
  3483. 498.  - .dev_search_row:hover {
  3484. 499.  -   text-decoration: none;
  3485. 500.  - }
  3486. 501.  - .dev_sugg_sel {
  3487. 502.  -   background: #E4ECF4;
  3488. 503.  - }
  3489. 504.  - .dev_search_row em {
  3490. 505.  -   background: #E0E5F0;
  3491. 506.  -   padding: 2px 0px;
  3492. 507.  -   margin: -2px 0px;
  3493. 508.  -   font-style: normal;
  3494. 509.  - }
  3495. 510.  - .dev_sugg_sel em {
  3496. 511.  -   background: #5e82a8;
  3497. 512.  -   color: #FFFFFF;
  3498. 513.  - }
  3499. 514.  - .dev_methods_sect_rows {
  3500. 515.  -   padding: 10px 0px 10px 0px;
  3501. 516.  - }
  3502. 517.  - .dev_methods_list_row {
  3503. 518.  -   display: block;
  3504. 519.  -   margin: 4px 0px 4px;
  3505. 520.  -   padding: 4px 0px;
  3506. 521.  -   cursor: pointer;
  3507. 522.  - }
  3508. 523.  - .dev_methods_list_row:hover {
  3509. 524.  -   text-decoration: none;
  3510. 525.  -   background: #F7F7F7;
  3511. 526.  - }
  3512. 527.  - .dev_methods_list_name {
  3513. 528.  -   display: block;
  3514. 529.  -   width: 150px;
  3515. 530.  -   padding: 2px 5px;
  3516. 531.  -   overflow: hidden;
  3517. 532.  -   text-overflow: ellipsis;
  3518. 533.  - }
  3519. 534.  - .dev_methods_list_desc {
  3520. 535.  -   color: #000000;
  3521. 536.  -   width: 350px;
  3522. 537.  -   padding: 2px 5px;
  3523. 538.  - }
  3524. 539.  - .dev_page_cont .wk_header {
  3525. 540.  -   border-bottom: none;
  3526. 541.  -   font-size: 1.2em;
  3527. 542.  -   margin-bottom: 12px;
  3528. 543.  - }
  3529. 544.  - .dev_section_menu, .dev_section_submenu {
  3530. 545.  -   display: block;
  3531. 546.  -   padding: 4px 8px 5px 8px;
  3532. 547.  -   overflow: hidden;
  3533. 548.  -   text-overflow: ellipsis;
  3534. 549.  - }
  3535. 550.  - .dev_section_menu {
  3536. 551.  -   margin-top: 10px;
  3537. 552.  -   font-weight: bold;
  3538. 553.  - }
  3539. 554.  - .dev_section_menu:hover, .dev_section_submenu:hover {
  3540. 555.  -   text-decoration: none;
  3541. 556.  -   background: #E0E5E9;
  3542. 557.  - }
  3543. 558.  - .dev_section_submenu {
  3544. 559.  -   padding-left: 20px;
  3545. 560.  - }
  3546. 561.  - .is_rtl1 .dev_section_submenu {
  3547. 562.  -   padding-right: 20px;
  3548. 563.  - }
  3549. 564.  - .dev_mlist_sel {
  3550. 565.  -   background: #5e82a8;
  3551. 566.  -   color: #FFFFFF;
  3552. 567.  -
  3553. 568.  - }
  3554. 569.  - .dev_mlist_sel:hover {
  3555. 570.  -   background: #5e82a8;
  3556. 571.  - }
  3557. 572.  - .dev_methods_sect_simular {
  3558. 573.  -   padding-top: 2px;
  3559. 574.  - }
  3560. 575.  - .dev_method_fulldesc {
  3561. 576.  -   padding-top: 10px;
  3562. 577.  - }
  3563. 578.  - .dev_methods_list_span:hover {
  3564. 579.  -   text-decoration: underline;
  3565. 580.  - }
  3566. 581.  - .dev_methods_list_min {
  3567. 582.  -   width: 507px;
  3568. 583.  -   height: 9px !important;
  3569. 584.  -   padding-top: 0px;
  3570. 585.  -   padding-bottom: 0px;
  3571. 586.  -   margin: none;
  3572. 587.  -   overflow: hidden;
  3573. 588.  -   cursor: pointer;
  3574. 589.  -   background: #F1F1F1;
  3575. 590.  -   padding: 0px 6px;
  3576. 591.  - }
  3577. 592.  - .dev_methods_list_max {
  3578. 593.  -   width: 507px;
  3579. 594.  -   background: #F1F1F1;
  3580. 595.  -   padding: 6px;
  3581. 596.  - }
  3582. 597.  - #dev_widget_preview {
  3583. 598.  -   margin: 20px 0;
  3584. 599.  - }
  3585. 600.  - #dev_edit_form {
  3586. 601.  -   background-color: #F0F2F4;
  3587. 602.  -   padding: 20px 20px 10px;
  3588. 603.  -   margin: 20px 0px 0px;
  3589. 604.  - }
  3590. 605.  - .dev_labeled {
  3591. 606.  -   float: left;
  3592. 607.  -   width: 200px;
  3593. 608.  - }
  3594. 609.  - .dev_row {
  3595. 610.  -   clear: left;
  3596. 611.  -   padding-top: 5px;
  3597. 612.  - }
  3598. 613.  - .dev_label {
  3599. 614.  -   float: left;
  3600. 615.  -   width: 150px;
  3601. 616.  -   text-align: right;
  3602. 617.  -   vertical-align: top;
  3603. 618.  -   color: #777;
  3604. 619.  -   padding: 4px 10px 0 0;
  3605. 620.  - }
  3606. 621.  - .dev_widget_fulldoc {
  3607. 622.  -   display: block;
  3608. 623.  -   background: #F0F2F4;
  3609. 624.  -   padding: 14px;
  3610. 625.  -   padding-left: 180px;
  3611. 626.  - }
  3612. 627.  - .dev_widget_fulldoc:hover {
  3613. 628.  -   background: #E0E5E9;
  3614. 629.  -   text-decoration: none;
  3615. 630.  - }
  3616. 631.  - input.dev_constructor_input {
  3617. 632.  -   margin: 2px 0px 2px 0px;
  3618. 633.  - }
  3619. 634.  - #dev_community_wide_cont {
  3620. 635.  -   margin-top: 10px;
  3621. 636.  - }
  3622. 637.  - input.dev_poll_field {
  3623. 638.  -   margin-top: 2px;
  3624. 639.  -   margin-bottom: 2px;
  3625. 640.  - }
  3626. 641.  - input.dev_poll_answer {
  3627. 642.  -   width: 192px;
  3628. 643.  -   margin-top: 2px;
  3629. 644.  -   margin-bottom: 2px;
  3630. 645.  - }
  3631. 646.  - textarea.dev_poll_code {
  3632. 647.  -   background-color: #F0F4FB;
  3633. 648.  -   width: 286px;
  3634. 649.  -   height: 155px;
  3635. 650.  - }
  3636. 651.  - .poll_answers {
  3637. 652.  -   width: 200px;
  3638. 653.  - }
  3639. 654.  - .dev_result_highlight .dev_result_bracket,
  3640. 655.  - .dev_result_highlight .dev_result_lbracket {
  3641. 656.  -   color: #FF0000;
  3642. 657.  - }
  3643. 658.  -
  3644. 659.  - .dev_result_highlight .dev_result_block .dev_result_bracket,
  3645. 660.  - .dev_result_highlight .dev_result_block .dev_result_lbracket {
  3646. 661.  -   color: #000000;
  3647. 662.  - }
  3648. 663.  - .dev_result_block {
  3649. 664.  -   cursor:pointer;
  3650. 665.  - }
  3651. 666.  - .dev_colorbox_cont {
  3652. 667.  -   display: inline-block;
  3653. 668.  -   *display: inline;
  3654. 669.  -   zoom: 1;
  3655. 670.  -   padding: 3px 4px;
  3656. 671.  -   vertical-align: top;
  3657. 672.  -   height: 19px;
  3658. 673.  -   width: 19px;
  3659. 674.  - }
  3660. 675.  - .dev_colorbox {
  3661. 676.  -   display: inline-block;
  3662. 677.  -   *display: inline;
  3663. 678.  -   zoom: 1;
  3664. 679.  -   width: 19px;
  3665. 680.  -   -webkit-border-radius: 10px;
  3666. 681.  -   -moz-border-radius: 10px;
  3667. 682.  -   border-radius: 10px;
  3668. 683.  -   height: 19px;
  3669. 684.  -   pointer-events: none;
  3670. 685.  - }
  3671. 686.  - .dev_page_settings_act {
  3672. 687.  -   display: inline-block;
  3673. 688.  -   *display: inline;
  3674. 689.  -   zoom: 1;
  3675. 690.  -   vertical-align: top;
  3676. 691.  -   padding: 5px 14px;
  3677. 692.  - }
  3678. 693.  - .dev_match {
  3679. 694.  -   background: #E1E7ED;
  3680. 695.  -   border-bottom: 1px solid #DAE1E8;
  3681. 696.  -   margin: 0px;
  3682. 697.  -   padding: 0px 1px;
  3683. 698.  - }
  3684. 699.  - .dev_search_match_row {
  3685. 700.  -   color: #000000;
  3686. 701.  -   display: block;
  3687. 702.  -   padding: 10px;
  3688. 703.  - }
  3689. 704.  - .dev_search_match_row:hover {
  3690. 705.  -   background: #F7F7F7;
  3691. 706.  -   text-decoration: none;
  3692. 707.  - }
  3693. 708.  - .dev_search_header {
  3694. 709.  -   font-weight: bold;
  3695. 710.  -   color: #2B587A;
  3696. 711.  - }
  3697. 712.  -
  3698. 713.  - .dev_search_header:hover {
  3699. 714.  -   text-decoration: underline;
  3700. 715.  - }
  3701. 716.  - .dev_search_empty {
  3702. 717.  -   font-size: 1.2em;
  3703. 718.  -   text-align: center;
  3704. 719.  -   color: #777777;
  3705. 720.  -   padding: 50px 10px;
  3706. 721.  - }
  3707. 722.  - #vk_groups {
  3708. 723.  -   margin-left: -10px;
  3709. 724.  - }
  3710. 725.  - .dev_main_widget_cont {
  3711. 726.  -   height: 242px;
  3712. 727.  -   overflow: hidden;
  3713. 728.  - }
  3714. 729.  - .dev_report_bug {
  3715. 730.  -   padding: 0px 10px;
  3716. 731.  -   text-align: center;
  3717. 732.  - }
  3718. 733.  - .dev_report_bug a {
  3719. 734.  -   color: #808080;
  3720. 735.  - }
  3721. 736.  - .dev_colorpicker {
  3722. 737.  -   width: 200px;
  3723. 738.  -   height: 200px;
  3724. 739.  - }
  3725. 740.  - .ttb.dev_tt_to_left .toup1 .bottom_pointer {
  3726. 741.  -   background-position: 0px 0px;
  3727. 742.  -   width: 5px;
  3728. 743.  -   height: 9px;
  3729. 744.  -   float: none;
  3730. 745.  -   position: absolute;
  3731. 746.  -   margin-left: -5px;
  3732. 747.  -   margin-top: -20px;
  3733. 748.  - }
  3734. 749.  - .dev_tt_to_left .ttb_cont {
  3735. 750.  -   -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  3736. 751.  -    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  3737. 752.  -    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  3738. 753.  - }
  3739. 754.  - #dev_colorpicker {
  3740. 755.  -   position: absolute;
  3741. 756.  -   margin-left: 265px;
  3742. 757.  - }
  3743. 758.  - #dev_palette {
  3744. 759.  -   position: absolute;
  3745. 760.  -   margin-left: 180px;
  3746. 761.  -   cursor: pointer;
  3747. 762.  -   -webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.25);
  3748. 763.  -   -moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.25);
  3749. 764.  -   box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.25);
  3750. 765.  - }
  3751. 766.  - #dev_colors {
  3752. 767.  -   position: absolute;
  3753. 768.  -   cursor: pointer;
  3754. 769.  -   -webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.25);
  3755. 770.  -   -moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.25);
  3756. 771.  -   box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.25);
  3757. 772.  - }
  3758. 773.  - #dev_picker1 {
  3759. 774.  -   position: absolute;
  3760. 775.  -   margin-left: 178px;
  3761. 776.  -   width: 22px;
  3762. 777.  -   height: 1px;
  3763. 778.  -   border: 1px solid #FFFFFF;
  3764. 779.  -   margin-top: 40px;
  3765. 780.  -   background: rgba(255,255,255,0.7);
  3766. 781.  -   pointer-events: none;
  3767. 782.  -   -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  3768. 783.  -   -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  3769. 784.  -   box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  3770. 785.  - }
  3771. 786.  - #dev_picker2 {
  3772. 787.  -   position: absolute;
  3773. 788.  -   margin-left: 40px;
  3774. 789.  -   width: 8px;
  3775. 790.  -   height: 8px;
  3776. 791.  -   border: 2px solid #FFFFFF;
  3777. 792.  -   margin-top: 40px;
  3778. 793.  -   -webkit-border-radius: 8px;
  3779. 794.  -   -moz-border-radius: 8px;
  3780. 795.  -   border-radius: 8px;
  3781. 796.  -   pointer-events: none;
  3782. 797.  -   -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  3783. 798.  -   -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  3784. 799.  -   box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  3785. 800.  - }
  3786. 801.  - .dev_colors_grad {
  3787. 802.  -   vertical-align: top;
  3788. 803.  - }
  3789. 804.  - .dev_colorpicker_title {
  3790. 805.  -   padding-bottom: 4px;
  3791. 806.  - }
  3792. 807.  - .dev_form_no_params {
  3793. 808.  -   text-align: center;
  3794. 809.  -   color: #607387;
  3795. 810.  -   margin-bottom: 10px;
  3796. 811.  - }
  3797. 812.  - #dev_page_cont textarea.dev_editor_textarea,
  3798. 813.  - #dev_page_cont .dev_editor_cont {
  3799. 814.  -   padding: 6px;
  3800. 815.  -   font-size: 1em;
  3801. 816.  - }
  3802. 817.  - .dev_diff {
  3803. 818.  -   padding: 0px 0px 10px 0px;
  3804. 819.  - }
  3805. 820.  - .dev_version_text {
  3806. 821.  -   margin-top: 4px;
  3807. 822.  - }
  3808. 823.  - .dev_version_num {
  3809. 824.  -   font-weight: bold;
  3810. 825.  -   width: 40px;
  3811. 826.  - }
  3812. 827.  - .dev_versions_info {
  3813. 828.  -   width: 450px;
  3814. 829.  - }
  3815. 830.  - .dev_version {
  3816. 831.  -   padding: 10px 4px;
  3817. 832.  - }
  3818. 833.  - .dev_versions_methods {
  3819. 834.  -   padding-bottom: 4px;
  3820. 835.  - }
  3821. 836.  - .dev_versions_field {
  3822. 837.  -   color: #777777;
  3823. 838.  - }
  3824. 839.  - .dev_version_edit_block {
  3825. 840.  -   margin-bottom: 10px;
  3826. 841.  - }
  3827. 842.  - .dev_versions_all_link {
  3828. 843.  -   margin-top: 12px;
  3829. 844.  - }
  3830. 845.  - .dev_upload_form {
  3831. 846.  -   padding: 4px 8px;
  3832. 847.  -   margin: 15px 0px 0px 15px;
  3833. 848.  -   background: #5e82a8;
  3834. 849.  -   color: #FFFFFF;
  3835. 850.  - }
  3836. 851.  - #dev_upload_iframe_wrap {
  3837. 852.  -   background: #E4ECF4;
  3838. 853.  -   margin: 0px 0px 0px 15px;
  3839. 854.  -   display: none;
  3840. 855.  - }
  3841. 856.  - #dev_upload_iframe {
  3842. 857.  -   width: 100%;
  3843. 858.  -   border: none;
  3844. 859.  - }
  3845. 860.  - .dev_upload_input {
  3846. 861.  -   width: 100%;
  3847. 862.  - }
  3848. 863.  - textarea.dev_param_field {
  3849. 864.  -   height: 60px;
  3850. 865.  - }
  3851. ------
Advertisement
Add Comment
Please, Sign In to add comment