Update content of files

This commit is contained in:
GitHub Action 2024-10-31 14:33:12 +00:00
parent 40b1f17f69
commit debb3c27e0
8 changed files with 378 additions and 42 deletions

View file

@ -24,7 +24,7 @@
<link href="//telegram.org/css/bootstrap-extra.css?2" rel="stylesheet">
<link href="//telegram.org/css/telegram.css?241" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?67" rel="stylesheet">
<link href="//telegram.org/css/promote.css?97" rel="stylesheet">
<link href="//telegram.org/css/promote.css?99" rel="stylesheet">
<link href="//telegram.org/css/jquery-ui.min.css?1" rel="stylesheet">
<link href="//telegram.org/css/tchart.min.css?10" rel="stylesheet">
@ -129,14 +129,14 @@
<script src="//telegram.org/js/main-aj.js?70"></script>
<script src="//telegram.org/js/main.js?47"></script>
<script src="//telegram.org/js/widget-frame.js?62"></script>
<script src="//telegram.org/js/promote.js?96"></script>
<script src="//telegram.org/js/promote.js?98"></script>
<script src="//telegram.org/js/jquery-ui.min.js?1"></script>
<script src="//telegram.org/js/jquery-ex.js?20"></script>
<script src="//telegram.org/js/tchart.min.js?18"></script>
<script src="//telegram.org/js/health.js?21"></script>
<script src="//telegram.org/js/tgsticker.js?31"></script>
<script>ajInit({"version":1029,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":1033,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <b>ads.telegram.org<\/b> as an exception to manage your promoted messages."});
Ads.init();
Aj.onLoad(function(state) {

View file

@ -24,7 +24,7 @@
<link href="//telegram.org/css/bootstrap-extra.css?2" rel="stylesheet">
<link href="//telegram.org/css/telegram.css?241" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?67" rel="stylesheet">
<link href="//telegram.org/css/promote.css?97" rel="stylesheet">
<link href="//telegram.org/css/promote.css?99" rel="stylesheet">
<link href="//telegram.org/css/jquery-ui.min.css?1" rel="stylesheet">
<link href="//telegram.org/css/tchart.min.css?10" rel="stylesheet">
@ -129,14 +129,14 @@
<script src="//telegram.org/js/main-aj.js?70"></script>
<script src="//telegram.org/js/main.js?47"></script>
<script src="//telegram.org/js/widget-frame.js?62"></script>
<script src="//telegram.org/js/promote.js?96"></script>
<script src="//telegram.org/js/promote.js?98"></script>
<script src="//telegram.org/js/jquery-ui.min.js?1"></script>
<script src="//telegram.org/js/jquery-ex.js?20"></script>
<script src="//telegram.org/js/tchart.min.js?18"></script>
<script src="//telegram.org/js/health.js?21"></script>
<script src="//telegram.org/js/tgsticker.js?31"></script>
<script>ajInit({"version":1029,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":1033,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <b>ads.telegram.org<\/b> as an exception to manage your promoted messages."});
openPopup('#login-popup-container');
Ads.init();

View file

@ -23,7 +23,7 @@
<link href="//telegram.org/css/bootstrap-extra.css?2" rel="stylesheet">
<link href="//telegram.org/css/telegram.css?241" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?67" rel="stylesheet">
<link href="//telegram.org/css/promote.css?97" rel="stylesheet">
<link href="//telegram.org/css/promote.css?99" rel="stylesheet">
<link href="//telegram.org/css/jquery-ui.min.css?1" rel="stylesheet">
<link href="//telegram.org/css/tchart.min.css?10" rel="stylesheet">
@ -255,14 +255,14 @@
<script src="//telegram.org/js/main-aj.js?70"></script>
<script src="//telegram.org/js/main.js?47"></script>
<script src="//telegram.org/js/widget-frame.js?62"></script>
<script src="//telegram.org/js/promote.js?96"></script>
<script src="//telegram.org/js/promote.js?98"></script>
<script src="//telegram.org/js/jquery-ui.min.js?1"></script>
<script src="//telegram.org/js/jquery-ex.js?20"></script>
<script src="//telegram.org/js/tchart.min.js?18"></script>
<script src="//telegram.org/js/health.js?21"></script>
<script src="//telegram.org/js/tgsticker.js?31"></script>
<script>ajInit({"version":1029,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":1033,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <b>ads.telegram.org<\/b> as an exception to manage your promoted messages."});
window.initDevPageNav&&initDevPageNav();
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});

View file

@ -24,7 +24,7 @@
<link href="//telegram.org/css/bootstrap-extra.css?2" rel="stylesheet">
<link href="//telegram.org/css/telegram.css?241" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?67" rel="stylesheet">
<link href="//telegram.org/css/promote.css?97" rel="stylesheet">
<link href="//telegram.org/css/promote.css?99" rel="stylesheet">
<link href="//telegram.org/css/jquery-ui.min.css?1" rel="stylesheet">
<link href="//telegram.org/css/tchart.min.css?10" rel="stylesheet">
@ -174,14 +174,14 @@
<script src="//telegram.org/js/main-aj.js?70"></script>
<script src="//telegram.org/js/main.js?47"></script>
<script src="//telegram.org/js/widget-frame.js?62"></script>
<script src="//telegram.org/js/promote.js?96"></script>
<script src="//telegram.org/js/promote.js?98"></script>
<script src="//telegram.org/js/jquery-ui.min.js?1"></script>
<script src="//telegram.org/js/jquery-ex.js?20"></script>
<script src="//telegram.org/js/tchart.min.js?18"></script>
<script src="//telegram.org/js/health.js?21"></script>
<script src="//telegram.org/js/tgsticker.js?31"></script>
<script>ajInit({"version":1029,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":1033,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <b>ads.telegram.org<\/b> as an exception to manage your promoted messages."});
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});
Ads.init();

View file

@ -1752,6 +1752,11 @@ input.pr-form-control:focus {
padding: 20px 0 0;
margin: 0 -23px;
cursor: default;
position: relative;
}
.pr-preview-ad-wrap .pr-preview-ad-headerbox-wrap,
.pr-preview-ad-wrap .pr-preview-ad-message-wrap {
display: none;
}
.pr-preview-ad-wrap .pr-preview-ad-message-wrap {
position: relative;
@ -1766,7 +1771,7 @@ input.pr-form-control:focus {
}
.pr-preview-ad-message {
padding: 0 0 0 13px;
display: flex;
display: inline-block;
}
.pr-preview-ad-message-wrap.bordered .pr-preview-ad-message {
position: relative;
@ -1843,8 +1848,107 @@ input.pr-form-control:focus {
box-shadow: 0 0 0 0.5px rgba(118, 142, 106, .3), 0 1px 1px rgba(25, 44, 89, .1);
flex-grow: 1;
}
.pr-preview-ad-message.with-keyboard .ad-msg-bubble {
border-radius: 10px 10px 6px 0;
}
.pr-preview-ad-message .ad-msg-keyboard {
font-size: 14px;
line-height: 16px;
font-weight: 500;
margin-top: 4px;
}
.pr-preview-ad-message .ad-msg-keyboard-button {
margin-top: 4px;
background: rgba(0, 0, 0, .17);
padding: 10px 20px;
border-radius: 6px 6px 10px 10px;
text-align: center;
-webkit-font-smoothing: antialiased;
cursor: pointer;
color: #fff;
}
.pr-preview-ad-headerbox {
position: absolute;
inset: 0 0 auto;
padding: 0;
transform: translateY(-100%);
visibility: hidden;
opacity: 0;
transition: all .2s ease;
}
.ad-msg-headerbox-close-icon {
position: absolute;
right: 0;
top: 0;
display: inline-block;
content: '';
vertical-align: top;
width: 24px;
height: 24px;
margin: 10px;
pointer-events: none;
background: url('data:image/svg+xml,%3Csvg%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m7%2017%2010-10m-10%200%2010%2010%22%20fill%3D%22none%22%20stroke%3D%22%23999%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%221.3%22%2F%3E%3C%2Fsvg%3E') center no-repeat;
transition: all .2s ease;
z-index: 1;
}
.pr-preview-ad-wrap .pr-preview-ad-headerbox-wrap.picture .ad-msg-headerbox-close-icon {
opacity: 0;
visibility: hidden;
}
.pr-preview-ad-wrap .pr-preview-ad-headerbox-wrap.active .pr-preview-ad-headerbox {
visibility: visible;
opacity: 1;
transform: translateY(0);
}
.pr-preview-ad-headerbox .ad-msg-headerbox {
--preview-color1: var(--link-color) !important;
display: block;
position: relative;
font-size: 14px;
line-height: 18px;
background: #fff;
border-top: 1px solid #d9d9d9;
padding: 10px 14px 10px;
color: var(--text-color);
overflow: hidden;
}
.pr-preview-ad-headerbox .ad-msg-headerbox:hover {
text-decoration: none;
}
.pr-preview-ad-headerbox .ad-msg-headerbox-title-wrap {
display: flex;
align-items: flex-start;
white-space: nowrap;
font-weight: bold;
}
.pr-preview-ad-headerbox .ad-msg-headerbox-title-wrap > * {
flex-shrink: 0;
}
.pr-preview-ad-headerbox .ad-msg-headerbox-title {
flex-shrink: 1;
overflow: hidden;
text-overflow: ellipsis;
margin-left: 7px;
}
.pr-preview-ad-headerbox .ad-msg-headerbox-desc {
/* margin-top: 2px;*/
}
.pr-preview-ad-headerbox .ad-msg-headerbox-sitename {
color: var(--link-color);
margin-bottom: 2px;
}
.oneline-text .ad-msg-headerbox-title-wrap {
flex-wrap: wrap;
}
.oneline-text .ad-msg-headerbox-title {
flex-basis: 100%;
margin-left: 0;
order: 1;
}
.pr-preview-ad-wrap .pr-preview-ad-message .ad-msg-bubble {
width: 254px;
width: 260px;
flex-grow: 0;
}
.pr-preview-ad-message-wrap.bordered .pr-preview-ad-message .ad-msg-bubble {
@ -1895,6 +1999,12 @@ input.pr-form-control:focus {
line-height: 19px;
word-break: break-word;
color: #000;
}
.pr-preview-ad-wrap .pr-preview-ad-message .ad-msg-text {
font-size: 14px;
line-height: 16px;
}
.pr-preview-ad-message .ad-msg-from + .ad-msg-text {
margin-top: 5px;
}
.pr-preview-ad-message .ad-msg-media {
@ -1912,6 +2022,7 @@ input.pr-form-control:focus {
}
.pr-preview-ad-message .before_footer + .ad-msg-date .label {
position: relative;
bottom: -2px;
}
.pr-preview-ad-message .ad-msg-btn {
display: block;
@ -1999,32 +2110,74 @@ input.pr-form-control:focus {
text-transform: capitalize;
margin: 7px 0 0;
}
.pr-preview-ad-headerbox .ad-msg-sitename-badge,
.pr-preview-ad-message .ad-msg-sitename-badge {
display: inline-block;
position: relative;
color: var(--preview-color1);
-webkit-font-smoothing: antialiased;
font-size: 10px;
line-height: 14px;
font-weight: normal;
vertical-align: top;
text-transform: none;
margin: 1px 2px;
padding: 0px 5px;
}
.pr-preview-ad-headerbox .ad-msg-sitename-badge {
margin: 1px 7px;
}
.pr-preview-ad-headerbox .ad-msg-sitename-badge:before,
.pr-preview-ad-message .ad-msg-sitename-badge:before {
content: '';
position: absolute;
background-color: var(--preview-color1);
border-radius: 8px;
opacity: 0.1;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 0;
}
.pr-preview-ad-message .ad-msg-link-preview-title,
.pr-preview-ad-message .ad-msg-link-preview-desc {
margin: 1px 0 0;
}
.emoji_image .pr-preview-ad-wrap i.emoji {
margin: -5px -2px;
}
.pr-preview-ad-headerbox .ad-msg-headerbox-image,
.pr-preview-ad-message .ad-msg-link-preview-image {
display: inline-block;
width: 42px;
float: right;
border-radius: 6px;
margin: 7px -100px 7px 7px;
margin: 4px -100px 2px 7px;
overflow: hidden;
opacity: 0;
transform: translateX(42px);
transition: margin 0s .15s ease, transform .15s ease, opacity .15s ease;
}
.pr-preview-ad-headerbox .ad-msg-headerbox-image {
position: relative;
margin-right: -21px;
z-index: 2;
}
.pr-preview-ad-headerbox .ad-msg-headerbox-image img,
.pr-preview-ad-message .ad-msg-link-preview-image img {
max-width: 100%;
vertical-align: top;
border-radius: 6px;
}
.pr-preview-ad-wrap .pr-preview-ad-headerbox-wrap.picture .pr-preview-ad-headerbox .ad-msg-headerbox-image,
.pr-preview-ad-wrap .pr-preview-ad-message-wrap.picture .pr-preview-ad-message .ad-msg-link-preview-image {
margin-right: 0;
opacity: 1;
transform: translateX(0px);
transition: margin 0s ease, transform .15s ease, opacity .15s ease;
}
.pr-preview-ad-wrap .pr-preview-ad-headerbox-wrap.has-media .pr-preview-ad-headerbox .ad-msg-headerbox-image,
.pr-preview-ad-wrap .pr-preview-ad-message-wrap.has-media .pr-preview-ad-message .ad-msg-link-preview-image {
display: none;
}
@ -2924,7 +3077,7 @@ fieldset.pr-form-control-wrap .checkbox-item-block {
font-size: 15px;
padding: 12px 15px 14px;
max-width: 460px;
margin: 0 auto 10px;
margin: 0 auto;
}
.pr-target-options {
display: none;
@ -3013,8 +3166,12 @@ fieldset.pr-form-control-wrap .checkbox-item-block {
padding: 0;
}
.pr-form-column + .pr-form-column .pr-target-tabs {
margin-bottom: 10px;
text-align: right;
}
.pr-new-form-same .pr-form-column + .pr-form-column .pr-target-tabs {
text-align: left;
}
}
.pr-no-pr-content {
@ -3532,7 +3689,8 @@ tbody > tr > td > .pr-cell {
vertical-align: top;
}
.pr-trg-type-channel,
.pr-trg-type-user {
.pr-trg-type-user,
.pr-trg-type-bot {
padding-left: 24px;
}
.pr-trg-type-channel:before {
@ -3541,6 +3699,9 @@ tbody > tr > td > .pr-cell {
.pr-trg-type-user:before {
background-image: url('data:image/svg+xml,%3Csvg%20height%3D%2218%22%20viewBox%3D%220%200%2018%2018%22%20width%3D%2218%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22%232b2b2b%22%20transform%3D%22translate%282%205%29%22%3E%3Cpath%20d%3D%22m10.0980038%204.4494382c1.023%200%201.8426325-.73775281%201.8426325-1.65168539%200-.91393259-.8196325-1.65168539-1.8426325-1.65168539-1.02300007%200-1.84879527.7377528-1.84879527%201.65168539%200%20.91393258.8257952%201.65168539%201.84879527%201.65168539z%22%2F%3E%3Cpath%20d%3D%22m4.79136758%204.24719101c1.22760003%200%202.21115909-.94853932%202.21115909-2.1235955s-.98355906-2.12359551-2.21115909-2.12359551-2.21855427.94853933-2.21855427%202.12359551.99095424%202.1235955%202.21855427%202.1235955z%22%2F%3E%3Cpath%20d%3D%22m4.67580854%205.15730337c-1.55637627%200-4.67580854.73617978-4.67580854%202.20224719v.72359551c0%20.34606741.53384798.8494382.90123294.8494382h7.7824115c.36738495%200%20.66797265-.28314607.66797265-.62921348v-.94382023c0-1.46606741-3.11943227-2.20224719-4.67580855-2.20224719z%22%2F%3E%3Cpath%20d%3D%22m9.89326728%205.46067416c-.17013607%200-.36373919.01179775-.56907582.02949438.01173352.00589888.01760028.01769663.02346704.0235955.6688108.48960675%201.3783801%201.14438203%201.3783801%202.01151686v.88483146c0%20.20646067-.0410674.40702247-.1056017.58988764h2.5714048c.3226719%200%20.8081583-.48865017.8081583-.81308837v-.66163073c0-1.3744382-2.7397774-2.06460674-4.10673272-2.06460674z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E');
}
.pr-trg-type-bot:before {
background-image: url('data:image/svg+xml,%3Csvg%20height%3D%2218%22%20viewBox%3D%220%200%2018%2018%22%20width%3D%2218%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22%232b2b2b%22%20fill-rule%3D%22evenodd%22%3E%3Cpath%20d%3D%22m9%203.33c2.34%200%204.24%201.9%204.24%204.25v4.4c0%201.1-.89%202-2%202h-4.48c-1.11%200-2-.9-2-2v-4.4c0-2.35%201.9-4.25%204.24-4.25zm0%201c-1.79%200-3.23%201.42-3.23%203.18v.39c0%20.66.54%201.2%201.21%201.2h4.04c.67%200%201.21-.54%201.21-1.2v-.39c0-1.76-1.44-3.18-3.23-3.18z%22%2F%3E%3Crect%20height%3D%224.37%22%20rx%3D%22.81%22%20width%3D%221.62%22%20x%3D%2214.05%22%20y%3D%227.71%22%2F%3E%3Crect%20height%3D%224.37%22%20rx%3D%22.81%22%20width%3D%221.62%22%20x%3D%222.33%22%20y%3D%227.71%22%2F%3E%3Cellipse%20cx%3D%2210.41%22%20cy%3D%227.11%22%20rx%3D%221%22%20ry%3D%221%22%2F%3E%3Cellipse%20cx%3D%227.59%22%20cy%3D%227.11%22%20rx%3D%221%22%20ry%3D%221%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E');
}
.pr-table-settings {
display: inline-block;
vertical-align: top;

View file

@ -570,6 +570,8 @@ var NewAd = {
cont.on('click.curPage', '.js-open-schedule', NewAd.eOpenSchedule);
cont.on('click.curPage', '.js-channels-deselect', NewAd.eDeselectChannels);
cont.on('click.curPage', '.js-similar-channels-link', NewAd.eOpenSimilarChannels);
cont.on('click.curPage', '.js-bots-deselect', NewAd.eDeselectBots);
cont.on('click.curPage', '.js-similar-bots-link', NewAd.eOpenSimilarBots);
$('.js-schedule-overview', state.$form).html(NewAd.scheduleOverview(state.$form));
for (var i = 0; i < state.selectList.length; i++) {
var selectData = state.selectList[i];
@ -584,6 +586,17 @@ var NewAd = {
onUpdate: NewAd.onSelectUpdate,
onChange: Ads.onSelectChange
});
} else if (selectData.bot_search) {
Ads.initSelect(state.$form, selectData.field, {
items: Aj.state[selectData.items_key] || [],
pairedField: selectData.paired_field || false,
renderSelectedItem: function(val, item) {
return '<div class="selected-item' + (item.photo ? ' has-photo' : '') + '" data-val="' + cleanHTML(val.toString()) + '">' + (item.photo ? '<div class="selected-item-photo">' + item.photo + '</div>' : '') + '<span class="close"></span><div class="label">' + item.name + '</div></div>';
},
onEnter: NewAd.onBotSearch,
onUpdate: NewAd.onSelectUpdate,
onChange: Ads.onSelectChange
});
} else if (selectData.location_search) {
var $cFieldEl = state.$form.field(selectData.c_field).fieldEl();
$cFieldEl.data('l_field', selectData.field);
@ -648,6 +661,7 @@ var NewAd = {
state.confirmedCheckbox = state.$form.field('confirmed');
state.confirmedCheckbox.on('change.curPage', NewAd.onConfirmedChange);
state.similarChannelsPopup = $('.js-similar-channels-popup', cont);
state.similarBotsPopup = $('.js-similar-bots-popup', cont);
NewAd.updateAdMedia(state.mediaField);
NewAd.updateAdPreview(state.$form, state.previewData);
NewAd.updateAdTargetOverview();
@ -1002,6 +1016,48 @@ var NewAd = {
}
});
},
onBotSearch: function(field, value) {
var $fieldEl = Aj.state.$form.field(field);
var $formGroup = $fieldEl.fieldEl().parents('.form-group');
var prev_value = $fieldEl.data('prevval');
if (prev_value && prev_value == value) {
return false;
}
$fieldEl.data('prevval', value);
Ads.hideFieldError($fieldEl);
if (!value) {
return false;
}
var bots_limit = Aj.state.botItemsLimit;
if ($fieldEl.data('value').length >= bots_limit) {
var selOpts = $fieldEl.data('selOpts');
if (selOpts.l_bots_limit) {
Ads.showFieldError($fieldEl, selOpts.l_bots_limit);
return false;
}
}
$formGroup.addClass('field-loading');
Aj.apiRequest('searchBot', {
query: value,
field: field
}, function(result) {
$formGroup.removeClass('field-loading');
if (result.error) {
Ads.showFieldError($fieldEl, result.error);
return false;
}
if (result.bot) {
var item = {
val: result.bot.id,
name: result.bot.title,
photo: result.bot.photo,
username: result.bot.username
};
$fieldEl.trigger('selectval', [item, true]);
$fieldEl.data('prevval', '');
}
});
},
loadLocationData: function(params, opts, onUpdate, onReady) {
Aj.apiRequest('searchLocation', params, function(result) {
if (result.error) {
@ -1115,6 +1171,10 @@ var NewAd = {
var channels_cnt = $fieldEl.data('value').length;
$('.js-similar-channels-link-wrap', Aj.state.$form).slideToggle(channels_cnt > 0 && channels_cnt < 10);
$('.js-channels-deselect', Aj.state.$form).toggleClass('hide', channels_cnt < 2);
} else if (field == 'bots') {
var bots_cnt = $fieldEl.data('value').length;
$('.js-similar-bots-link-wrap', Aj.state.$form).slideToggle(bots_cnt > 0 && bots_cnt < 10);
$('.js-bots-deselect', Aj.state.$form).toggleClass('hide', bots_cnt < 2);
}
var selOpts = $fieldEl.data('selOpts');
var paired_field = selOpts.pairedField;
@ -1155,9 +1215,9 @@ var NewAd = {
var $empty = $('.js-similar-channels-empty', this);
var $loading = $('.js-similar-channels-loading', this);
var $button = $('.js-add-similar-channels', this);
$list.on('scroll', NewAd.onSimiralChannelsScroll);
$list.on('change', 'input.checkbox', NewAd.eSimiralChannelChange);
$button.on('click', NewAd.eAddSimiralChannels);
$list.on('scroll', NewAd.onSimilarScroll);
$list.on('change', 'input.checkbox', NewAd.eSimilarChannelChange);
$button.on('click', NewAd.eAddSimilarChannels);
$empty.addClass('hide');
$button.addClass('hide');
$loading.removeClass('hide');
@ -1181,27 +1241,27 @@ var NewAd = {
$button.toggleClass('hide', !has_items);
$loading.addClass('hide');
$list.html(html).data('channel_items', channel_items).toggleClass('hide', !has_items).trigger('scroll');
NewAd.updateSimiralChannelButton();
NewAd.updateSimilarChannelButton();
}
});
},
onClose: function() {
var $list = $('.js-similar-channels-list', this);
var $button = $('.js-add-similar-channels', this);
$list.off('scroll', NewAd.onSimiralChannelsScroll);
$list.off('change', 'input.checkbox', NewAd.eSimiralChannelChange);
$button.off('click', NewAd.eAddSimiralChannels);
$list.off('scroll', NewAd.onSimilarScroll);
$list.off('change', 'input.checkbox', NewAd.eSimilarChannelChange);
$button.off('click', NewAd.eAddSimilarChannels);
}
});
},
onSimiralChannelsScroll: function() {
onSimilarScroll: function() {
$(this).toggleClass('topscroll', this.scrollTop > 0);
$(this).toggleClass('bottomscroll', this.scrollTop < this.scrollHeight - this.clientHeight);
},
eSimiralChannelChange: function() {
NewAd.updateSimiralChannelButton();
eSimilarChannelChange: function() {
NewAd.updateSimilarChannelButton();
},
updateSimiralChannelButton: function() {
updateSimilarChannelButton: function() {
var $popup = Aj.state.similarChannelsPopup;
var $list = $('.js-similar-channels-list', $popup);
var $button = $('.js-add-similar-channels', $popup);
@ -1214,7 +1274,7 @@ var NewAd = {
$button.html(l('WEB_ADD_N_SIMILAR_CHANNELS', {n: count}));
$button.toggleClass('disabled', !count);
},
eAddSimiralChannels: function() {
eAddSimilarChannels: function() {
var $popup = Aj.state.similarChannelsPopup;
var $list = $('.js-similar-channels-list', $popup);
var $button = $('.js-add-similar-channels', $popup);
@ -1235,6 +1295,102 @@ var NewAd = {
});
closePopup($popup);
},
eDeselectBots: function(e) {
e.preventDefault();
Aj.state.$form.field('bots').trigger('reset');
},
eOpenSimilarBots: function(e) {
e.preventDefault();
var $link = $(this);
var $fieldEl = Aj.state.$form.field('bots');
var values = $fieldEl.data('value') || [];
if (!values.length || $link.data('loading')) {
return false;
}
var bots = values.join(';');
openPopup(Aj.state.similarBotsPopup, {
closeByClickOutside: '.popup-no-close',
onOpen: function() {
var $list = $('.js-similar-bots-list', this);
var $empty = $('.js-similar-bots-empty', this);
var $loading = $('.js-similar-bots-loading', this);
var $button = $('.js-add-similar-bots', this);
$list.on('scroll', NewAd.onSimilarScroll);
$list.on('change', 'input.checkbox', NewAd.eSimilarBotChange);
$button.on('click', NewAd.eAddSimilarBots);
$empty.addClass('hide');
$button.addClass('hide');
$loading.removeClass('hide');
$list.html('').trigger('scroll').data('bots', {}).addClass('hide');
Aj.apiRequest('getSimilarBots', {
bots: bots
}, function(result) {
if (result.error) {
showAlert(result.error);
return false;
}
if (result.bots) {
var html = '', bot_items = {};
for (var i = 0; i < result.bots.length; i++) {
var item = result.bots[i];
html += item.cb_item;
bot_items['ch' + item.id] = item;
}
var has_items = bot_items > 0;
$empty.toggleClass('hide', has_items);
$button.toggleClass('hide', !has_items);
$loading.addClass('hide');
$list.html(html).data('bot_items', bot_items).toggleClass('hide', !has_items).trigger('scroll');
NewAd.updateSimilarBotButton();
}
});
},
onClose: function() {
var $list = $('.js-similar-bots-list', this);
var $button = $('.js-add-similar-bots', this);
$list.off('scroll', NewAd.onSimilarScroll);
$list.off('change', 'input.checkbox', NewAd.eSimilarBotChange);
$button.off('click', NewAd.eAddSimilarBots);
}
});
},
eSimilarBotChange: function() {
NewAd.updateSimilarBotButton();
},
updateSimilarBotButton: function() {
var $popup = Aj.state.similarBotsPopup;
var $list = $('.js-similar-bots-list', $popup);
var $button = $('.js-add-similar-bots', $popup);
var count = 0;
$('input.checkbox', $list).each(function() {
if ($(this).prop('checked')) {
count++;
}
});
$button.html(l('WEB_ADD_N_SIMILAR_BOTS', {n: count}));
$button.toggleClass('disabled', !count);
},
eAddSimilarBots: function() {
var $popup = Aj.state.similarBotsPopup;
var $list = $('.js-similar-bots-list', $popup);
var $button = $('.js-add-similar-bots', $popup);
var bot_items = $list.data('bot_items');
var $fieldEl = Aj.state.$form.field('bots');
$('input.checkbox', $list).each(function() {
if ($(this).prop('checked')) {
var name = $(this).prop('name');
var bot = bot_items[name];
var item = {
val: bot.id,
name: bot.title,
photo: bot.photo,
username: bot.username
};
$fieldEl.trigger('selectval', [item, true]);
}
});
closePopup($popup);
},
ePreviewAd: function(e) {
e.preventDefault();
NewAd.previewPopup();
@ -1518,6 +1674,10 @@ var NewAd = {
$('.js-preview-footer', $previewPopup).each(function() {
Ads.updateTextShadow(this, '.js-preview-text', '.label', 10);
});
$('.js-preview-wrap', $previewPopup).each(function() {
var oneline = $('.js-preview-text', this).height() <= 20;
$(this).toggleClass('oneline-text', oneline);
});
$('.js-picture-label', $previewPopup).html(previewData.picture_label);
$('.js-picture-hint', $previewPopup).html(previewData.picture_hint);
}
@ -1602,9 +1762,7 @@ var NewAd = {
var website_photo = $form.field('website_photo').value();
var media = $form.field('media').value();
var picture_checked = $form.field('picture').prop('checked');
var previewPictureChange = function() {
$('.js-preview', $previewPopup).toggleClass('picture', !!$(this).prop('checked'));
};
var target_type = $form.field('target_type').value();
var website_name_hidden = $('.js-website-name-wrap', $form).isSlideHidden();
var custom_button_hidden = $('.js-custom-button-wrap', $form).isSlideHidden();
@ -1634,13 +1792,25 @@ var NewAd = {
state.previewButtonField.on('ddchange.curPage', NewAd.onButtonChange);
state.previewButtonField.trigger('selectval', [button]);
state.previewPictureCheckbox = $previewForm.field('picture');
var previewPictureChange = function() {
var picture_checked = Aj.state.previewPictureCheckbox.prop('checked');
$('.js-preview', $previewPopup).toggleClass('picture', !!picture_checked);
$('.js-preview-wrap', $previewPopup).each(function() {
var oneline = $('.js-preview-text', this).height() <= 20;
$(this).toggleClass('oneline-text', oneline);
});
};
state.previewPictureCheckbox.on('change.curPage', previewPictureChange);
state.previewPictureCheckbox.prop('checked', picture_checked);
var $previewEl = $('.js-preview', $previewPopup);
$previewEl.toggleClass('picture', !!picture_checked);
previewPictureChange();
$('.js-website-name-wrap', $previewPopup).toggleClass('shide', website_name_hidden);
$('.js-custom-button-wrap', $previewPopup).toggleClass('shide', custom_button_hidden);
var is_bots_target = (target_type == 'bots');
$('.js-bot-preview', $previewPopup).toggle(is_bots_target);
$('.js-channel-preview', $previewPopup).toggle(!is_bots_target);
state.previewMediaField.data('$previewEl', $previewEl);
NewAd.updateAdMedia(state.previewMediaField);
NewAd.updateAdPreview($previewForm, state.previewData);
@ -1687,6 +1857,7 @@ var NewAd = {
});
state.previewTextField.updateAutosize();
state.initPreviewFormData = NewAd.getPreviewFormData();
previewPictureChange();
});
$previewPopup.one('popup:close', function() {
Ads.formDestroy($previewForm);
@ -2981,8 +3152,7 @@ var OwnerAds = {
}
var adsList = Aj.state.adsList;
for (var i = 0; i < adsList.length; i++) {
if (ad.owner_id == adsList[i].owner_id &&
ad.ad_id == adsList[i].ad_id) {
if (ad.ad_id == adsList[i].ad_id) {
ad.base_url = '/account/ad/' + ad.ad_id;
ad._values = [
ad.title.toLowerCase(),
@ -3516,7 +3686,8 @@ var EditAd = {
return showAlert(result.error);
}
closePopup(Aj.layer);
if (result.ad) {
if (owner_id == Aj.state.ownerId &&
result.ad) {
OwnerAds.updateAd(result.ad);
}
});
@ -3572,7 +3743,8 @@ var EditAd = {
return showAlert(result.error);
}
closePopup(Aj.layer);
if (result.ad) {
if (owner_id == Aj.state.ownerId &&
result.ad) {
OwnerAds.updateAd(result.ad);
}
});
@ -3629,7 +3801,8 @@ var EditAd = {
return showAlert(result.error);
}
closePopup(Aj.layer);
if (result.ad) {
if (owner_id == Aj.state.ownerId &&
result.ad) {
OwnerAds.updateAd(result.ad);
}
if (result.header_owner_budget) {
@ -3695,7 +3868,8 @@ var EditAd = {
return showAlert(result.error);
}
closePopup(Aj.layer);
if (result.ad) {
if (owner_id == Aj.state.ownerId &&
result.ad) {
OwnerAds.updateAd(result.ad);
}
});
@ -3785,7 +3959,8 @@ var EditAd = {
return showAlert(result.error);
}
closePopup(Aj.layer);
if (result.ad) {
if (owner_id == Aj.state.ownerId &&
result.ad) {
OwnerAds.updateAd(result.ad);
}
});

View file

@ -484,7 +484,7 @@
</div>
<script src="https://tg.dev/js/jquery.min.js"></script>
<script src="https://tg.dev/js/tgsticker.js?31"></script>
<script src="/js/cafe.js?32"></script>
<script src="/js/cafe.js?33"></script>
<script>Cafe.init({"apiUrl":"\/cafe\/api","mode":null,"userId":0,"userHash":null});</script>
</body>
</html>

View file

@ -133,7 +133,7 @@ var Cafe = {
Cafe.updateItem(itemEl, delta);
},
formatPrice: function(price) {
return '$' + Cafe.formatNumber(price / 1000, 2, '.', ',');
return '$' + Cafe.formatNumber(price / 100, 2, '.', ',');
},
formatNumber: function(number, decimals, decPoint, thousandsSep) {
number = (number + '').replace(/[^0-9+\-Ee.]/g, '')