Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         issoutv
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       ence
  7. // @match        https://avenoel.org/topic*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. function createIssoutvPlayer (id) {
  12.     const formats = ['webm', 'mp4'];
  13.  
  14.     let video = document.createElement('video');
  15.     video.setAttribute('controls', '');
  16.     video.setAttribute('width', '320');
  17.     video.setAttribute('height', '240');
  18.     video.setAttribute('preload', 'none');
  19.  
  20.     let sources = formats.map(format => {
  21.         let source = document.createElement('source');
  22.         source.setAttribute('src', `http://issoutv.com/files/${id}${format === 'mp4' ? '.mp4' : ''}`);
  23.         source.setAttribute('src', `http://issoutv.com/filesSecond/${id}${format === 'mp4' ? '.mp4' : ''}`);
  24.         source.setAttribute('type', `video/${format}`);
  25.         video.appendChild(source);
  26.     });
  27.  
  28.     return video;
  29. }
  30.  
  31. function issoutv () {
  32.     Array.from(document.getElementsByClassName('message-content')).map(message => {
  33.             Array.from(message.getElementsByTagName('a'))
  34.             .filter(a => a.host === 'issoutv.com' && a.pathname === '/view.php')
  35.             .map(a => {
  36.                 let player = createIssoutvPlayer(a.search.split('=')[1]);
  37.                 a.parentNode.parentNode.replaceChild(player, a.parentNode);
  38.          });
  39.     });
  40. }
  41.  
  42. (function() {
  43.     'use strict';
  44.  
  45.     console.log('issoutv running...');
  46.     issoutv ();
  47. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement