MCPcopy Index your code
hub / github.com/hoothin/UserScripts / reinitFlash

Function reinitFlash

FlashViewer-HTML5 Video/flashViewer.user.js:1290–1520  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1288
1289
1290 function reinitFlash() {
1291
1292 // 找到的插件统统由这个函数处理
1293 function initializer(plugins) {
1294 // console.log(plugins);
1295
1296 plugins.forEach(function (plugin) {
1297
1298 // plugin是否在已插入文档中
1299 if (!document.contains(plugin)) return;
1300 // 处理过的跳过
1301 if (plugin.fvReInitialized === true) return;
1302
1303 var src;
1304 var type;
1305 var isObject = plugin.nodeName == 'OBJECT';
1306
1307 if (isObject) {
1308 if (plugin.hasAttribute('data')) {
1309 src = plugin.data;
1310 };
1311 if (plugin.hasAttribute('type')) {
1312 type = plugin.type;
1313 };
1314
1315 if (src === undefined || type === undefined) {
1316 nativeMethods.some.call(plugin.children, function (child){
1317 if (child.nodeName != 'PARAM') return;
1318
1319 var key = child.name;
1320 var value = child.value;
1321 if (/^(?:src|movie)$/i.test(key)) {
1322 src = value;
1323 } else if (/^type$/i.test(key)) {
1324 type = value;
1325 };
1326 if (src !== undefined && type !== undefined) {
1327 return true;
1328 };
1329 });
1330 };
1331
1332 type = type || '';
1333 } else {// embed标签
1334 src = plugin.src;
1335 type = plugin.type;
1336 };
1337
1338 // console.log(isObject, type, src);
1339
1340 // 如果不存在src或者不是flash插件
1341 if (!src || !/^(?:|application\/x-shockwave-flash)$/i.test(type)) return;
1342
1343 // 匹配到的规则
1344 var matched;
1345 rules.some(function (rule) {
1346 if (rule.enabled && rule.url.test(src)){
1347 matched = rule;

Callers 1

contentScriptFunction · 0.85

Calls 1

initializerFunction · 0.85

Tested by

no test coverage detected