Vertical Stream Magic

Adjust Twitch streams for a vertical orientated monitor.

目前為 2016-12-12 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Vertical Stream Magic
  3. // @namespace http://greasyfork.org/users/2240-doodles
  4. // @author Doodles
  5. // @version 1
  6. // @description Adjust Twitch streams for a vertical orientated monitor.
  7. // @include *://www.twitch.tv/*
  8. // @exclude *://www.twitch.tv/*/*
  9. // @exclude *://www.twitch.tv/settings
  10. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
  11. // @updateVersion 1
  12. // ==/UserScript==
  13.  
  14. this.$ = this.jQuery = jQuery.noConflict(true);
  15. $(document).ready(function () {
  16. 'use strict';
  17. if($("meta[property='og:video']").length !== 0 && $("meta[property='og:video']").attr("content").indexOf("channel=") != -1){
  18. var channelName = document.URL.split("twitch.tv/")[1].split("&")[0].split("#")[0];
  19. $('script').each(function () { $(this).remove(); });
  20. $('body').html('' +
  21. '<iframe src="https://player.twitch.tv/?channel='+channelName+'" id="stream" height="603" width="1072" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>' +
  22. '<iframe src="https://www.twitch.tv/'+channelName+'/chat?popout=" id="chat" height="633" width="1072" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>' +
  23. '');
  24. $('head').html('<title>'+channelName+'</title>');
  25. $('body').css({'background-color': '#ffe', 'padding': '0 0 0 0' , 'margin': '0 0 0 0' });
  26. $('iframe').css({'padding': '0 0 0 0' , 'margin': '0 0 0 0', 'display' : 'block' });
  27. }
  28. });