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