[php] test
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- <?php
- $var = 'var selectedScenes = location.search.split(\'n=\')[1];
- if (selectedScenes != undefined) {
- selectedScenes = selectedScenes.split(",");
- var rows = $(\'table tbody tr td:first-child\')
- rows.each(function (index) {
- var sceneNum = $(this).text();
- if (selectedScenes.indexOf(sceneNum) == -1) {
- $(this).closest(\'tr\').remove();
- }
- });
- }
- var clipboard = new Clipboard(".btn-copy-to-clipboard");
- clipboard.on(\'success\', function (e) {
- $(".copy_message").text("Copied to clipboard").show();
- $("#embedding_modal").modal("hide")
- });
- $(".btn-embed").on("click", function (event) {
- $(".copy_message").hide();
- var row = $(event.target).closest("tr");
- var embed_code = embed_generator.generate_embeding_code(row[0]);
- $("#embed_code_textarea").val(embed_code.tags)
- $(".video_title_span").text(embed_code.title)
- $(\'#embedding_modal\').modal(\'show\')
- })
- var embed_generator = {};
- embed_generator["generate_embeding_code"] = function (row) {
- var children = row.children;
- var poster_image = row.getAttribute(\'data-poster-url\');
- var title = children[1].textContent.trim();
- var video_type = children[5].textContent.trim();
- var video_format = video_type == "180" ? "STEREO_180_LR" : "STEREO_360_TB"
- var stream_urls = [];
- var anchors_node = children[8].querySelectorAll(\'a\')
- var a_l = anchors_node.length;
- stream_urls.push(anchors_node[a_l - 2].href)
- stream_urls.push(anchors_node[a_l - 1].href)
- var completeTrailerList = [];
- for (var i = 0; i < anchors_node.length; i++) {
- completeTrailerList.push({
- quality: anchors_node[i].textContent,
- url: anchors_node[i].href,
- index: i
- });
- }
- var fallback = getFallbackURL(completeTrailerList, video_format, title, poster_image);
- var video_tag = document.createElement("dl8-video");
- video_tag.title = title;
- var poster = document.createAttribute("poster");
- poster.value = poster_image;
- video_tag.attributes.setNamedItem(poster);
- var format_attribute = document.createAttribute("format");
- format_attribute.value = video_format;
- video_tag.attributes.setNamedItem(format_attribute);
- var display_mode = document.createAttribute("display-mode");
- display_mode.value = "inline";
- video_tag.attributes.setNamedItem(display_mode);
- var width = document.createAttribute("width");
- width.value = "100%";
- video_tag.attributes.setNamedItem(width);
- var cors_fallback_url = document.createAttribute("cors-fallback-url");
- cors_fallback_url.value = getFallbackURL(completeTrailerList, video_format, title, poster_image);
- video_tag.attributes.setNamedItem(cors_fallback_url);
- /**
- * >>> videoSourceOrder <<<
- *
- * hardcoded list that represents the order
- * we want the video ualities to appear in the delightvr
- * dropdown. The order is derived from the original
- * order from the affiliate resource page, as in -
- * Oculus / HTC Vive 0
- * Gear VR / Daydream 1
- * PSVR 2
- * Mobile HQ 3
- * Mobile LQ 4
- * Streaming high 5
- * Streaming low 6
- */
- var videoSourceOrder = [5, 3, 4, 2, 1, 0];
- for (var i = 0; i < videoSourceOrder.length; i++) {
- var index = videoSourceOrder[i];
- if (completeTrailerList[index]) {
- var video_url = completeTrailerList[index].url;
- var new_source = document.createElement("source");
- new_source.src = video_url;
- var type = video_url.match("webm") ? "webm" : "mp4";
- new_source.type = "video/" + type;
- var quality_attr = document.createAttribute("quality");
- quality_attr.value = completeTrailerList[index].quality;
- new_source.attributes.setNamedItem(quality_attr);
- video_tag.appendChild(new_source);
- }
- }
- return {
- tags: video_tag.outerHTML,
- title: title
- }
- }
- function getUrlVars() {
- var vars = [], hash;
- var hashes = window.location.href.slice(window.location.href.indexOf(\'?\') + 1).split(\'&\');
- for (var i = 0; i < hashes.length; i++) {
- hash = hashes[i].split(\'=\');
- vars.push(hash[0]);
- vars[hash[0]] = hash[1];
- }
- return vars;
- }
- function getFallbackURL(completeTrailerList, video_format, title, poster_image) {
- var baseUrl = "https://p.badoinkvr.com/vr_fallback/?" + "format=" + video_format + "&main_title=" + title + "&poster_image=" + poster_image;
- var filesAndQualities = "";
- for (var i = 0; i < completeTrailerList.length; i++) {
- filesAndQualities += \'&url_\' + i + \'=\' + completeTrailerList[i].url + \'&title_\' + i + \'=\' + completeTrailerList[i].quality;
- }
- return baseUrl + filesAndQualities;
- }
- //add deep video links
- var table = $(\'table\');
- var affiliateUrlTemplate = table[0].getAttribute(\'data-affiliate-url-template\');
- var aid = getUrlVars()[\'aid\'];
- table.find(\'tr:first\').append("<td><b>Video Link</b></td>");
- $.each(
- table.find(\'tr\').splice(1, table.find(\'tr\').length),
- function () {
- var sceneId = $(this).find("a[data-sceneId]").first().data(\'sceneid\');
- var sceneUrl = $(this).attr(\'data-scene-url\');
- if (typeof aid != \'undefined\' && typeof sceneId != \'undefined\') {
- url = sceneUrl + affiliateUrlTemplate + aid;
- }
- else {
- url = \'\';
- }
- $(this).append(\'<td><span class="sceneUrl">\' + url + \'</span></td>\')
- }
- );
- function getLinksForReddit() {
- var btnReddit = $(\'.btn-reddit\');
- btnReddit.on(\'click\', function(){
- var linksBlock = [];
- var flag = \'\';
- var el = $(this).closest(\'tr\').find(\'.videoLink\');
- var names;
- el.each(function(i,e){
- if(el.hasClass(\'extra5k\') && el.hasClass(\'extraQuest\')) {
- flag = \'all\';
- }
- if(el.hasClass(\'extra5k\') && !el.hasClass(\'extraQuest\')) {
- flag = \'extra5k\';
- }
- if(!el.hasClass(\'extra5k\') && el.hasClass(\'extraQuest\')) {
- flag = \'extraQuest\';
- }
- if(!el.hasClass(\'extra5k\') && !el.hasClass(\'extraQuest\')) {
- flag = \'normal\';
- }
- linksBlock.push(\'- [link](\' + $(this).attr(\'href\') + \'),\')
- });
- if(flag == \'all\') {
- var names = [\'Oculus / HTC Vive - 5K\', \'Oculus Go / Oculus Quest\', \'Oculus Rift (S) / HTC Vive\', \'Gear VR / Daydream\', \'PSVR\', \'Mobile HQ\', \'Mobile LQ\'];
- }
- if(flag == \'extra5k\') {
- var names = [\'Oculus / HTC Vive - 5K\', \'Oculus Rift (S) / HTC Vive\', \'Gear VR / Daydream\', \'PSVR\', \'Mobile HQ\', \'Mobile LQ\'];
- }
- if(flag == \'extraQuest\') {
- var names = [\'Oculus Go / Oculus Quest\', \'Oculus Rift (S) / HTC Vive\', \'Gear VR / Daydream\', \'PSVR\', \'Mobile HQ\', \'Mobile LQ\'];
- }
- if(flag == \'normal\') {
- var names = [\'Oculus Rift (S) / HTC Vive\', \'Gear VR / Daydream\', \'PSVR\', \'Mobile HQ\', \'Mobile LQ\'];
- }
- var arrayCombined = $.map(names, function(v, i) {
- return [linksBlock[i].replace(\'[link]\', \'[\' + v + \']\')];
- });
- var result = arrayCombined.toString().replace(/,/g, \'\\n\');
- new Clipboard(\'.btn-reddit\', {
- text: function() {
- return result;
- }
- });
- })
- }
- $(document).ready(function(){
- getLinksForReddit();
- })';
Editor
You can edit this paste and save as new:
File Description
- test
- Paste Code
- 02 Dec-2022
- 7.72 Kb
You can Share it: