Myself-bbs.com HTML5 Player

HTML5 Player for 云端

目前为 2016-09-25 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Myself-bbs.com HTML5 Player
  3. // @namespace http://myself-bbs.com/
  4. // @version 0.7
  5. // @description HTML5 Player for 云端
  6. // @author Deloz
  7. // @match http://*.myself-bbs.com/*
  8. // @match http://myself-bbs.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function($) {
  13. 'use strict';
  14. $(function() {
  15. var getUrlVars = function(url){
  16. var vars = [], hash;
  17. var hashes = url.slice(url.indexOf('?') + 1).split('&');
  18. for(var i = 0; i < hashes.length; i++)
  19. {
  20. hash = hashes[i].split('=');
  21. vars.push(hash[0]);
  22. vars[hash[0]] = hash[1];
  23. }
  24. return vars;
  25. };
  26. var getUrlVar = function(url, name){
  27. return getUrlVars(url)[name];
  28. };
  29. var videoList = $('.various.google');
  30. videoList.each(function() {
  31. var self = $(this);
  32. if (self) {
  33. self.fancybox({live: false});
  34. self.off("click.fb-start");
  35. self.off('click');
  36. }
  37. });
  38. videoList.click(function(e) {
  39. e.preventDefault();
  40. var self = $(this);
  41. var url = self.data('href');
  42. var docId = getUrlVar(url, 'docid');
  43. var videoUrl = (docId === undefined ? url.replace('/preview', '/view') : 'https://docs.google.com/file/d/'+docId+'/view');
  44. window.open(videoUrl, '_blank');
  45. });
  46. });
  47. })(jQuery);