diff --git a/data/promote.telegram.org/css/promote.css b/data/promote.telegram.org/css/promote.css index defcf8834f..a7827e2419 100644 --- a/data/promote.telegram.org/css/promote.css +++ b/data/promote.telegram.org/css/promote.css @@ -854,19 +854,19 @@ body.rtl .ad-owner-photo { right: -12px; top: 7px; } -.pr-auth-name { - color: #0277C5; +.pr-dropdown-label { + color: #0088cc; } -.pr-auth-name:after { +.pr-dropdown-label:after { content: ''; display: inline-block; vertical-align: middle; width: 13px; height: 6px; margin-left: 5px; - background-image: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2213%22%20height%3D%226%22%20viewBox%3D%220%200%2013%206%22%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22%232884CF%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%222%22%20d%3D%22M%201.68%201%20L%205.8%204.46%20C%206.17%204.77%206.71%204.77%207.08%204.46%20L%2011.2%201%20L%2011.2%201%22%2F%3E%3C%2Fsvg%3E'); + background-image: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2213%22%20height%3D%226%22%20viewBox%3D%220%200%2013%206%22%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22%230088cc%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%222%22%20d%3D%22M%201.68%201%20L%205.8%204.46%20C%206.17%204.77%206.71%204.77%207.08%204.46%20L%2011.2%201%20L%2011.2%201%22%2F%3E%3C%2Fsvg%3E'); } -body.rtl .pr-auth-name:after { +body.rtl .pr-dropdown-label:after { margin-right: 5px; margin-left: 0; } @@ -1793,8 +1793,11 @@ a.pr-account-button-wrap:focus { position: relative; font-size: 14px; line-height: 20px; - padding: 10px 10px 10px 40px; - margin: 0 5px 10px; + padding: 5px 0 5px 30px; +} +.pr-form-info-block b, +.pr-form-info-block .value { + font-weight: 500; } .pr-form-info-block:before { content: ''; @@ -1802,10 +1805,17 @@ a.pr-account-button-wrap:focus { display: inline-block; left: 0; top: 0; - width: 20px; - height: 20px; - margin: 10px; - background: url('data:image/svg+xml,%3Csvg%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20width%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m%2010%200%20c%205.52%200%2010%204.48%2010%2010%20s%20-4.48%2010%20-10%2010%20s%20-10%20-4.48%20-10%20-10%20s%204.48%20-10%2010%20-10%20z%20m%200.07%2012.61%20c%20-0.77%200%20-1.39%200.58%20-1.39%201.31%20c%200%200.74%200.62%201.32%201.39%201.32%20c%200.76%200%201.38%20-0.58%201.38%20-1.32%20c%200%20-0.73%20-0.62%20-1.31%20-1.38%20-1.31%20z%20m%200.01%20-8.35%20c%20-0.81%200%20-1.3%200.48%20-1.3%201.29%20c%200%200.1%200.01%200.23%200.01%200.34%20l%200.14%204.56%20c%200.02%200.75%200.4%201.19%201.14%201.19%20c%200.74%200%201.12%20-0.44%201.14%20-1.19%20l%200.13%20-4.56%20c%200.01%20-0.12%200.01%20-0.25%200.01%20-0.34%20c%200%20-0.81%20-0.48%20-1.29%20-1.28%20-1.29%20z%22%20fill%3D%22%233c9ff0%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E') no-repeat center; + width: 18px; + height: 18px; + margin: 6px 1px; + background: url('data:image/svg+xml,%3Csvg%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20width%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m10%200c5.52%200%2010%204.48%2010%2010s-4.48%2010-10%2010-10-4.48-10-10%204.48-10%2010-10zm0%2012.75c-.69%200-1.25.56-1.25%201.25s.56%201.25%201.25%201.25%201.25-.56%201.25-1.25-.56-1.25-1.25-1.25zm0-7.75c-.55%200-1%20.45-1%201v5c0%20.55.45%201%201%201s1-.45%201-1v-5c0-.55-.45-1-1-1z%22%20fill%3D%22%23ee9939%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E') no-repeat center; + background-size: contain; +} +.pr-form-info-block.plus:before { + background-image: url('data:image/svg+xml,%3Csvg%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20width%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m10%200c5.52%200%2010%204.48%2010%2010s-4.48%2010-10%2010-10-4.48-10-10%204.48-10%2010-10zm0%205c-.55%200-1%20.45-1%201v3h-3c-.55%200-1%20.45-1%201s.45%201%201%201h3v3c0%20.55.45%201%201%201s1-.45%201-1v-3h3c.55%200%201-.45%201-1s-.45-1-1-1h-3v-3c0-.55-.45-1-1-1z%22%20fill%3D%22%233c9ff0%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E'); +} +.pr-form-info-block.minus:before { + background-image: url('data:image/svg+xml,%3Csvg%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20width%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m10%200c5.52%200%2010%204.48%2010%2010s-4.48%2010-10%2010-10-4.48-10-10%204.48-10%2010-10zm4%209h-8c-.55%200-1%20.45-1%201s.45%201%201%201h8c.55%200%201-.45%201-1s-.45-1-1-1z%22%20fill%3D%22%23d75959%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E'); } .pr-draft-btn-wrap { position: relative; @@ -1854,6 +1864,10 @@ a.pr-account-button-wrap:focus { max-width: none; padding: 16px 0 18px; } + .pr-form .form-group.no-padding, + .pr-form .form-group-slim.no-padding { + padding: 0; + } .form-group-slim { padding: 16px 0 18px; } @@ -1898,7 +1912,12 @@ a.pr-account-button-wrap:focus { .pr-form-footer-delete-column { order: 0; } - .pr-form-info-block, + .pr-form-info-block { + padding-left: 40px; + } + .pr-form-info-block:before { + margin-left: 10px; + } .pr-decline-block { margin-left: 0; margin-right: 0; @@ -2268,29 +2287,40 @@ a.ad-declined:focus { .pr-review-list .pr-load-more-wrap { padding: 25px 15px; } -.pr-review-header-wrap { +.pr-review-header-block { display: flex; line-height: 19px; - padding: 15px 15px 5px; justify-content: space-between; + flex-direction: row-reverse; flex-wrap: wrap; } +.pr-review-header-wrap { + display: flex; + padding: 15px 15px 5px; + flex-grow: 100000; + order: 2; +} +.pr-review-header-tabs { + display: flex; + font-size: 15px; + font-weight: 600; + padding: 15px 15px 5px; + -webkit-font-smoothing: antialiased; + flex-grow: 1; + order: 1; +} .pr-review-header { font-size: 16px; font-weight: 600; -webkit-font-smoothing: antialiased; margin: 0; } -.pr-review-header-tabs { - display: flex; - font-size: 14px; - font-weight: 600; - -webkit-font-smoothing: antialiased; -} +.pr-review-header-dd, .pr-review-header-tabs .pr-review-header-tab-wrap + .pr-review-header-tab-wrap { margin-left: 20px; position: relative; } +.pr-review-header-dd:before, .pr-review-header-tabs .pr-review-header-tab-wrap + .pr-review-header-tab-wrap:before { display: inline-block; content: ''; @@ -2302,6 +2332,15 @@ a.ad-declined:focus { left: -12px; top: 7px; } +.pr-review-header-dd .pr-dropdown-label { + font-size: 15px; + font-weight: 600; + -webkit-font-smoothing: antialiased; +} +.pr-review-header-dd span.dropdown-menu { + left: -15px; + right: auto; +} .pr-review-header-tab-wrap.active .pr-review-header-tab { color: inherit; pointer-events: none; @@ -2509,7 +2548,7 @@ body.rtl .pr-review-ad-buttons .btn.dropdown-toggle:after { width: 320px; } .pr-review-preview-column .pr-review-ad-content { - padding-left: 58px; + padding-left: 35px; } } diff --git a/data/promote.telegram.org/js/promote.js b/data/promote.telegram.org/js/promote.js index df4ea9268c..27a02f863a 100644 --- a/data/promote.telegram.org/js/promote.js +++ b/data/promote.telegram.org/js/promote.js @@ -378,6 +378,7 @@ var NewAd = { state.confirmedCheckbox = state.$form.field('confirmed'); state.confirmedCheckbox.on('change.curPage', NewAd.onConfirmedChange); NewAd.updateAdPreview(state.$form, state.previewData); + NewAd.updateAdTargetOverview(); setTimeout(function() { state.titleField.focusAndSelect(); }, 50); @@ -553,7 +554,8 @@ var NewAd = { var item = { val: result.channel.id, name: result.channel.title, - photo: result.channel.photo + photo: result.channel.photo, + username: result.channel.username }; $fieldEl.trigger('selectval', [item, true]); $fieldEl.data('prevval', ''); @@ -572,6 +574,7 @@ var NewAd = { paired_field = 'channels'; } if (!paired_field) { + NewAd.updateAdTargetOverview(); return; } var $pairedField = Aj.state.$form.field(paired_field); @@ -585,6 +588,7 @@ var NewAd = { } }); } + NewAd.updateAdTargetOverview(); }, ePreviewAd: function(e) { e.preventDefault(); @@ -710,6 +714,58 @@ var NewAd = { }); return $previewPopup; }, + updateAdTargetOverview: function() { + var len = {}, lang_params = {}; + for (var i = 0; i < Aj.state.selectList.length; i++) { + var selectData = Aj.state.selectList[i]; + var field = selectData.field; + var $field = Aj.state.$form.field(field); + var value = $field.data('value') || []; + var valueFull = $field.data('valueFull') || {}; + len[field] = value.length; + if (value.length) { + var list = []; + for (var j = 0; j < value.length; j++) { + var val = value[j], valFull = valueFull[val] || {}; + list.push(valFull.username ? '' + valFull.name + '' : '' + valFull.name + ''); + } + if (list.length > 1) { + var last_item = list.pop(); + list[list.length - 1] = l('WEB_AD_TARGET_AND', {item1: list[list.length - 1], item2: last_item}); + } + lang_params[field] = list.join(', '); + } else { + lang_params[field] = ''; + } + Ads.hideFieldError($field); + } + if (!len.langs && len.topics) { + Ads.showFieldError(Aj.state.$form.field('langs'), l('ADS_ERROR_LANGUAGE_REQUIRED')); + } + var overview = ''; + if (!len.langs && !len.topics && !len.channels || + !len.langs && len.topics) { + overview += '
' + l('WEB_AD_TARGET_NOTHING') + '
'; + } else { + if (len.langs > 0) { + if (len.topics > 0) { + overview += '
' + l('WEB_AD_TARGET_TOPICS', lang_params) + '
'; + } else { + overview += '
' + l('WEB_AD_TARGET_LANGS', lang_params) + '
'; + } + } + if (len.channels > 0) { + overview += '
' + l('WEB_AD_TARGET_CHANNELS', lang_params) + '
'; + } + if (len.exclude_topics > 0) { + overview += '
' + l('WEB_AD_TARGET_EXCLUDE_TOPICS', lang_params) + '
'; + } + if (len.exclude_channels > 0) { + overview += '
' + l('WEB_AD_TARGET_EXCLUDE_CHANNELS', lang_params) + '
'; + } + } + $('.pr-target-overview', Aj.ajContainer).html(overview); + }, getFormData: function($form) { var form = $form.get(0); if (!form) return false; @@ -1897,4 +1953,4 @@ var EditAd = { (function(d){var c=function(a){this._options={checkOnLoad:!1,resetOnEnd:!1,loopCheckTime:50,loopMaxNumber:5,baitClass:"pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links ads-header ads-content",baitStyle:"width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;"};this._var={version:"3.2.1",bait:null,checking:!1,loop:null,loopNumber:0,event:{detected:[],notDetected:[]}};void 0!==a&&this.setOption(a);var b=this;a=function(){setTimeout(function(){!0===b._options.checkOnLoad&&(null===b._var.bait&&b._creatBait(),setTimeout(function(){b.check()},1))},1)};void 0!==d.addEventListener?d.addEventListener("load",a,!1):d.attachEvent("onload",a)};c.prototype._options=null;c.prototype._var=null;c.prototype._bait=null;c.prototype.setOption=function(a,b){if(void 0!==b){var e=a;a={};a[e]=b}for(var f in a)this._options[f]=a[f];return this};c.prototype._creatBait=function(){var a=document.createElement("div");a.setAttribute("class",this._options.baitClass);a.setAttribute("style",this._options.baitStyle);this._var.bait=d.document.body.appendChild(a);this._var.bait.offsetParent;this._var.bait.offsetHeight;this._var.bait.offsetLeft;this._var.bait.offsetTop;this._var.bait.offsetWidth;this._var.bait.clientHeight;this._var.bait.clientWidth};c.prototype._destroyBait=function(){d.document.body.removeChild(this._var.bait);this._var.bait=null};c.prototype.check=function(a){void 0===a&&(a=!0);this._var.checking=!0;null===this._var.bait&&this._creatBait();var b=this;this._var.loopNumber=0;!0===a&&(this._var.loop=setInterval(function(){b._checkBait(a)},this._options.loopCheckTime));setTimeout(function(){b._checkBait(a)},1);return!0};c.prototype._checkBait=function(a){var b=!1;null===this._var.bait&&this._creatBait();if(null!==d.document.body.getAttribute("abp")||null===this._var.bait.offsetParent||0==this._var.bait.offsetHeight||0==this._var.bait.offsetLeft||0==this._var.bait.offsetTop||0==this._var.bait.offsetWidth||0==this._var.bait.clientHeight||0==this._var.bait.clientWidth)b=!0;if(void 0!==d.getComputedStyle){var e=d.getComputedStyle(this._var.bait,null);!e||"none"!=e.getPropertyValue("display")&&"hidden"!=e.getPropertyValue("visibility")||(b=!0)}!0===a&&(this._var.loopNumber++,this._var.loopNumber>=this._options.loopMaxNumber&&this._stopLoop());if(!0===b)this._stopLoop(),this._destroyBait(),this.emitEvent(!0),!0===a&&(this._var.checking=!1);else if(null===this._var.loop||!1===a)this._destroyBait(),this.emitEvent(!1),!0===a&&(this._var.checking=!1)};c.prototype._stopLoop=function(a){clearInterval(this._var.loop);this._var.loop=null;this._var.loopNumber=0};c.prototype.emitEvent=function(a){a=this._var.event[!0===a?"detected":"notDetected"];for(var b in a)if(a.hasOwnProperty(b))a[b]();!0===this._options.resetOnEnd&&this.clearEvent();return this};c.prototype.clearEvent=function(){this._var.event.detected=[];this._var.event.notDetected=[]};c.prototype.on=function(a){this._var.event.detected.push(a);return this};d.ABC=c;void 0===d.AB&&(d.AB=new c({checkOnLoad:!0,resetOnEnd:!0}))})(window); AB.on(function() { openPopup(''); -}); \ No newline at end of file +});