1/** 2 * Load Video.js + FebBox player shell when the VideoJS player is requested. 3 * Default playback still uses JWPlayer (player.html). VideoJS is player_vjs.html. 4 * 5 * Enable: localStorage.setItem('febbox.useVjs','1'); location.reload(); 6 * or URL ?vjs=1 7 * Disable: localStorage.setItem('febbox.useVjs','0'); location.reload(); 8 */ 9window.fbVjsFlagOn = function (val) { 10 if (val === true || val === 1) return true; 11 if (val == null) return false; 12 val = String(val).toLowerCase().trim(); 13 if (!val) return false; 14 if (val === '0' || val === 'false' || val === 'off' || val === 'no') return false; 15 return true; 16}; 17 18window.fbUseVjsPlayer = function () { 19 if (window.FB_USE_VJS === true || window.FB_USE_VJS === 1 || window.FB_USE_VJS === '1') return true; 20 if (window.FB_USE_VJS === false || window.FB_USE_VJS === 0 || window.FB_USE_VJS === '0') return false; 21 try { 22 var q = String(location.search || ''); 23 if (/[?&]vjs=0(?:&|$)/.test(q)) return false; 24 if (/[?&]vjs=1(?:&|$)/.test(q)) return true; 25 if (window.localStorage) { 26 var ls = localStorage.getItem('febbox.useVjs'); 27 if (ls !== null) return window.fbVjsFlagOn(ls); 28 } 29 if (/(?:^|; )febbox_use_vjs=1(?:;|$)/.test(document.cookie || '')) return true; 30 } catch (e) {} 31 return false; 32}; 33 34window.fbSyncVjsCookie = function () { 35 try { 36 if (window.fbUseVjsPlayer()) { 37 document.cookie = 'febbox_use_vjs=1; path=/; max-age=31536000'; 38 window.FB_USE_VJS = true; 39 } else if (/[?&]vjs=0(?:&|$)/.test(String(location.search || '')) || 40 (window.localStorage && !window.fbVjsFlagOn(localStorage.getItem('febbox.useVjs')) && localStorage.getItem('febbox.useVjs') !== null)) { 41 document.cookie = 'febbox_use_vjs=; path=/; max-age=0'; 42 } 43 } catch (e) {} 44}; 45 46window.fbSetUseVjsPlayer = function (on) { 47 try { 48 if (window.localStorage) localStorage.setItem('febbox.useVjs', on ? '1' : '0'); 49 } catch (e) {} 50 try { 51 if (on) { 52 document.cookie = 'febbox_use_vjs=1; path=/; max-age=31536000'; 53 window.FB_USE_VJS = true; 54 } else { 55 document.cookie = 'febbox_use_vjs=; path=/; max-age=0'; 56 window.FB_USE_VJS = false; 57 } 58 } catch (e) {} 59}; 60 61window.fbSyncPlayerSettingUi = function () { 62 var root = document.querySelector('.setting_con .player_set'); 63 if (!root) return; 64 var useVjs = window.fbUseVjsPlayer(); 65 var val = useVjs ? 'vjs' : 'jw'; 66 var items = root.querySelectorAll('.player_mode > div'); 67 var label = ''; 68 for (var i = 0; i < items.length; i++) { 69 if (items[i].getAttribute('data-val') === val) { 70 items[i].classList.add('selected2'); 71 var nameEl = items[i].querySelector('.name'); 72 if (nameEl) label = (nameEl.textContent || '').trim(); 73 } else { 74 items[i].classList.remove('selected2'); 75 } 76 } 77 var span = root.querySelector('.player_change span'); 78 if (span) span.textContent = label || (useVjs ? 'Video.js' : 'JWPlayer'); 79}; 80 81(function bindPlayerSetting() { 82 function hidePlayerMode() { 83 var menus = document.querySelectorAll('.setting_con .player_mode'); 84 for (var i = 0; i < menus.length; i++) menus[i].style.display = 'none'; 85 } 86 document.addEventListener('click', function (e) { 87 var t = e.target; 88 if (!t || typeof t.closest !== 'function') return; 89 if (t.closest('.personal .setting, .sidebar .setting, .sidebar_con .setting')) { 90 setTimeout(window.fbSyncPlayerSettingUi, 0); 91 } 92 var changeBtn = t.closest('.setting_con .player_set .player_change'); 93 if (changeBtn) { 94 e.preventDefault(); 95 e.stopPropagation(); 96 window.fbSyncPlayerSettingUi(); 97 var menu = document.querySelector('.setting_con .player_set .player_mode'); 98 if (!menu) return; 99 var open = menu.style.display === 'block' || (menu.style.display === '' && window.getComputedStyle(menu).display === 'block'); 100 hidePlayerMode(); 101 if (!open) menu.style.display = 'block'; 102 return; 103 } 104 var item = t.closest('.setting_con .player_set .player_mode > div'); 105 if (item) { 106 e.preventDefault(); 107 e.stopPropagation(); 108 window.fbSetUseVjsPlayer(item.getAttribute('data-val') === 'vjs'); 109 window.fbSyncPlayerSettingUi(); 110 hidePlayerMode(); 111 return; 112 } 113 if (!t.closest('.setting_con .player_set .player_mode')) hidePlayerMode(); 114 }, true); 115 if (document.readyState === 'loading') { 116 document.addEventListener('DOMContentLoaded', window.fbSyncPlayerSettingUi); 117 } else { 118 window.fbSyncPlayerSettingUi(); 119 } 120})(); 121 122window.fbPlayerRequestData = function (data) { 123 data = data || {}; 124 window.fbSyncVjsCookie(); 125 if (window.fbUseVjsPlayer()) data.vjs = 1; 126 return data; 127}; 128 129window.fbPlayerUrl = function (url) { 130 window.fbSyncVjsCookie(); 131 if (!window.fbUseVjsPlayer()) return url; 132 return url + (String(url).indexOf('?') >= 0 ? '&' : '?') + 'vjs=1'; 133}; 134 135window.fbSyncVjsCookie(); 136 137window.ensureFebBoxVjs = function (cb) { 138 var shouldLoad = window.fbUseVjsPlayer(); 139 if (!shouldLoad) { 140 if (typeof cb === 'function') cb(); 141 return; 142 } 143 var ver = '20260904b'; 144 function addCss(id, href) { 145 if (document.getElementById(id)) return; 146 var link = document.createElement('link'); 147 link.id = id; 148 link.rel = 'stylesheet'; 149 link.href = href; 150 document.head.appendChild(link); 151 } 152 function addJs(src) { 153 return new Promise(function (resolve, reject) { 154 var key = src.split('?')[0]; 155 var found = document.querySelector('script[src^="' + key + '"]'); 156 if (found) { 157 if (found.getAttribute('data-loaded') === '1' || 158 (key.indexOf('video.min.js') !== -1 && window.videojs) || 159 (key.indexOf('febbox-vjs-player.js') !== -1 && window.FebBoxVjs) || 160 (key.indexOf('silvermine-videojs-chromecast') !== -1 && window.videojs && window.videojs.getPlugin && window.videojs.getPlugin('chromecast'))) { 161 resolve(); 162 return; 163 } 164 found.addEventListener('load', function () { resolve(); }); 165 found.addEventListener('error', reject); 166 return; 167 } 168 var s = document.createElement('script'); 169 s.src = src; 170 s.onload = function () { 171 s.setAttribute('data-loaded', '1'); 172 resolve(); 173 }; 174 s.onerror = reject; 175 document.head.appendChild(s); 176 }); 177 } 178 if (!window.__castScriptLoaded && !document.querySelector('script[src*="cast_sender.js"]')) { 179 var castScript = document.createElement('script');
180 castScript.src = 'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1'; 181 castScript.onload = function () { window.__castScriptLoaded = true; }; 182 document.head.appendChild(castScript); 183 } 184 addCss('febbox-video-js-css', '/static/videojs/video-js.css?v=' + ver); 185 addCss('mbp-player-skin-css', '/static/videojs/mbp-player-skin.css?v=' + ver); 186 addCss('febbox-vjs-player-css', '/static/css/febbox-vjs-player.css?v=' + ver); 187 addCss('silvermine-chromecast-css', '/static/videojs/silvermine-videojs-chromecast.css?v=' + ver); 188 189 addJs('/static/videojs/video.min.js?v=' + ver) 190 .then(function () { return addJs('/static/videojs/videojs-playlist.min.js?v=' + ver); }) 191 .then(function () { return addJs('/static/videojs/silvermine-videojs-chromecast.min.js?v=' + ver); }) 192 .then(function () { return addJs('/static/videojs/febbox-vjs-player.js?v=' + ver); }) 193 .then(function () { 194 if (window.FebBoxVjs && typeof window.FebBoxVjs.ensureAssets === 'function') { 195 window.FebBoxVjs.ensureAssets(cb); 196 } else if (typeof cb === 'function') { 197 cb(); 198 } 199 }) 200 .catch(function (err) { 201 console.error('Failed to load Video.js', err); 202 if (typeof cb === 'function') cb(err); 203 }); 204};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.