Inject2Download

Simple media download script

当前为 2016-09-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Inject2Download
  3. // @namespace http://lkubuntu.wordpress.com/
  4. // @version 0.2.5.3
  5. // @description Simple media download script
  6. // @author Anonymous Meerkat
  7. // @include *
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. "use strict";
  14.  
  15. var twitter_injected = false;
  16. var vine_injected = false;
  17.  
  18. // Helper functions
  19. function i2d_show_url(namespace, url, description) {
  20. function get_absolute_url(url) {
  21. var a = document.createElement('a');
  22. a.href = url;
  23. return a.href;
  24. }
  25.  
  26. if (!description)
  27. description = "";
  28.  
  29. if (typeof url !== "string" || url.replace("\s", "").length === 0)
  30. return;
  31.  
  32. if (url.match(/^mediasource:/))
  33. return;
  34.  
  35. url = get_absolute_url(url);
  36.  
  37. if (!("i2d_url_list" in window))
  38. window.i2d_url_list = [];
  39.  
  40. for (var i = 0; i < i2d_url_list.length; i++) {
  41. if (i2d_url_list[i][0] === namespace &&
  42. i2d_url_list[i][1] === url &&
  43. i2d_url_list[i][2] === description)
  44. return;
  45. }
  46.  
  47.  
  48. i2d_url_list.push([namespace, url, description]);
  49.  
  50. var newurl = decodeURIComponent(url);
  51.  
  52. var text = "[" + namespace + "] " + description + ": ";
  53.  
  54. console.log("[i2d] " + text + newurl);
  55.  
  56. var el = document.getElementById("i2d-popup");
  57. if (!el) {
  58. el = document.createElement("div");
  59. //el.style.position = "absolute";
  60. el.style.width = "max(60%, 100em)";
  61. el.style.height = "max(60%, 100em)";
  62. el.style.maxWidth = "100%";
  63. el.style.maxHeight = "100%";
  64. el.style.background = "white";
  65. el.style.top = "0px";
  66. el.style.left = "0px";
  67. el.style.zIndex = 999999;
  68. el.style.color = "black";
  69. el.style.overflow = "scroll";
  70. el.ondblclick = function() {
  71. el.parentElement.removeChild(el);
  72. };
  73. el.innerHTML = "Double click to close<br />";
  74. el.id = "i2d-popup";
  75. document.body.appendChild(el);
  76. }
  77. el.innerHTML += text + "<a href='" + newurl + "' style='color:blue'>" + newurl + "</a><br />";
  78.  
  79. // XXX: why is this needed? test: http://playbb.me/embed.php?w=718&h=438&vid=at/nw/flying_witch_-_01.mp4, animeplus.tv
  80. document.body.removeChild(el);
  81. el.style.position = "absolute";
  82. document.body.appendChild(el);
  83. }
  84.  
  85.  
  86. // Injecting functions
  87. var get_script_str = function(f) {
  88. return f.toString().replace(/^function.*{|}$/g, '');
  89. };
  90.  
  91. function add_script(s, el) {
  92. var script_body = "(function() {\n" + s + "\n})();";
  93. var myscript = document.createElement('script');
  94. myscript.className = "i2d";
  95. myscript.innerHTML = script_body;
  96. if (el) {
  97. el.appendChild(myscript);
  98. } else {
  99. document.head.appendChild(myscript);
  100. }
  101. }
  102.  
  103. function inject(variable, newvalue, aliases) {
  104. console.log("[i2d] injecting " + variable);
  105. if (!aliases)
  106. aliases = [];
  107.  
  108. add_script(i2d_show_url.toString() + "\n" +
  109. "if (!(window." + variable + ".INJECTED)) {\n" +
  110. "var oldvariable = window." + variable + ";\n" +
  111. "var oldvariable_keys = Object.keys(oldvariable);\n" +
  112. "window." + variable + " = " + newvalue.toString() + ";\n" +
  113. "for (var i = 0; i < oldvariable_keys.length; i++) {\n" +
  114. " window." + variable + "[oldvariable_keys[i]] = oldvariable[oldvariable_keys[i]];\n" +
  115. "}\n" +
  116. "window." + variable + ".INJECTED = true;\n" +
  117. "var aliases = " + JSON.stringify(aliases) + ";\n" +
  118. "for (var i = 0; i < aliases.length; i++) {\n" +
  119. " if (aliases[i] in window && window[aliases[i]] == oldvariable)" +
  120. " window[aliases[i]] = window." + variable + "\n" +
  121. "}\n" +
  122. "}");
  123. }
  124.  
  125. function jquery_plugin_exists(name) {
  126. if (!("jQuery" in window) ||
  127. !("fn" in window.jQuery) ||
  128. !(name in window.jQuery.fn))
  129. return false;
  130.  
  131. return true;
  132. }
  133.  
  134. function inject_jquery_plugin(name, value) {
  135. if (!jquery_plugin_exists(name) ||
  136. window.jQuery.fn[name].INJECTED)
  137. return;
  138.  
  139. inject("jQuery.fn." + name, value);
  140. }
  141.  
  142.  
  143. // Main code
  144. function i2d_main(e) {
  145. if (e) {
  146. if (!e.tagName || e.tagName.toLowerCase() !== "script")
  147. return;
  148. if ((e.className === "i2d")) {
  149. return;
  150. }
  151. }
  152.  
  153. if ("soundManager" in window && !window.soundManager.INJECTED) {
  154. inject("soundManager.createSound", function(arg1, arg2) {
  155. if (typeof arg1 === "string")
  156. i2d_show_url("soundManager", arg2);
  157. else
  158. i2d_show_url("soundManager", arg1.url);
  159.  
  160. return oldvariable.apply(this, arguments);
  161. });
  162. }
  163.  
  164. if ("jwplayer" in window && !window.jwplayer.INJECTED) {
  165. inject("jwplayer", function() {
  166. var result = oldvariable.apply(this, arguments);
  167.  
  168. var check_sources = function(x) {
  169. if (typeof x === "object") {
  170. if (x instanceof Array) {
  171. for (var i = 0; i < x.length; i++) {
  172. check_sources(x[i]);
  173. }
  174. return;
  175. }
  176.  
  177. var label = "";
  178.  
  179. if ("title" in x)
  180. label += "[" + x.title + "]";
  181.  
  182. if ("label" in x)
  183. label += "[" + x.label + "]";
  184.  
  185. if ("streamer" in x) {
  186. i2d_show_url("jwplayer", x.streamer, "[stream]" + label);
  187. }
  188.  
  189. if ("file" in x) {
  190. i2d_show_url("jwplayer", x.file, label);
  191. }
  192.  
  193. if ("sources" in x) {
  194. check_sources(x.sources);
  195. }
  196.  
  197. if ("playlist" in x) {
  198. check_sources(x.playlist);
  199. }
  200. } else if (typeof x === "string") {
  201. i2d_show_url("jwplayer", x);
  202. }
  203. };
  204.  
  205. if ("setup" in result) {
  206. var old_jwplayer_setup = result.setup;
  207. result.setup = function() {
  208. if (typeof arguments[0] === "object") {
  209. var x = arguments[0];
  210.  
  211. if ("modes" in x) {
  212. for (var i = 0; i < x.modes.length; i++) {
  213. // TODO: support more?
  214. if ("type" in x.modes[i] && x.modes[i].type === "html5") {
  215. if ("config" in x.modes[i] && "file" in x.modes[i].config) {
  216. check_sources(x.modes[i].config);
  217. }
  218. }
  219. }
  220. }
  221.  
  222. check_sources(x);
  223. }
  224.  
  225. return old_jwplayer_setup.apply(this, arguments);
  226. };
  227. }
  228.  
  229. if ("load" in result) {
  230. var old_jwplayer_load = result.load;
  231. result.load = function() {
  232. check_sources(arguments[0]);
  233. return old_jwplayer_load.apply(this, arguments);
  234. };
  235. }
  236.  
  237. if ("on" in result) {
  238. result.on('playlistItem', function(item) {
  239. check_sources(item.item);
  240. });
  241.  
  242. var old_jwplayer_on = result.on;
  243. result.on = function() {
  244. if (arguments[0] === "adBlock")
  245. return;
  246.  
  247. return old_jwplayer_on.apply(this, arguments);
  248. };
  249. }
  250.  
  251. return result;
  252. });
  253. }
  254.  
  255. if ("flowplayer" in window && !window.flowplayer.INJECTED) {
  256. inject("flowplayer", function() {
  257. var obj_baseurl = null;
  258. var els = [];
  259.  
  260. function get_url(x) {
  261. x = decodeURIComponent(x);
  262.  
  263. if (obj_baseurl) {
  264. if (x.match(/^[a-z]*:\/\//)) {
  265. return x;
  266. } else {
  267. return obj_baseurl + "/" + x;
  268. }
  269. } else {
  270. return x;
  271. }
  272. }
  273.  
  274. function check_sources(x, els, label) {
  275. if (typeof x === "string") {
  276. if (!x.match(/\.xml$/))
  277. i2d_show_url("flowplayer", get_url(x), label);
  278.  
  279. return;
  280. }
  281.  
  282. if (x instanceof Array) {
  283. for (var i = 0; i < x.length; i++) {
  284. check_sources(x[i], els, label);
  285. }
  286. return;
  287. }
  288.  
  289. if (typeof x !== "object")
  290. return;
  291.  
  292. label = "";
  293.  
  294. if ("title" in x)
  295. label += "[" + x.title + "]";
  296.  
  297. if ("clip" in x) {
  298. if ("baseUrl" in x.clip) {
  299. obj_baseurl = x.clip.baseUrl;
  300.  
  301. for (var i = 0; i < els.length; i++) {
  302. els[i].i2d_baseurl = obj_baseurl;
  303. }
  304. }
  305.  
  306. check_sources(x.clip, els, label);
  307. }
  308.  
  309. if ("sources" in x) {
  310. check_sources(x.sources, els, label);
  311. }
  312.  
  313. if ("playlist" in x) {
  314. check_sources(x.playlist, els, label);
  315. }
  316.  
  317. if ("url" in x) {
  318. check_sources(x.url, els, label);
  319. }
  320.  
  321. if ("src" in x) {
  322. check_sources(x.src, els. label);
  323. }
  324.  
  325. if ("bitrates" in x) {
  326. for (var j = 0; j < x.bitrates.length; j++) {
  327. if ("url" in x.bitrates[j]) {
  328. var description = "";
  329. if (x.bitrates[j].isDefault)
  330. description += "default:";
  331. if (x.bitrates[j].sd)
  332. description += "sd:";
  333. if (x.bitrates[j].hd)
  334. description += "hd:";
  335. if (x.bitrates[j].bitrate)
  336. description += x.bitrates[j].bitrate;
  337.  
  338. i2d_show_url("flowplayer", get_url(x.bitrates[j].url), description);
  339. }
  340. }
  341. }
  342. }
  343.  
  344. if (arguments.length >= 1) {
  345. els = [null];
  346.  
  347. if (typeof arguments[0] === "string") {
  348. try {
  349. els[0] = document.getElementById(arguments[0]);
  350. } catch(e) {
  351. }
  352.  
  353. try {
  354. if (!els[0])
  355. els = document.querySelectorAll(arguments[0]);
  356. } catch(e) {
  357. els = [];
  358. }
  359. } else if (arguments[0] instanceof HTMLElement) {
  360. els = [arguments[0]];
  361. }
  362. }
  363.  
  364. for (var i = 0; i < els.length; i++) {
  365. if (!els[i] || !(els[i] instanceof HTMLElement))
  366. continue;
  367.  
  368. if ("i2d_baseurl" in els[i])
  369. obj_baseurl = els[i].i2d_baseurl;
  370. }
  371.  
  372. if (arguments.length >= 3 && typeof arguments[2] === "object") {
  373. check_sources(arguments[2], els);
  374. } else if (arguments.length >= 3 && typeof arguments[2] === "string") {
  375. i2d_show_url("flowplayer", get_url(arguments[2]));
  376. } else if (arguments.length === 2 && typeof arguments[1] === "object") {
  377. check_sources(arguments[1], els);
  378. } else if (arguments.length === 2 && typeof arguments[1] === "string") {
  379. i2d_show_url("flowplayer", get_url(arguments[1]));
  380. }
  381.  
  382. for (var i = 0; i < els.length; i++) {
  383. if (!els[i] || !(els[i] instanceof HTMLElement))
  384. continue;
  385.  
  386. var href = els[i].getAttribute("href");
  387. if (href) {
  388. i2d_show_url("flowplayer", get_url(href), "href");
  389. }
  390. }
  391.  
  392. var result = oldvariable.apply(this, arguments);
  393.  
  394. if (!result || typeof result !== "object")
  395. return result;
  396.  
  397. if ("addClip" in result) {
  398. var old_fplayer_addclip = result.addClip;
  399. result.addClip = function() {
  400. if (arguments.length > 0)
  401. check_sources(arguments[0], els);
  402.  
  403. return old_fplayer_addclip.apply(this, arguments);
  404. };
  405. }
  406.  
  407. if ("setPlaylist" in result) {
  408. var old_fplayer_setplaylist = result.setPlaylist;
  409. result.setPlaylist = function() {
  410. if (arguments.length > 0)
  411. check_sources(arguments[0], els);
  412.  
  413. return old_fplayer_setplaylist.apply(this, arguments);
  414. };
  415. }
  416.  
  417. if ("load" in result) {
  418. var old_fplayer_load = result.load;
  419. result.load = function() {
  420. if (arguments.length > 0)
  421. check_sources(arguments[0], els);
  422.  
  423. return old_fplayer_load.apply(this, arguments);
  424. };
  425. }
  426.  
  427. /*if ("on" in result) {
  428. result.on("load", function(e, api, video) {
  429. console.log(e);
  430. check_sources(video || api.video, els);
  431. });
  432. }*/
  433.  
  434. return result;
  435. }, ["$f"]);
  436.  
  437. add_script(get_script_str(function() {
  438. flowplayer(function(api, root) {
  439. api.on("load", function(e, api, video) {
  440. flowplayer().load(video || api.video);
  441. });
  442. });
  443. }));
  444. }
  445.  
  446. if ("videojs" in window && !window.videojs.INJECTED) {
  447. inject("videojs", function() {
  448. if (arguments.length > 0 && typeof arguments[0] === "string") {
  449. var my_el = document.getElementById(arguments[0]);
  450. if (!my_el)
  451. my_el = document.querySelector(arguments[0]);
  452.  
  453. if (my_el) {
  454. if (my_el.src) {
  455. i2d_show_url("videojs", my_el.src);
  456. }
  457.  
  458. for (var i = 0; i < my_el.children.length; i++) {
  459. if (my_el.children[i].tagName.toLowerCase() === "source") {
  460. if (my_el.children[i].src) {
  461. i2d_show_url("videojs", my_el.children[i].src, my_el.children[i].getAttribute("label"));
  462. }
  463. }
  464. }
  465. }
  466. }
  467.  
  468. var result = oldvariable.apply(this, arguments);
  469.  
  470. var old_videojs_src = result.src;
  471. result.src = function() {
  472. if (arguments.length > 0 && typeof arguments[0] === "object") {
  473. if ("src" in arguments[0]) {
  474. i2d_show_url("videojs", arguments[0].src);
  475. }
  476. }
  477.  
  478. return old_videojs_src.apply(this, arguments);
  479. };
  480.  
  481. return result;
  482. });
  483.  
  484. add_script(i2d_show_url.toString() +
  485. get_script_str(function() {
  486. document.addEventListener("DOMContentLoaded", function() {
  487. var els = document.getElementsByClassName("video-js");
  488. for (var i = 0; i < els.length; i++) {
  489. var my_el = els[i];
  490. if (my_el.tagName.toLowerCase() === "video") {
  491. if (!my_el.getAttribute('data-setup')) {
  492. continue;
  493. }
  494. if (my_el.src) {
  495. i2d_show_url("videojs", my_el.src);
  496. }
  497.  
  498. for (var j = 0; j < my_el.children.length; j++) {
  499. if (my_el.children[j].tagName.toLowerCase() === "source") {
  500. if (my_el.children[j].src) {
  501. i2d_show_url("videojs", my_el.children[j].src, my_el.children[j].getAttribute("label"));
  502. }
  503. }
  504. }
  505. }
  506. }
  507. });
  508. }));
  509. }
  510.  
  511. if ("amp" in window && !window.amp.INJECTED) {
  512. inject("amp", function() {
  513. function show_amp_source(sourceobj) {
  514. if ("protectionInfo" in sourceobj) {
  515. console.log("[amp] Cannot decode protection info");
  516. }
  517. if ("src" in sourceobj)
  518. i2d_show_url("amp", sourceobj.src);
  519. }
  520.  
  521. if (arguments.length >= 2 && typeof arguments[1] === "object") {
  522. if ("sourceList" in arguments[1]) {
  523. for (var i = 0; i < arguments[1].sourceList.length; i++) {
  524. show_amp_source(arguments[1].sourceList[i]);
  525. }
  526. }
  527. }
  528.  
  529. var result = oldvariable.apply(this, arguments);
  530.  
  531. if (!result)
  532. return result;
  533.  
  534. var old_amp_src = result.src;
  535. result.src = function() {
  536. for (var i = 0; i < arguments[0].length; i++) {
  537. show_amp_source(arguments[0][i]);
  538. }
  539.  
  540. return old_amp_src.apply(this, arguments);
  541. };
  542.  
  543. return result;
  544. });
  545. }
  546.  
  547. if ("DJPlayer" in window && !window.DJPlayer.INJECTED) {
  548. add_script(i2d_show_url.toString() + "\n" +
  549. "var oldsetmedia = window.DJPlayer.prototype.setMedia;\n" +
  550. "window.DJPlayer.prototype.setMedia = function() {\n" +
  551. " if (arguments.length > 0 && typeof arguments[0] === 'string') {\n" +
  552. " i2d_show_url('DJPlayer', arguments[0]);\n" +
  553. " }\n" +
  554. " return oldsetmedia.apply(this, arguments);\n" +
  555. "}");
  556. }
  557.  
  558. if (("location" in window) && window.location && window.location.host.search("forvo") >= 0 && "createAudioObject" in window && !window.createAudioObject.INJECTED) {
  559. inject("createAudioObject", function(id, mp3, ogg) {
  560. i2d_show_url("forvo", mp3, "mp3");
  561. i2d_show_url("forvo", ogg, "ogg");
  562.  
  563. return oldvariable.apply(this, arguments);
  564. });
  565. }
  566.  
  567. if (("location" in window) && window.location && window.location.href.search("twitter.com/i/videos") >= 0 && !twitter_injected) {
  568. twitter_injected = true;
  569.  
  570. document.addEventListener("DOMContentLoaded", function() {
  571. var pc = document.getElementById('playerContainer');
  572. if (!pc) {
  573. return;
  574. }
  575.  
  576. var config = pc.getAttribute('data-config');
  577. if (!config) {
  578. return;
  579. }
  580.  
  581. var config_parsed = JSON.parse(config);
  582.  
  583. if ("video_url" in config_parsed) {
  584. i2d_show_url('twitter', config_parsed.video_url);
  585. }
  586. });
  587. }
  588.  
  589. if (("location" in window) && window.location && window.location.href.search("vine.co/v/") >= 0 && !vine_injected) {
  590. vine_injected = true;
  591.  
  592. document.addEventListener("DOMContentLoaded", function() {
  593. var config_el = document.getElementById("configuration");
  594. if (!config_el) {
  595. return;
  596. }
  597.  
  598. var config = JSON.parse(config_el.innerHTML);
  599. if (!config || typeof config !== "object") {
  600. return;
  601. }
  602.  
  603. if (!("post" in config) || !("videoUrls" in config.post)) {
  604. return;
  605. }
  606.  
  607. for (var i = 0; i < config.post.videoUrls.length; i++) {
  608. var videourl = config.post.videoUrls[i];
  609.  
  610. var formatstr = "[";
  611. formatstr += videourl.format + ":";
  612. formatstr += videourl.idStr;
  613.  
  614. if (videourl.rate > 0)
  615. formatstr += ", " + videourl.rate;
  616.  
  617. formatstr += "]";
  618.  
  619. i2d_show_url('vine', videourl.videoUrl, formatstr);
  620. }
  621. });
  622. }
  623.  
  624. if ("jQuery" in window) {
  625. inject_jquery_plugin("jPlayer", function() {
  626. if (arguments.length > 0 && arguments[0] === "setMedia") {
  627. if (arguments.length > 1) {
  628. if (typeof arguments[1] === "object") {
  629. for (var i in arguments[1]) {
  630. if (i === "title" ||
  631. i === "duration" ||
  632. i === "track" /* for now */ ||
  633. i === "artist" ||
  634. i === "free")
  635. continue;
  636.  
  637. i2d_show_url("jPlayer", arguments[1][i], i);
  638. }
  639. } else if (typeof arguments[1] === "string") {
  640. i2d_show_url("jPlayer", arguments[1]);
  641. }
  642. }
  643. }
  644.  
  645. return oldvariable.apply(this, arguments);
  646. });
  647.  
  648. inject_jquery_plugin("amazingaudioplayer", function() {
  649. var result = oldvariable.apply(this, arguments);
  650.  
  651. function add_source_obj(x) {
  652. type = "";
  653. if ("type" in x) {
  654. type = x.type;
  655. }
  656.  
  657. i2d_show_url("amazingaudioplayer", x.src, type);
  658. }
  659.  
  660. function add_source(x) {
  661. if (x instanceof Array) {
  662. for (var i = 0; i < x.length; i++) {
  663. add_source_obj(x[i]);
  664. }
  665. } else {
  666. add_source_obj(x);
  667. }
  668. }
  669.  
  670. var audioplayer = jQuery(this).data("object").audioPlayer;
  671. if (audioplayer.audioItem) {
  672. add_source(audioplayer.audioItem.source);
  673. }
  674.  
  675. var oldload = audioplayer.load;
  676. audioplayer.load = function(item) {
  677. if ("source" in item) {
  678. add_source(item.source);
  679. }
  680.  
  681. return oldload.apply(this, arguments);
  682. };
  683.  
  684. return result;
  685. });
  686.  
  687. if (jquery_plugin_exists("jPlayerAudio") && !window.jQuery.fn.jPlayerAudio.INJECTED) {
  688. inject_jquery_plugin("jPlayerAudio", function() {
  689. return oldvariable.apply(this, arguments);
  690. });
  691.  
  692. add_script(i2d_show_url.toString() + "\n" +
  693. "var oldmedia=jQuery.jPlayerAudio.prototype.setMedia;\n" +
  694. "jQuery.jPlayerAudio.prototype.setMedia = function(e) {\n" +
  695. " var absolute = this._absoluteMediaUrls(e);\n" +
  696. " jQuery.each(this.formats, function(a, o) {\n" +
  697. " i2d_show_url('cleanaudioplayer', absolute[o]);\n" +
  698. " });\n" +
  699. " return oldmedia.apply(this, arguments);\n" +
  700. "}");
  701. }
  702.  
  703. if (jquery_plugin_exists("jPlayerVideo") && !window.jQuery.fn.jPlayerVideo.INJECTED) {
  704. inject_jquery_plugin("jPlayerVideo", function() {
  705. return oldvariable.apply(this, arguments);
  706. });
  707.  
  708. add_script(i2d_show_url.toString() + "\n" +
  709. "var oldmedia=jQuery.jPlayerVideo.prototype.setMedia;\n" +
  710. "jQuery.jPlayerVideo.prototype.setMedia = function(e) {\n" +
  711. " var absolute = this._absoluteMediaUrls(e);\n" +
  712. " jQuery.each(this.formats, function(a, o) {\n" +
  713. " i2d_show_url('cleanvideoplayer', absolute[o]);\n" +
  714. " });\n" +
  715. " return oldmedia.apply(this, arguments);\n" +
  716. "}");
  717. }
  718. }
  719. }
  720.  
  721. i2d_main();
  722.  
  723. window.addEventListener("afterscriptexecute", function(e) {
  724. i2d_main(e.target);
  725. });
  726.  
  727. document.addEventListener("DOMContentLoaded", function() {
  728. var get_raws = function() {
  729. var audios = [].slice.call(document.getElementsByTagName("audio"));
  730. var videos = [].slice.call(document.getElementsByTagName("video"));
  731. var els = Array.prototype.concat(audios, videos);
  732.  
  733. for (var i = 0; i < els.length; i++) {
  734. var basename = "raw ";
  735. var el = els[i];
  736.  
  737. if (el.tagName.toLowerCase() === "video") {
  738. basename += "video";
  739. } else {
  740. basename += "audio";
  741. }
  742.  
  743. if (el.id)
  744. basename += ": #" + el.id;
  745.  
  746. var show_updates = function() {
  747. if (el.src)
  748. i2d_show_url(basename, el.src);
  749.  
  750. for (var x = 0; x < el.children.length; x++) {
  751. if (els[i].children[x].tagName.toLowerCase() !== "source") {
  752. continue;
  753. }
  754.  
  755. var type = null;
  756. if (el.children[x].type)
  757. type = el.children[x].type;
  758.  
  759. if (el.children[x].src)
  760. i2d_show_url(basename, el.children[x].src, type);
  761. }
  762. };
  763.  
  764. var observer = new MutationObserver(show_updates);
  765. observer.observe(el, { attributes: true, childList: true });
  766.  
  767. show_updates();
  768. }
  769. };
  770.  
  771. get_raws();
  772.  
  773. i2d_main();
  774. });
  775. })();