partials
1 year ago
ads.php
1 year ago
calendly.php
1 year ago
custom-logo.php
2 years ago
dailymotion.php
2 years ago
elements.php
2 years ago
general.php
1 year ago
go-premium.php
2 years ago
google-calendar.php
2 years ago
instagram.php
2 years ago
license.php
5 years ago
main-template.php
1 year ago
opensea.php
2 years ago
premium.php
2 years ago
shortcode.php
2 years ago
soundcloud.php
2 years ago
sources.php
1 year ago
spotify.php
2 years ago
twitch.php
2 years ago
vimeo.php
2 years ago
wistia.php
2 years ago
youtube.php
1 year ago
ads.php
1281 lines
| 1 | <?php |
| 2 | /* |
| 3 | * Custom Logo Settings page |
| 4 | * All undefined vars comes from 'render_settings_page' method |
| 5 | * |
| 6 | * */ |
| 7 | |
| 8 | use EmbedPress\Includes\Classes\Helper; |
| 9 | |
| 10 | $video_demo_adUrl = 'https://embedpress.com/wp-content/uploads/2023/12/notificationX-demo-ad.mp4'; |
| 11 | $image_demo_adUrl = 'https://embedpress.com/wp-content/uploads/2023/12/demo-ad.gif'; |
| 12 | $youtube_embed_url = 'https://www.youtube.com/embed/coLxfjnrm3I?enablejsapi=1&origin=' . site_url(); |
| 13 | |
| 14 | |
| 15 | global $pro_active; |
| 16 | $updgrade_pro_text = ' You'; |
| 17 | if(!$pro_active){ |
| 18 | $updgrade_pro_text = ' This is a pro feature but you'; |
| 19 | } |
| 20 | |
| 21 | ?> |
| 22 | |
| 23 | <div class="embedpress_calendly_settings background__white radius-25 p40" > |
| 24 | <div class="border"> |
| 25 | <div class="sponsored-settings-top"> |
| 26 | <div <?php if(!$pro_active): echo 'class="sponsored-settings-content"'; endif; ?>> |
| 27 | <h3 class="ads-settings-title"> |
| 28 | <?php |
| 29 | echo wp_kses_post( |
| 30 | sprintf( |
| 31 | esc_html__( |
| 32 | 'Advertise Across %s with EmbedPress – Your Gateway to Unlimited Exposure!', |
| 33 | 'embedpress' |
| 34 | ), |
| 35 | '<a target="_blank" href="' . esc_url('https://embedpress.com/sources/') . '"><span style="color:#FF7369">' . esc_html__('150+ Platforms', 'embedpress') . '</span></a>' |
| 36 | ) |
| 37 | ); |
| 38 | ?> |
| 39 | |
| 40 | </h3> |
| 41 | <p class="ads-settings-description"> |
| 42 | <?php |
| 43 | echo wp_kses_post( |
| 44 | sprintf( |
| 45 | esc_html__( |
| 46 | "Now, you can showcase your ads across %s, guaranteeing unlimited exposure for your business through your embedded contents.%s can check the settings below for a demo example. | %s", |
| 47 | 'embedpress' |
| 48 | ), |
| 49 | '<strong>' . esc_html__('150+ diverse platforms', 'embedpress') . '</strong>', |
| 50 | $updgrade_pro_text, |
| 51 | '<a href="' . esc_url('https://embedpress.com/docs/how-to-configure-ep-ads-settings/ ') . '" target="_blank" style="color:#FF7369"><strong>' . esc_html__('Docs', 'embedpress') . '</strong></a>' |
| 52 | ) |
| 53 | ); |
| 54 | |
| 55 | ?> |
| 56 | </p> |
| 57 | </div> |
| 58 | <?php |
| 59 | |
| 60 | if (!$pro_active) : |
| 61 | ?> |
| 62 | <a href="<?php echo esc_url('https://wpdeveloper.com/in/upgrade-embedpress'); ?>" target="_blank" class="button button-pro-upgrade"><?php echo esc_html__('Upgrade To Pro', 'embedpress'); ?><i class="ep-icon ep-link-icon"></i></a> |
| 63 | <?php endif; ?> |
| 64 | </div> |
| 65 | </div> |
| 66 | |
| 67 | |
| 68 | <div class="sponsored-toggle_wrapper"> |
| 69 | <div class="btn-video sponsored-toggle_btn sponsored-active_btn " > |
| 70 | <span> |
| 71 | <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 72 | <g clip-path="url(#clip0_952_112)"> |
| 73 | <path d="M15 10L19.553 7.724C19.7054 7.64783 19.8748 7.61188 20.045 7.61954C20.2152 7.62721 20.3806 7.67824 20.5256 7.7678C20.6706 7.85736 20.7902 7.98247 20.8733 8.13127C20.9563 8.28006 20.9999 8.44761 21 8.618V15.382C20.9999 15.5524 20.9563 15.7199 20.8733 15.8687C20.7902 16.0175 20.6706 16.1426 20.5256 16.2322C20.3806 16.3218 20.2152 16.3728 20.045 16.3805C19.8748 16.3881 19.7054 16.3522 19.553 16.276L15 14V10Z" stroke="#25396F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> |
| 74 | <path d="M3 8C3 7.46957 3.21071 6.96086 3.58579 6.58579C3.96086 6.21071 4.46957 6 5 6H13C13.5304 6 14.0391 6.21071 14.4142 6.58579C14.7893 6.96086 15 7.46957 15 8V16C15 16.5304 14.7893 17.0391 14.4142 17.4142C14.0391 17.7893 13.5304 18 13 18H5C4.46957 18 3.96086 17.7893 3.58579 17.4142C3.21071 17.0391 3 16.5304 3 16V8Z" stroke="#25396F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> |
| 75 | </g> |
| 76 | <defs> |
| 77 | <clipPath id="clip0_952_112"> |
| 78 | <rect width="24" height="24" fill="white"/> |
| 79 | </clipPath> |
| 80 | </defs> |
| 81 | </svg> |
| 82 | |
| 83 | </span> |
| 84 | <span>Video</span> |
| 85 | </div> |
| 86 | <div class="btn-img sponsored-toggle_btn "> |
| 87 | <span> |
| 88 | <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 89 | <g clip-path="url(#clip0_952_123)"> |
| 90 | <path d="M12.5 6.66663H12.5083" stroke="#7C8DB5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> |
| 91 | <path d="M2.5 5C2.5 4.33696 2.76339 3.70107 3.23223 3.23223C3.70107 2.76339 4.33696 2.5 5 2.5H15C15.663 2.5 16.2989 2.76339 16.7678 3.23223C17.2366 3.70107 17.5 4.33696 17.5 5V15C17.5 15.663 17.2366 16.2989 16.7678 16.7678C16.2989 17.2366 15.663 17.5 15 17.5H5C4.33696 17.5 3.70107 17.2366 3.23223 16.7678C2.76339 16.2989 2.5 15.663 2.5 15V5Z" stroke="#7C8DB5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> |
| 92 | <path d="M2.5 13.3333L6.66667 9.16665C7.44 8.42248 8.39333 8.42248 9.16667 9.16665L13.3333 13.3333" stroke="#7C8DB5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> |
| 93 | <path d="M11.666 11.6667L12.4993 10.8334C13.2727 10.0892 14.226 10.0892 14.9993 10.8334L17.4993 13.3334" stroke="#7C8DB5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> |
| 94 | </g> |
| 95 | <defs> |
| 96 | <clipPath id="clip0_952_123"> |
| 97 | <rect width="20" height="20" fill="white"/> |
| 98 | </clipPath> |
| 99 | </defs> |
| 100 | </svg> |
| 101 | </span> |
| 102 | <span>Images</span> |
| 103 | </div> |
| 104 | </div> |
| 105 | |
| 106 | <div class="entry-content clear" ast-blocks-layout="true" itemprop="text"> |
| 107 | |
| 108 | <div class="sponsored-wrapper video-body toggle-active"> |
| 109 | <div class="sponsored-preview-sectiion"> |
| 110 | <div class="video-ad-prewiew-options"> |
| 111 | <div class="ad__adjust__wrap " style="display: block;"> |
| 112 | |
| 113 | <div class="ad__adjust"> |
| 114 | <form class="ad__adjust__controller" id="ad-preview-0"> |
| 115 | <div class="form-input-wrapper"> |
| 116 | <div class="ad__adjust__controller__item"> |
| 117 | <span class="controller__label negative-margin"><?php echo esc_html__('Upload Ad', 'embedpress'); ?></span> |
| 118 | <div class="ad__adjust__controller__inputs sponsored-upload-options"> |
| 119 | |
| 120 | <button class="uploadBtn" type="button" data-upload-index="0"> |
| 121 | <span class="dashicons dashicons-upload"></span> <?php echo esc_html__('Upload', 'embedpress'); ?> |
| 122 | </button> |
| 123 | |
| 124 | <input type="hidden" id="fileInput-0" name="adFileUrl" value="<?php echo esc_url('https://embedpress.com/wp-content/uploads/2023/12/notificationX-demo-ad.mp4'); ?>" /> |
| 125 | |
| 126 | <p class="uploaded-file-url-0 uploaded"><?php echo esc_html('notificationX-demo-ad.mp4'); ?></p> |
| 127 | |
| 128 | </div> |
| 129 | </div> |
| 130 | |
| 131 | <div class="ad__adjust__controller__item"> |
| 132 | <span class="controller__label"><?php echo esc_html__('Ad Redirection URL', 'embedpress'); ?></span> |
| 133 | <div class="ad__adjust__controller__inputs"> |
| 134 | <input type="url" name="adUrl" id="ad_cta_url" class="form__control" data-default="<?php echo esc_url('https://notificationx.com/'); ?>" value="<?php echo esc_url('https://notificationx.com/'); ?>"> |
| 135 | </div> |
| 136 | </div> |
| 137 | |
| 138 | <div class="ad__adjust__controller__item"> |
| 139 | <span class="controller__label"><?php echo esc_html__('Ad Start After (Sec)', 'embedpress'); ?></span> |
| 140 | <div class="ad__adjust__controller__inputs"> |
| 141 | |
| 142 | <div class="range-control opacity-range_control"> |
| 143 | <span class="range_negative"> |
| 144 | <div class="controller negative-controller"></div> |
| 145 | </span> |
| 146 | <div class="show-value"> |
| 147 | <input type="number" name="adStart" class="form__control range__value" data-default="10" value="10"> |
| 148 | |
| 149 | </div> |
| 150 | |
| 151 | <span class="range_positive"> |
| 152 | <div class="controller controller-roted"></div> |
| 153 | <div class="controller"></div> |
| 154 | </span> |
| 155 | </div> |
| 156 | </div> |
| 157 | </div> |
| 158 | |
| 159 | <div class="ad__adjust__controller__item skip-controller"> |
| 160 | <span class="controller__label"><?php echo esc_html__('Skip Button', 'embedpress'); ?></span> |
| 161 | <div class="ad__adjust__controller__inputs"> |
| 162 | |
| 163 | |
| 164 | <label class="input__switch switch__text "> |
| 165 | <input type="checkbox" name="adSkipButton" data-default="no" data-value="no" value="yes" checked> |
| 166 | <span></span> |
| 167 | |
| 168 | </label> |
| 169 | |
| 170 | |
| 171 | |
| 172 | </div> |
| 173 | </div> |
| 174 | |
| 175 | <div class="ad__adjust__controller__item skip-controller"> |
| 176 | <span class="controller__label"><?php echo esc_html__('Skip Button After (Sec)', 'embedpress'); ?></span> |
| 177 | <div class="ad__adjust__controller__inputs"> |
| 178 | <div class="range-control skip-range_control"> |
| 179 | <span class="range_negative"> |
| 180 | <div class="controller negative-controller"></div> |
| 181 | </span> |
| 182 | <div class="show-value"> |
| 183 | <input type="number" name="adSkipButtonAfter" class="form__control range__value " data-default="5" value="5"> |
| 184 | </div> |
| 185 | |
| 186 | |
| 187 | <span class="range_positive"> |
| 188 | <div class="controller controller-roted"></div> |
| 189 | <div class="controller"></div> |
| 190 | </span> |
| 191 | </div> |
| 192 | </div> |
| 193 | </div> |
| 194 | </div> |
| 195 | |
| 196 | |
| 197 | </form> |
| 198 | |
| 199 | </div> |
| 200 | </div> |
| 201 | </div> |
| 202 | <div class="embedpress-gutenberg-wrapper aligncenter ep-content-protection-disabled inline" id="1c3da3de-7606-4e9f-9693-d4b570cd2ca30"> |
| 203 | <h2 class="wp-block-heading has-text-align-center"><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-ast-global-color-2-color"><?php echo esc_html__('Live Preview for Video', 'embedpress'); ?></h2> |
| 204 | <p class="preview-description"><?php echo esc_html__('Experience EmbedPress Ad feature with YouTube video, but it will work with all embedded contents such as videos, audios, documents, etc..', 'embedpress'); ?></p> |
| 205 | <div class="wp-block-embed__wrapper"> |
| 206 | <div id="ep-gutenberg-content-ep-ad-preview-0" class="ep-gutenberg-content margin-bottom-24px"> |
| 207 | <div data-sponsored-id="ep-ad-preview-0" id="ep-ad-preview-0" class="sponsored-mask" data-ad-index="0"> |
| 208 | <div class="ep-embed-content-wraper "> |
| 209 | <div class="ose-youtube ose-embedpress-responsive"> |
| 210 | <iframe width="560" height="315" src="<?php echo esc_url($youtube_embed_url); ?>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> |
| 211 | </div> |
| 212 | </div> |
| 213 | <div class="main-ad-template" id="ad-template-0" data-adType="video" style="display:none"> |
| 214 | <div class="ep-ad-container"> |
| 215 | <div class="ep-ad-content sponsored-video hidden" style="position: relative;"> |
| 216 | <a target="_blank" class="sponsored-url" href="#"> |
| 217 | |
| 218 | <video class="ep-ad" muted=""> |
| 219 | <source src="<?php echo esc_url($video_demo_adUrl); ?>"> |
| 220 | </video> |
| 221 | |
| 222 | <div class="sponsored-timer"> |
| 223 | <span class="sponsored-running-time"></span> |
| 224 | <span class="sponsored-duration"> • Ad</span> |
| 225 | </div> |
| 226 | <div class="progress-bar-container"> |
| 227 | <div class="progress-bar"></div> |
| 228 | </div> |
| 229 | </a> |
| 230 | |
| 231 | |
| 232 | <button title="Skip Ad" class="skip-ad-button" style="display: none;"> |
| 233 | <?php echo esc_html__('Skip Ad', 'embedpress'); ?> </button> |
| 234 | |
| 235 | </div> |
| 236 | |
| 237 | <div class="ep-ad-content sponsored-image hidden" style="position: relative;"> |
| 238 | <a target="_blank" class="sponsored-url" href="#"> |
| 239 | <img decoding="async" class="ep-ad" src="<?php echo esc_url($image_demo_adUrl); ?>"> |
| 240 | </a> |
| 241 | <button title="Skip Ad" class="skip-ad-button" style="display: inline-block;"> |
| 242 | <?php echo esc_html__('Skip Ad', 'embedpress'); ?> </button> |
| 243 | |
| 244 | </div> |
| 245 | </div> |
| 246 | </div> |
| 247 | </div> |
| 248 | </div> |
| 249 | |
| 250 | <button type="submit" class="button preview-btn-0"> <?php echo esc_html__('Start Preview', 'embedpress'); ?> </button> |
| 251 | </div> |
| 252 | </div> |
| 253 | |
| 254 | |
| 255 | |
| 256 | </div> |
| 257 | </div> |
| 258 | |
| 259 | |
| 260 | <div class="sponsored-wrapper img-body "> |
| 261 | <div class="sponsored-preview-sectiion"> |
| 262 | <div class="video-ad-prewiew-options"> |
| 263 | <div class="ad__adjust__wrap " style="display: block;"> |
| 264 | <div class="ad__adjust"> |
| 265 | <form class="ad__adjust__controller" id="ad-preview-1"> |
| 266 | <div class="form-input-wrapper"> |
| 267 | |
| 268 | <div class="ad__adjust__controller__item"> |
| 269 | <span class="controller__label negative-margin"><?php echo esc_html__('Upload Ad', 'embedpress'); ?></span> |
| 270 | <div class="ad__adjust__controller__inputs sponsored-upload-options"> |
| 271 | <button class="uploadBtn" type="button" data-upload-index="1"> |
| 272 | <span class="dashicons dashicons-upload"></span> <?php echo esc_html__('Upload', 'embedpress'); ?> |
| 273 | </button> |
| 274 | |
| 275 | <input type="hidden" id="fileInput-1" name="adFileUrl" value="<?php echo esc_url($image_demo_adUrl); ?>" /> |
| 276 | <p class="uploaded-file-url-1 uploaded"><?php echo esc_html('demo-ad.gif'); ?></p> |
| 277 | </div> |
| 278 | </div> |
| 279 | |
| 280 | |
| 281 | <div class="ad__adjust__controller__item"> |
| 282 | <span class="controller__label"><?php echo esc_html__('Ad Redirection URL', 'embedpress'); ?></span> |
| 283 | <div class="ad__adjust__controller__inputs"> |
| 284 | <input type="url" name="adUrl" id="ad_cta_url" class="form__control" data-default="<?php echo esc_url('https://notificationx.com/'); ?>" value="<?php echo esc_url('https://notificationx.com/'); ?>"> |
| 285 | </div> |
| 286 | </div> |
| 287 | |
| 288 | <div class="ad__adjust__controller__item"> |
| 289 | <span class="controller__label"><?php echo esc_html__('Ad Start After (Sec)', 'embedpress'); ?></span> |
| 290 | <div class="ad__adjust__controller__inputs"> |
| 291 | <div class="range-control image-range_control"> |
| 292 | <span class="range_negative"> |
| 293 | <div class="controller negative-controller"></div> |
| 294 | </span> |
| 295 | |
| 296 | <div class="show-value"> |
| 297 | <!-- <span class="input-value_show">6</span> --> |
| 298 | <input type="number" name="adStart" class="form__control range__value" data-default="10" value="10"> |
| 299 | </div> |
| 300 | |
| 301 | |
| 302 | <span class="range_positive"> |
| 303 | <div class="controller controller-roted"></div> |
| 304 | <div class="controller"></div> |
| 305 | </span> |
| 306 | </div> |
| 307 | |
| 308 | |
| 309 | </div> |
| 310 | </div> |
| 311 | |
| 312 | <div class="ad__adjust__controller__item skip-controller hidden"> |
| 313 | <span class="controller__label"><?php echo esc_html__('Skip Button', 'embedpress'); ?></span> |
| 314 | <div class="ad__adjust__controller__inputs"> |
| 315 | <label class="input__switch switch__text "> |
| 316 | <input type="checkbox" name="adSkipButton" data-default="no" data-value="no" value="yes" checked> |
| 317 | <span></span> |
| 318 | |
| 319 | </label> |
| 320 | </div> |
| 321 | </div> |
| 322 | |
| 323 | <div class="ad__adjust__controller__item skip-controller hidden"> |
| 324 | <span class="controller__label"><?php echo esc_html__('Skip Button After (Sec)', 'embedpress'); ?></span> |
| 325 | <div class="ad__adjust__controller__inputs"> |
| 326 | |
| 327 | <input readonly="" type="number" name="adSkipButtonAfter" class="form__control range__value" data-default="5" value="5"> |
| 328 | </div> |
| 329 | </div> |
| 330 | |
| 331 | </div> |
| 332 | |
| 333 | </form> |
| 334 | |
| 335 | </div> |
| 336 | </div> |
| 337 | </div> |
| 338 | <div class="embedpress-gutenberg-wrapper aligncenter ep-content-protection-disabled inline" id="1c3da3de-7606-4e9f-9693-d4b570cd2ca31"> |
| 339 | <h2 class="wp-block-heading has-text-align-center"><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-ast-global-color-2-color"><?php echo esc_html__('Live Preview for Documents', 'embedpress'); ?></h2> |
| 340 | |
| 341 | <p class="preview-description"><?php echo esc_html__('Experience EmbedPress Ad feature with with a PDF, but it will work with all embedded contents such as videos, audios, documents, etc..', 'embedpress'); ?></p> |
| 342 | |
| 343 | <div class="wp-block-embed__wrapper "> |
| 344 | <div id="ep-gutenberg-content-ep-ad-preview-1" class="ep-gutenberg-content margin-bottom-24px"> |
| 345 | <div data-sponsored-id="ep-ad-preview-1" id="ep-ad-preview-1" class="sponsored-mask" data-ad-index="0"> |
| 346 | <div class="ep-embed-content-wraper"> |
| 347 | <div class="position-right-wraper gutenberg-pdf-wraper"> |
| 348 | <?php |
| 349 | $pdf_url = EMBEDPRESS_SETTINGS_ASSETS_URL . 'embedpress.pdf'; |
| 350 | $renderer = Helper::get_pdf_renderer(); |
| 351 | $src = $renderer . ((strpos($renderer, '?') == false) ? '?' : '&') . 'file=' . urlencode($pdf_url); |
| 352 | ?> |
| 353 | <iframe title="sample" class="embedpress-embed-document-pdf embedpress-pdf-1701320841615" style="width:550px;height:320px; max-width:100%; display: inline-block" src="<?php echo esc_url($src); ?>" frameborder="0" oncontextmenu="return false;"></iframe> |
| 354 | <!-- <p class="embedpress-el-powered"><?php echo esc_html__('Powered By EmbedPress', 'embedpress'); ?></p> --> |
| 355 | </div> |
| 356 | </div> |
| 357 | |
| 358 | <div class="main-ad-template" id="ad-template-1" data-adType="image" style="display:none"> |
| 359 | <div class="ep-ad-container"> |
| 360 | <div class="ep-ad-content sponsored-video hidden" style="position: relative;"> |
| 361 | <a target="_blank" class="sponsored-url" href="#"> |
| 362 | |
| 363 | <video class="ep-ad" muted=""> |
| 364 | <source src="<?php echo esc_url($video_demo_adUrl); ?>"> |
| 365 | </video> |
| 366 | |
| 367 | <div class="sponsored-timer"> |
| 368 | <span class="sponsored-running-time"></span> |
| 369 | <span class="sponsored-duration"> • Ad</span> |
| 370 | </div> |
| 371 | <div class="progress-bar-container"> |
| 372 | <div class="progress-bar"></div> |
| 373 | </div> |
| 374 | </a> |
| 375 | |
| 376 | |
| 377 | <button title="Skip Ad" class="skip-ad-button" style="display: none;"> |
| 378 | <?php echo esc_html__('Skip Ad', 'embedpress'); ?> </button> |
| 379 | |
| 380 | </div> |
| 381 | |
| 382 | <div class="ep-ad-content sponsored-image hidden" style="position: relative;"> |
| 383 | <a target="_blank" class="sponsored-url" href="#"> |
| 384 | <img decoding="async" class="ep-ad" src="<?php echo esc_url($image_demo_adUrl); ?>"> |
| 385 | </a> |
| 386 | <button title="Skip Ad" class="skip-ad-button" style="display: inline-block;"> |
| 387 | <?php echo esc_html__('Skip Ad', 'embedpress'); ?> </button> |
| 388 | |
| 389 | </div> |
| 390 | </div> |
| 391 | </div> |
| 392 | </div> |
| 393 | </div> |
| 394 | </div> |
| 395 | |
| 396 | <button type="submit" class="button preview-btn-1"> <?php echo esc_html__('Start Preview', 'embedpress'); ?> </button> |
| 397 | |
| 398 | |
| 399 | </div> |
| 400 | |
| 401 | </div> |
| 402 | </div> |
| 403 | </div> |
| 404 | |
| 405 | </div> |
| 406 | |
| 407 | <style> |
| 408 | /* page css */ |
| 409 | .entry-content.clear { |
| 410 | padding: 0 10px; |
| 411 | } |
| 412 | |
| 413 | .sponsored-settings-top { |
| 414 | padding: 20px 25px; |
| 415 | /* background: #EEEDF4; */ |
| 416 | color: #444; |
| 417 | border-radius: 15px; |
| 418 | display: flex; |
| 419 | align-items: center; |
| 420 | justify-content: space-between; |
| 421 | margin-bottom: 60px; |
| 422 | border: 1px solid #f9f3f3; |
| 423 | } |
| 424 | |
| 425 | .sponsored-settings-content { |
| 426 | width: calc(100% - 240px); |
| 427 | } |
| 428 | |
| 429 | h3.ads-settings-title { |
| 430 | color: #131F4D; |
| 431 | margin-bottom: 10px; |
| 432 | font-size: 18px; |
| 433 | } |
| 434 | |
| 435 | p.ads-settings-description { |
| 436 | font-size: 16px; |
| 437 | line-height: 1.6; |
| 438 | color: #25396F; |
| 439 | text-align: justify; |
| 440 | } |
| 441 | |
| 442 | .ad__adjust__controller__item .controller__label { |
| 443 | font-size: 16px; |
| 444 | font-weight: 400; |
| 445 | color: #7C8DB5; |
| 446 | width: 180px; |
| 447 | } |
| 448 | |
| 449 | .sponsored-preview-sectiion { |
| 450 | display: flex; |
| 451 | gap: 30px; |
| 452 | justify-content: space-around; |
| 453 | margin-bottom: 60px; |
| 454 | border-bottom: 1px solid #ddd; |
| 455 | padding-bottom: 60px; |
| 456 | } |
| 457 | |
| 458 | |
| 459 | .sponsored-upload-options { |
| 460 | width: 320px; |
| 461 | } |
| 462 | |
| 463 | p.uploaded { |
| 464 | background: #efeef5; |
| 465 | padding: 5px 10px; |
| 466 | word-wrap: break-word; |
| 467 | border-radius: 5px; |
| 468 | } |
| 469 | |
| 470 | button.uploadBtn { |
| 471 | font-size: 14px; |
| 472 | padding: 10px 15px; |
| 473 | border-radius: 5px; |
| 474 | display: flex; |
| 475 | align-items: center; |
| 476 | gap: 5px; |
| 477 | border: 1px solid #ddd; |
| 478 | cursor: pointer; |
| 479 | color: #394b7b; |
| 480 | margin-bottom: 10px; |
| 481 | |
| 482 | } |
| 483 | |
| 484 | button.uploadBtn span.dashicons.dashicons-upload { |
| 485 | font-size: 18px; |
| 486 | } |
| 487 | |
| 488 | .video-ad-prewiew-options { |
| 489 | width: 45% |
| 490 | } |
| 491 | |
| 492 | .ad__adjust__controller__item { |
| 493 | display: flex; |
| 494 | align-items: center; |
| 495 | justify-content: space-between; |
| 496 | margin-bottom: 30px; |
| 497 | gap: 20px; |
| 498 | } |
| 499 | |
| 500 | .ad__adjust__controller__inputs { |
| 501 | max-width: 100%; |
| 502 | width: calc(100% - 15px); |
| 503 | } |
| 504 | |
| 505 | .ad__adjust__controller__inputs p { |
| 506 | margin-top: 5px; |
| 507 | color: #131F4D; |
| 508 | } |
| 509 | |
| 510 | /* Common Styles */ |
| 511 | /* .sponsored-mask .ose-embedpress-responsive { |
| 512 | position: relative; |
| 513 | } */ |
| 514 | |
| 515 | .sponsored-running { |
| 516 | display: inline-block !important; |
| 517 | } |
| 518 | |
| 519 | .ep-ad-content.sponsored-image img { |
| 520 | object-fit: cover; |
| 521 | } |
| 522 | |
| 523 | .ep-ad-content.sponsored-image { |
| 524 | height: 100%; |
| 525 | width: 100%; |
| 526 | } |
| 527 | |
| 528 | /* .sponsored-mask .ep-embed-content-wraper::after { |
| 529 | content: ''; |
| 530 | position: absolute; |
| 531 | top: 0; |
| 532 | left: 0; |
| 533 | right: 0; |
| 534 | bottom: 0; |
| 535 | } */ |
| 536 | |
| 537 | .ep-embed-content-wraper { |
| 538 | position: relative; |
| 539 | } |
| 540 | .ep-embed-content-wraper iframe{ |
| 541 | border-radius: 8px; |
| 542 | } |
| 543 | |
| 544 | .embedpress-gutenberg-wrapper { |
| 545 | width: 55%; |
| 546 | } |
| 547 | |
| 548 | h2.wp-block-heading { |
| 549 | font-size: 22px; |
| 550 | margin-bottom: 12px; |
| 551 | color: #131F4D |
| 552 | } |
| 553 | |
| 554 | p.preview-description { |
| 555 | font-size: 16px; |
| 556 | line-height: 1.6; |
| 557 | color: #7C8DB5; |
| 558 | margin-bottom: 15px; |
| 559 | width: 580px; |
| 560 | max-width: 100%; |
| 561 | text-align: justify; |
| 562 | } |
| 563 | |
| 564 | .ose-youtube { |
| 565 | /* display: none !important; */ |
| 566 | opacity: 0 |
| 567 | } |
| 568 | |
| 569 | div[data-sponsored-id] { |
| 570 | position: relative; |
| 571 | display: inline-block; |
| 572 | max-width: 100%; |
| 573 | } |
| 574 | .embedpress-document-embed div[data-sponsored-id] { |
| 575 | width: 100%; |
| 576 | } |
| 577 | |
| 578 | .main-ad-template.image.sponsored-running { |
| 579 | position: absolute; |
| 580 | z-index: 1; |
| 581 | bottom: 75px; |
| 582 | left: 50%; |
| 583 | height: auto; |
| 584 | } |
| 585 | |
| 586 | [data-sponsored-id] .main-ad-template.image.sponsored-running { |
| 587 | border-radius: 5px; |
| 588 | } |
| 589 | |
| 590 | .ep-ad-container { |
| 591 | position: relative; |
| 592 | height: 100%; |
| 593 | display: flex; |
| 594 | align-items: center; |
| 595 | background-color: #000; |
| 596 | justify-content: center; |
| 597 | |
| 598 | } |
| 599 | |
| 600 | .ep-ad-content.sponsored-video { |
| 601 | height: 100%; |
| 602 | } |
| 603 | |
| 604 | a.sponsored-url { |
| 605 | display: inline; |
| 606 | } |
| 607 | |
| 608 | .main-ad-template video, |
| 609 | .main-ad-template img { |
| 610 | width: 100%; |
| 611 | height: 100%; |
| 612 | background-color: #000; |
| 613 | } |
| 614 | |
| 615 | .progress-bar-container { |
| 616 | margin-top: -10px; |
| 617 | background: #ff000021; |
| 618 | } |
| 619 | |
| 620 | .progress-bar { |
| 621 | background: #5be82a; |
| 622 | height: 5px; |
| 623 | margin-top: -4px; |
| 624 | max-width: 100%; |
| 625 | } |
| 626 | |
| 627 | button.skip-ad-button { |
| 628 | position: absolute; |
| 629 | bottom: 15px; |
| 630 | right: 10px; |
| 631 | border: none; |
| 632 | background: #d41556b5 !important; |
| 633 | color: white !important; |
| 634 | z-index: 999999999; |
| 635 | font-size: 14px; |
| 636 | border-radius: 4px; |
| 637 | height: 30px; |
| 638 | width: 80px; |
| 639 | font-weight: normal; |
| 640 | display: flex; |
| 641 | align-items: center; |
| 642 | justify-content: center; |
| 643 | cursor: pointer; |
| 644 | text-transform: capitalize; |
| 645 | font-weight: 600; |
| 646 | font-size: 12px; |
| 647 | padding: 0; |
| 648 | } |
| 649 | |
| 650 | .sponsored-timer { |
| 651 | position: absolute; |
| 652 | background: #d41556b5; |
| 653 | font-size: 14px; |
| 654 | width: 110px; |
| 655 | color: white; |
| 656 | bottom: 15px; |
| 657 | left: 10px; |
| 658 | text-align: center; |
| 659 | border-radius: 4px; |
| 660 | height: 30px; |
| 661 | width: 80px; |
| 662 | font-weight: normal; |
| 663 | display: flex; |
| 664 | align-items: center; |
| 665 | justify-content: center; |
| 666 | } |
| 667 | |
| 668 | [data-sponsored-id] .hidden, |
| 669 | .hidden { |
| 670 | display: none !important; |
| 671 | } |
| 672 | |
| 673 | /* Specific Styles for Ad Type 1 */ |
| 674 | [data-sponsored-id="ep-ad-preview-0"] .main-ad-template { |
| 675 | width: 550px; |
| 676 | height: 310px; |
| 677 | max-width: 100%; |
| 678 | display: inline-block; |
| 679 | border-radius: 12px; |
| 680 | overflow: hidden; |
| 681 | } |
| 682 | |
| 683 | [data-sponsored-id="ep-ad-preview-0"] .main-ad-template.image.sponsored-running { |
| 684 | width: 300px; |
| 685 | height: 200px; |
| 686 | bottom: 10%; |
| 687 | left: 25%; |
| 688 | } |
| 689 | |
| 690 | /* Specific Styles for Ad Type 2 */ |
| 691 | [data-sponsored-id="ep-ad-preview-1"] .main-ad-template { |
| 692 | width: 550px; |
| 693 | height: 310px; |
| 694 | max-width: 100%; |
| 695 | display: inline-block; |
| 696 | } |
| 697 | |
| 698 | [data-sponsored-id="ep-ad-preview-1"] .main-ad-template.image.sponsored-running { |
| 699 | width: 300px !important; |
| 700 | height: 200px !important; |
| 701 | bottom: 10%; |
| 702 | left: 25%; |
| 703 | } |
| 704 | |
| 705 | iframe.ose-youtube { |
| 706 | /* display: none !important; */ |
| 707 | max-width: 100%; |
| 708 | max-height: 310px; |
| 709 | height: 310px; |
| 710 | width: 550px; |
| 711 | } |
| 712 | |
| 713 | .position-right-wraper.gutenberg-pdf-wraper iframe { |
| 714 | border: 1px solid #ddd; |
| 715 | } |
| 716 | |
| 717 | p.embedpress-el-powered { |
| 718 | text-align: center; |
| 719 | } |
| 720 | |
| 721 | .info-message-section { |
| 722 | max-width: 800px; |
| 723 | margin: auto; |
| 724 | margin-bottom: 60px; |
| 725 | width: 100%; |
| 726 | } |
| 727 | |
| 728 | .info-message { |
| 729 | display: flex; |
| 730 | align-items: center; |
| 731 | gap: 10px; |
| 732 | /* background: #fbebed; */ |
| 733 | padding: 12px; |
| 734 | border-radius: 5px; |
| 735 | font-size: 14px; |
| 736 | line-height: 1.4em; |
| 737 | border-left: 4px solid #fe8c59; |
| 738 | border: 1px solid #faf4f4; |
| 739 | color: #25396F; |
| 740 | } |
| 741 | |
| 742 | .info-message svg { |
| 743 | width: 18px; |
| 744 | } |
| 745 | |
| 746 | span.dashicons.dashicons-warning { |
| 747 | color: #fe8c59; |
| 748 | } |
| 749 | |
| 750 | @media only screen and (max-width: 1540px) { |
| 751 | |
| 752 | |
| 753 | .ad__adjust__controller__item { |
| 754 | flex-direction: column; |
| 755 | align-items: start; |
| 756 | padding-right: 15px; |
| 757 | gap: 10px; |
| 758 | } |
| 759 | |
| 760 | .video-ad-prewiew-options .form-input-wrapper { |
| 761 | max-height: 440px; |
| 762 | overflow: auto; |
| 763 | max-width: 100%; |
| 764 | } |
| 765 | |
| 766 | |
| 767 | .video-ad-prewiew-options .form-input-wrapper::-webkit-scrollbar { |
| 768 | width: 5px; |
| 769 | } |
| 770 | |
| 771 | .video-ad-prewiew-options .form-input-wrapper::-webkit-scrollbar-track { |
| 772 | background: #f5f7fd; |
| 773 | border-radius: 5px; |
| 774 | } |
| 775 | |
| 776 | .video-ad-prewiew-options .form-input-wrapper::-webkit-scrollbar-thumb { |
| 777 | background: #988FBD; |
| 778 | border-radius: 5px; |
| 779 | } |
| 780 | |
| 781 | .template__wrapper input[type=range] { |
| 782 | margin: 0; |
| 783 | } |
| 784 | |
| 785 | form#ad-preview-0 .form-input-wrapper { |
| 786 | max-height: 400px !important; |
| 787 | } |
| 788 | } |
| 789 | |
| 790 | |
| 791 | @media only screen and (max-width: 1440px) { |
| 792 | .embedpress-gutenberg-wrapper { |
| 793 | width: 60%; |
| 794 | } |
| 795 | |
| 796 | .video-ad-prewiew-options { |
| 797 | width: 40% |
| 798 | } |
| 799 | } |
| 800 | |
| 801 | @media screen and (max-width: 1250px) { |
| 802 | .sponsored-preview-sectiion { |
| 803 | flex-direction: column-reverse; |
| 804 | } |
| 805 | |
| 806 | .video-ad-prewiew-options { |
| 807 | width: 100%; |
| 808 | } |
| 809 | |
| 810 | .embedpress-gutenberg-wrapper { |
| 811 | width: 100%; |
| 812 | } |
| 813 | |
| 814 | .sponsored-settings-top { |
| 815 | display: block; |
| 816 | } |
| 817 | |
| 818 | .sponsored-settings-content { |
| 819 | width: 100%; |
| 820 | margin-bottom: 15px; |
| 821 | } |
| 822 | |
| 823 | h3.ads-settings-title { |
| 824 | line-height: 1.5; |
| 825 | } |
| 826 | |
| 827 | p.ads-settings-description { |
| 828 | line-height: 1.3; |
| 829 | } |
| 830 | } |
| 831 | |
| 832 | @media screen and (max-width: 991px) { |
| 833 | div[data-sponsored-id] { |
| 834 | max-width: 100%; |
| 835 | display: block; |
| 836 | } |
| 837 | |
| 838 | iframe.ose-youtube { |
| 839 | width: 100%; |
| 840 | height: 400px; |
| 841 | max-height: 100%; |
| 842 | } |
| 843 | } |
| 844 | </style> |
| 845 | |
| 846 | |
| 847 | <script> |
| 848 | // Check if data-playerid attribute exists and get its value |
| 849 | const isPyr = document.querySelector('[data-playerid]')?.getAttribute('data-playerid'); |
| 850 | |
| 851 | if (!isPyr) { |
| 852 | var scriptUrl = 'https://www.youtube.com/s/player/9d15588c/www-widgetapi.vflset/www-widgetapi.js'; |
| 853 | try { |
| 854 | var ttPolicy = window.trustedTypes.createPolicy("youtube-widget-api", { |
| 855 | createScriptURL: function(x) { |
| 856 | return x; |
| 857 | } |
| 858 | }); |
| 859 | scriptUrl = ttPolicy.createScriptURL(scriptUrl); |
| 860 | } catch (e) {} |
| 861 | |
| 862 | var YT; |
| 863 | if (!window["YT"]) YT = { loading: 0, loaded: 0 }; |
| 864 | var YTConfig; |
| 865 | if (!window["YTConfig"]) YTConfig = { "host": "https://www.youtube.com" }; |
| 866 | if (!YT.loading) { |
| 867 | YT.loading = 1; |
| 868 | (function() { |
| 869 | var l = []; |
| 870 | YT.ready = function(f) { |
| 871 | if (YT.loaded) f(); |
| 872 | else l.push(f); |
| 873 | }; |
| 874 | window.onYTReady = function() { |
| 875 | YT.loaded = 1; |
| 876 | var i = 0; |
| 877 | for (; i < l.length; i++) try { |
| 878 | l[i](); |
| 879 | } catch (e) {} |
| 880 | }; |
| 881 | YT.setConfig = function(c) { |
| 882 | var k; |
| 883 | for (k in c) |
| 884 | if (c.hasOwnProperty(k)) YTConfig[k] = c[k]; |
| 885 | }; |
| 886 | var a = document.createElement("script"); |
| 887 | a.type = "text/javascript"; |
| 888 | a.id = "www-widgetapi-script"; |
| 889 | a.src = scriptUrl; |
| 890 | a.async = true; |
| 891 | var c = document.currentScript; |
| 892 | if (c) { |
| 893 | var n = c.nonce || c.getAttribute("nonce"); |
| 894 | if (n) a.setAttribute("nonce", n); |
| 895 | } |
| 896 | var b = document.getElementsByTagName("script")[0]; |
| 897 | b.parentNode.insertBefore(a, b); |
| 898 | })(); |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | let adsContainers = document.querySelectorAll('[data-sponsored-id]'); |
| 903 | let container = document.querySelector('[data-sponsored-id]'); |
| 904 | var player = []; |
| 905 | var playerInit = []; |
| 906 | var playerIndex = 0; |
| 907 | let adTimeout; |
| 908 | |
| 909 | adsContainers = Array.from(adsContainers); |
| 910 | |
| 911 | const getYTVideoId = (url) => { |
| 912 | // Check if the input is a string |
| 913 | if (typeof url !== 'string') { |
| 914 | return false; |
| 915 | } |
| 916 | |
| 917 | const regex = /(?:youtube\.com\/(?:[^\/]+\/[^\/]+\/|(?:v|e(?:mbed)?)\/|[^#]*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/; |
| 918 | const match = url.match(regex); |
| 919 | |
| 920 | if (match && match[1]) { |
| 921 | return match[1]; |
| 922 | } |
| 923 | return false; |
| 924 | } |
| 925 | |
| 926 | const hasParentClass = (element, className) => { |
| 927 | var parent = element.parentNode; |
| 928 | |
| 929 | while (parent && !(parent.classList && parent.classList.contains(className))) { |
| 930 | parent = parent.parentNode; |
| 931 | } |
| 932 | |
| 933 | return !!(parent && parent.classList && parent.classList.contains(className)); |
| 934 | } |
| 935 | |
| 936 | |
| 937 | const adInitialization = (adContainer, index, adAtts, adType) => { |
| 938 | const blockId = adAtts.clientId; |
| 939 | const blockIdMD5 = adContainer.getAttribute('data-sponsored-id'); |
| 940 | const adStartAfter = adAtts.adStart * 1000; |
| 941 | const adContent = adAtts.adContent; |
| 942 | const adVideo = adContainer.querySelector('.ep-ad'); |
| 943 | const adSource = adAtts.adSource; |
| 944 | const adVideos = []; |
| 945 | const srcUrl = adAtts.url || adAtts.embedpress_embeded_link; |
| 946 | const adSkipButtonAfter = parseInt(adAtts.adSkipButtonAfter); |
| 947 | const adSkipButton = adAtts.adSkipButton; |
| 948 | const adUrl = adAtts.adUrl; |
| 949 | |
| 950 | adVideos.push(adVideo); |
| 951 | |
| 952 | const adTemplate = adContainer.querySelector('.main-ad-template'); |
| 953 | const imageAdTemplate = adContainer.querySelector('.main-ad-template.image'); |
| 954 | const progressBar = adContainer.querySelector('.progress-bar'); |
| 955 | const skipButton = adTemplate.querySelector('.skip-ad-button'); |
| 956 | const adRunningTime = adContainer.querySelector('.sponsored-running-time'); |
| 957 | var playerId; |
| 958 | const adMask = adContainer; |
| 959 | |
| 960 | let playbackInitiated = false; |
| 961 | |
| 962 | if (skipButton && adSource !== 'video') { |
| 963 | skipButton.style.display = 'inline-block'; |
| 964 | } |
| 965 | |
| 966 | const hashClass = hasParentClass(adContainer, 'ep-content-protection-enabled'); |
| 967 | |
| 968 | if (hashClass) { |
| 969 | adContainer.classList.remove('sponsored-mask'); |
| 970 | } |
| 971 | |
| 972 | playerId = adContainer.querySelector('[data-playerid]')?.getAttribute('data-playerid'); |
| 973 | |
| 974 | if (getYTVideoId(srcUrl)) { |
| 975 | player[index]?.playVideo(); |
| 976 | player[index]?.seekTo(0); |
| 977 | } |
| 978 | clearTimeout(adTimeout); |
| 979 | |
| 980 | adTemplate.classList.remove('image', 'video'); |
| 981 | adTemplate.classList.add(adType); |
| 982 | |
| 983 | if (adType === 'image' && adUrl) { |
| 984 | adTemplate.querySelector('.sponsored-image .sponsored-url')?.setAttribute('href', adUrl); |
| 985 | } else { |
| 986 | adTemplate.querySelector('.sponsored-video .sponsored-url')?.setAttribute('href', adUrl); |
| 987 | } |
| 988 | |
| 989 | if (!playbackInitiated) { |
| 990 | adTimeout = setTimeout(() => { |
| 991 | if (adSource !== 'image') { |
| 992 | adContainer.querySelector('.ep-embed-content-wraper').classList.add('hidden'); |
| 993 | } |
| 994 | adTemplate?.classList.add('sponsored-running'); |
| 995 | adTemplate?.classList.remove('hidden'); |
| 996 | if (adVideo && adSource === 'video') { |
| 997 | adVideo.muted = false; |
| 998 | adTemplate.querySelector('.sponsored-video').classList.remove('hidden'); |
| 999 | adTemplate.querySelector('.sponsored-image').classList.add('hidden'); |
| 1000 | adVideo.play(); |
| 1001 | } |
| 1002 | |
| 1003 | if (adType === 'image') { |
| 1004 | adTemplate.querySelector('.sponsored-image').classList.remove('hidden'); |
| 1005 | adTemplate.querySelector('.sponsored-video').classList.add('hidden'); |
| 1006 | } |
| 1007 | }, adStartAfter); |
| 1008 | |
| 1009 | playbackInitiated = true; |
| 1010 | } |
| 1011 | |
| 1012 | adContainer.classList.remove('sponsored-mask'); |
| 1013 | |
| 1014 | if (adType == 'video') { |
| 1015 | adVideo?.addEventListener('timeupdate', () => { |
| 1016 | const currentTime = adVideo?.currentTime; |
| 1017 | const videoDuration = adVideo?.duration; |
| 1018 | |
| 1019 | if (currentTime <= videoDuration) { |
| 1020 | const remainingTime = Math.max(0, videoDuration - currentTime); // Ensure it's not negative |
| 1021 | adRunningTime.innerText = Math.floor(remainingTime / 60) + ':' + (Math.floor(remainingTime) % 60).toString().padStart(2, '0'); |
| 1022 | } |
| 1023 | |
| 1024 | if (!isNaN(currentTime) && !isNaN(videoDuration)) { |
| 1025 | const progress = (currentTime / videoDuration) * 100; |
| 1026 | progressBar.style.width = progress + '%'; |
| 1027 | |
| 1028 | if (adSkipButton && currentTime >= adSkipButtonAfter) { |
| 1029 | skipButton.style.display = 'inline-block'; |
| 1030 | } else { |
| 1031 | skipButton.style.display = 'none'; |
| 1032 | } |
| 1033 | } |
| 1034 | }); |
| 1035 | } |
| 1036 | |
| 1037 | document?.addEventListener('click', (event) => { |
| 1038 | if (event.target.classList.contains('skip-ad-button')) { |
| 1039 | adTemplate?.classList.remove('sponsored-running'); |
| 1040 | document.querySelector('.preview-btn-' + index).innerText = 'Play Preview'; |
| 1041 | document.querySelector('.preview-btn-' + index).removeAttribute('disabled'); |
| 1042 | |
| 1043 | if (adType == 'video') { |
| 1044 | adVideo.pause(); |
| 1045 | adVideo.currentTime = 0; |
| 1046 | |
| 1047 | if (getYTVideoId(srcUrl)) { |
| 1048 | player[index]?.playVideo(); |
| 1049 | } |
| 1050 | adTemplate.querySelector('.sponsored-video').classList.add('hidden'); |
| 1051 | |
| 1052 | } else { |
| 1053 | adTemplate.querySelector('.sponsored-image').classList.add('hidden'); |
| 1054 | } |
| 1055 | adContainer.querySelector('.ep-embed-content-wraper').classList.remove('hidden'); |
| 1056 | } |
| 1057 | }); |
| 1058 | |
| 1059 | if (adType == 'video') { |
| 1060 | adVideo?.addEventListener('play', () => { |
| 1061 | if (typeof playerInit !== 'undefined' && playerInit.length > 0) { |
| 1062 | playerInit[playerId]?.stop(); |
| 1063 | } |
| 1064 | }); |
| 1065 | |
| 1066 | adVideo?.addEventListener('ended', () => { |
| 1067 | adTemplate.classList.add('hidden'); |
| 1068 | adContainer.querySelector('.ep-embed-content-wraper').classList.remove('hidden'); |
| 1069 | document.querySelector('.preview-btn-' + index).innerText = 'Play Preview'; |
| 1070 | document.querySelector('.preview-btn-' + index).removeAttribute('disabled'); |
| 1071 | }); |
| 1072 | } |
| 1073 | playerIndex++; |
| 1074 | } |
| 1075 | |
| 1076 | function onYouTubeIframeAPIReady(iframe, srcUrl, adVideo, index) { |
| 1077 | if (iframe && getYTVideoId(srcUrl) !== null) { |
| 1078 | player[index] = new YT.Player(iframe, { |
| 1079 | videoId: getYTVideoId(srcUrl), |
| 1080 | events: { |
| 1081 | 'onReady': (event) => onPlayerReady(event, adVideo), |
| 1082 | } |
| 1083 | }); |
| 1084 | } |
| 1085 | } |
| 1086 | |
| 1087 | function onPlayerReady(event, adVideo) { |
| 1088 | adVideo?.addEventListener('ended', function() { |
| 1089 | event.target.playVideo(); |
| 1090 | }); |
| 1091 | |
| 1092 | adVideo?.addEventListener('play', function() { |
| 1093 | event.target.pauseVideo(); |
| 1094 | }); |
| 1095 | event.target.g.style = 'opacity: 1'; |
| 1096 | } |
| 1097 | |
| 1098 | window.onload = function() { |
| 1099 | let yVideos = setInterval(() => { |
| 1100 | var youtubeVideos = document.querySelectorAll('.ose-youtube'); |
| 1101 | if (youtubeVideos.length > 0) { |
| 1102 | clearInterval(yVideos); |
| 1103 | |
| 1104 | youtubeVideos.forEach((yVideo, index) => { |
| 1105 | const srcUrl = yVideo.querySelector('iframe')?.getAttribute('src'); |
| 1106 | const adVideo = yVideo.closest('.sponsored-mask')?.querySelector('.ep-ad'); |
| 1107 | const isYTChannel = yVideo.closest('.sponsored-mask')?.querySelector('.ep-youtube-channel'); |
| 1108 | if (adVideo && !isYTChannel) { |
| 1109 | onYouTubeIframeAPIReady(yVideo, srcUrl, adVideo, index); |
| 1110 | } |
| 1111 | }); |
| 1112 | } |
| 1113 | }, 100); |
| 1114 | }; |
| 1115 | |
| 1116 | function getFormData(index) { |
| 1117 | var form = document.getElementById("ad-preview-" + index); |
| 1118 | var formData = new FormData(form); |
| 1119 | |
| 1120 | var formDataObject = {}; |
| 1121 | formData.forEach(function(value, key) { |
| 1122 | formDataObject[key] = value; |
| 1123 | }); |
| 1124 | |
| 1125 | return formDataObject; |
| 1126 | } |
| 1127 | |
| 1128 | const rangeUpdate = () => { |
| 1129 | var rangeInputs = document.querySelectorAll('input[type="range"]'); |
| 1130 | var numberInputs = document.querySelectorAll('input[type="number"]'); |
| 1131 | |
| 1132 | rangeInputs.forEach(function(rangeInput, index) { |
| 1133 | var numberInput = numberInputs[index]; |
| 1134 | |
| 1135 | rangeInput.addEventListener('input', function() { |
| 1136 | numberInput.value = rangeInput.value; |
| 1137 | }); |
| 1138 | }); |
| 1139 | } |
| 1140 | |
| 1141 | rangeUpdate(); |
| 1142 | |
| 1143 | jQuery(document).on('click', '.preview-btn-0', function(e) { |
| 1144 | e.preventDefault(); |
| 1145 | const index = 0; |
| 1146 | const adContainer = document.querySelector('#ep-ad-preview-' + index); |
| 1147 | const adType = document.querySelector('#ad-template-' + index).getAttribute('data-adType'); |
| 1148 | const currentAdAtts = getFormData(index); |
| 1149 | |
| 1150 | const adAtts = { |
| 1151 | "clientId": "1c3da3de-7606-4e9f-9693-d4b570cd2ca30", |
| 1152 | "url": "https://www.youtube.com/watch?v=AMU66nbFnGg&pp=ygUMd3BkZXZlbG9lcGVy", |
| 1153 | "height": "310", |
| 1154 | "adManager": true, |
| 1155 | "adFileUrl": currentAdAtts?.adFileUrl, |
| 1156 | "adUrl": currentAdAtts?.adUrl, |
| 1157 | "width": "600", |
| 1158 | "adSource": adType ?? 'video', |
| 1159 | "adXPosition": 25, |
| 1160 | "adYPosition": 10, |
| 1161 | "adStart": currentAdAtts?.adStart, |
| 1162 | "adSkipButton": currentAdAtts?.adSkipButton === 'yes' ? true : false, |
| 1163 | "adSkipButtonAfter": currentAdAtts?.adSkipButtonAfter |
| 1164 | } |
| 1165 | |
| 1166 | console.log(currentAdAtts); |
| 1167 | |
| 1168 | if (currentAdAtts?.adFileUrl) { |
| 1169 | adInitialization(adContainer, index, adAtts, adType); |
| 1170 | jQuery('.preview-btn-' + index).attr('disabled', true); |
| 1171 | |
| 1172 | let startIn = parseInt(currentAdAtts?.adStart) - 1; |
| 1173 | const setIntervalId = setInterval(() => { |
| 1174 | jQuery('.preview-btn-' + index).text('Ad starting in ' + startIn-- + ' sec'); |
| 1175 | if (startIn === -1) { |
| 1176 | clearInterval(setIntervalId); |
| 1177 | jQuery('.preview-btn-' + index).text('Ad Running'); |
| 1178 | } |
| 1179 | }, 1000); |
| 1180 | } else { |
| 1181 | jQuery('.uploaded-file-url-' + index).text('Please upload a video/image Ad.'); |
| 1182 | } |
| 1183 | }); |
| 1184 | |
| 1185 | jQuery(document).on('click', '.preview-btn-1', function(e) { |
| 1186 | e.preventDefault(); |
| 1187 | const index = 1; |
| 1188 | const adContainer = document.querySelector('#ep-ad-preview-' + index); |
| 1189 | const adType = document.querySelector('#ad-template-' + index).getAttribute('data-adType'); |
| 1190 | const currentAdAtts = getFormData(index); |
| 1191 | |
| 1192 | const adAtts = { |
| 1193 | "clientId": "1c3da3de-7606-4e9f-9693-d4b570cd2ca31", |
| 1194 | "url": "https://www.africau.edu/images/default/sample.pdf", |
| 1195 | "height": "310", |
| 1196 | "adManager": true, |
| 1197 | "adFileUrl": currentAdAtts?.adFileUrl, |
| 1198 | "adUrl": currentAdAtts?.adUrl, |
| 1199 | "width": "600", |
| 1200 | "adSource": adType ?? 'video', |
| 1201 | "adXPosition": 25, |
| 1202 | "adYPosition": 10, |
| 1203 | "adStart": currentAdAtts?.adStart, |
| 1204 | "adSkipButton": currentAdAtts?.adSkipButton === 'yes' ? true : false, |
| 1205 | "adSkipButtonAfter": currentAdAtts?.adSkipButtonAfter |
| 1206 | } |
| 1207 | |
| 1208 | if (currentAdAtts?.adFileUrl) { |
| 1209 | adInitialization(adContainer, index, adAtts, adType); |
| 1210 | jQuery('.preview-btn-' + index).attr('disabled', true); |
| 1211 | |
| 1212 | let startIn = parseInt(currentAdAtts?.adStart) - 1; |
| 1213 | const setIntervalId = setInterval(() => { |
| 1214 | jQuery('.preview-btn-' + index).text('Ad starting in ' + startIn-- + ' sec'); |
| 1215 | if (startIn === -1) { |
| 1216 | clearInterval(setIntervalId); |
| 1217 | jQuery('.preview-btn-' + index).text('Ad Running'); |
| 1218 | } |
| 1219 | }, 1000); |
| 1220 | } else { |
| 1221 | jQuery('.uploaded-file-url-' + index).text('Please upload a video/image Ad.'); |
| 1222 | } |
| 1223 | }); |
| 1224 | </script> |
| 1225 | |
| 1226 | <script> |
| 1227 | jQuery(document).ready(function($) { |
| 1228 | var mediaUploader; |
| 1229 | |
| 1230 | // Trigger when the "Upload" button is clicked |
| 1231 | $('.uploadBtn').click(function(e) { |
| 1232 | e.preventDefault(); |
| 1233 | |
| 1234 | const index = $(this).data('upload-index'); |
| 1235 | |
| 1236 | // Reset mediaUploader variable |
| 1237 | mediaUploader = undefined; |
| 1238 | |
| 1239 | if (mediaUploader) { |
| 1240 | mediaUploader.open(); |
| 1241 | return; |
| 1242 | } |
| 1243 | |
| 1244 | // Extend the wp.media object |
| 1245 | mediaUploader = wp.media.frames.file_frame = wp.media({ |
| 1246 | title: 'Choose File', |
| 1247 | button: { |
| 1248 | text: 'Choose File' |
| 1249 | }, |
| 1250 | multiple: false, |
| 1251 | library: { |
| 1252 | type: ['image', 'video'] |
| 1253 | }, |
| 1254 | }); |
| 1255 | |
| 1256 | // Handle the file selection |
| 1257 | mediaUploader.on('select', function() { |
| 1258 | var attachment = mediaUploader.state().get('selection').first().toJSON(); |
| 1259 | |
| 1260 | if (attachment.type === 'image') { |
| 1261 | $('#ad-preview-' + index + ' .skip-controller').addClass('hidden'); |
| 1262 | $('#ad-preview-' + index + ' .image-ad-control').removeClass('hidden'); |
| 1263 | $('#ad-template-' + index + ' img').attr('src', attachment.url); |
| 1264 | |
| 1265 | } else { |
| 1266 | $('#ad-preview-' + index + ' .skip-controller').removeClass('hidden'); |
| 1267 | $('#ad-preview-' + index + ' .image-ad-control').addClass('hidden'); |
| 1268 | $('#ad-template-' + index + ' video').attr('src', attachment.url); |
| 1269 | } |
| 1270 | |
| 1271 | $('#fileInput-' + index).val(attachment.url); |
| 1272 | $('.uploaded-file-url-' + index).text('File Name: ' + attachment.name + '.' + attachment.subtype); |
| 1273 | $('#ad-template-' + index).attr('data-adType', attachment.type); |
| 1274 | $('.uploaded-file-url-' + index).addClass('uploaded'); |
| 1275 | }); |
| 1276 | |
| 1277 | // Open the media uploader |
| 1278 | mediaUploader.open(); |
| 1279 | }); |
| 1280 | }); |
| 1281 | </script> |