www.hardsextube.com

Changeing video and thumb size - dynamicaly, little key navigation.

  1. // ==UserScript==
  2. // @name www.hardsextube.com
  3. // @namespace http://use.i.E.your.homepage/
  4. // @version 0.25
  5. // @description Changeing video and thumb size - dynamicaly, little key navigation.
  6. // @match http://www.hardsextube.com/*
  7. // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
  8. // @copyright 2012+, You
  9. // ==/UserScript==
  10.  
  11. /*jshint -W014, -W030*/
  12. // -W014, laxbreak, Bad line breaking before '+'
  13. // -W030, Expected assignment or funtion call insted saw an expression
  14.  
  15. (function($){
  16. String.prototype.formatString = function(){
  17. return this.toString()
  18. .split(/\s+/g).join(' ')
  19. .split('{').join('{\n\t')
  20. .split('; ').join(';')
  21. .split(';').join(';\n\t')
  22. .split('*/').join('*/\n')
  23. .split('}').join('}\n');
  24. };
  25.  
  26. //---------------------------------------------------------------------------------------------------
  27. var mainWidth = 1400;
  28. //---------------------------------------------------------------------------------------------------
  29. $('<style id="basic"></style>' +
  30. '<style id="reSize"></style>' +
  31. '<style id="fullplayer"></style>').appendTo('head');
  32. function fn_Basic()
  33. {
  34. $('.container.video-page > .row:not(:nth-child(3))').addClass('fullhide');
  35. $('.pagination').size() > 0 && $('.pagination').find('.btn-secondary').each(function(id,elem){
  36. $( elem ).addClass( id === 0 ? 'prev':'next' ); });
  37. $( '#basic' ).html(
  38. '.video-items-feed .advertisement, .video-items-feed .feature-block, .right-col.right {'
  39. + 'display: none;'
  40. + '}'
  41. + '.main-bg-image, .master-footer:before, body:before {'
  42. + 'height: initial;'
  43. + '}'
  44. + '.video-page .video-player-wrap {'
  45. + 'padding-bottom: 15px;'
  46. + '}'
  47. + '.video-page .video-player-wrap .video-player>object {'
  48. + 'width: inherit;'
  49. + 'height: inherit;'
  50. + '}'
  51. + '.video-item>a .video-thumb, '
  52. + '.video-page .related-content .video-items-feed.video-items-xs .video-item .video-thumb {'
  53. + 'height: inherit;'
  54. + '}'
  55. + '.channel-items-feed, .pornstars-page .pornstars-item-feed-center .pornstar-items-feed, .video-items-feed {'
  56. + 'margin: 0 -12px;'
  57. + '}'
  58. + '.video-page .video-player-wrap .video-action-buttons .btn.share-btn {'
  59. + 'width: 17%;'
  60. + '}'.formatString() );
  61. }
  62.  
  63. function fn_reSize(inputWidth)
  64. {
  65. var reSizeCss,
  66. windowWidth = $( window ).width(),
  67. fullplayer = $('html').hasClass('fullplayer'),
  68. pageWidth = fullplayer ? $( window ).width() - 20 : inputWidth !== undefined ? inputWidth : ( windowWidth < mainWidth ? ( windowWidth - 40 < 1300 ? 1300 : windowWidth - 40 ) : mainWidth ),
  69. pageHeight = fullplayer ? $( window ).height() - 40 + 'px' : 'calc(('+pageWidth+'px - 20px) * (546/728))';
  70. reSizeCss =
  71. '.container.video-page, .channel-items-feed-center, .pornstars-page .pornstars-item-feed-center, .videos-item-feed-center {'
  72. + 'width: '+pageWidth+'px !important;'
  73. + 'max-width: '+pageWidth+'px !important;'
  74. + '}';
  75. !fullplayer ? reSizeCss +=
  76. '.video-page .video-player-wrap, .video-page .video-player-wrap .video-player {'
  77. + 'width: calc('+pageWidth+'px - 20px);'
  78. + '}'
  79. + '.video-page .video-player-wrap .video-player {'
  80. + 'height: '+pageHeight+';'
  81. + '}'
  82. + '.pornstars-page .pornstar, .video-item, '
  83. + '.video-page .related-content .video-items-feed.video-items-xs .video-item {'
  84. + 'width: calc('+pageWidth+'px / 5 - 13px);'
  85. + '}'
  86. : ( $('.video-page .video-player-wrap, .video-page .video-player-wrap .video-player').css('width','calc('+pageWidth+'px - 20px)'),
  87. $('.video-page .video-player-wrap .video-player').css('height', pageHeight ) );
  88. $( '#reSize' ).html( reSizeCss.formatString() );
  89. }
  90. function fn_fullplayer()
  91. {
  92. $( 'html' ).addClass( 'fullplayer' );
  93. $( '#fullplayer' ).html(
  94. 'header, .row.fullhide, .video-action-buttons, .videos-item-feed-center, footer.master-footer {'
  95. + 'display: none;'
  96. + '}'
  97. + '#wrapper {'
  98. + 'padding-top: 0;'
  99. + '}'
  100. + '#content {'
  101. + 'padding: 10px 0px;'
  102. + '}'
  103. + '.video-page .video-player-wrap {'
  104. + 'padding-bottom: 0px;'
  105. + 'margin-bottom: 0px;'
  106. + '}'
  107. + 'body {'
  108. + 'overflow: hidden;'
  109. + '}'.formatString() );
  110. }
  111. GM_setValue( 'ms', 0 );
  112. function fn_timer(ms)
  113. {
  114. GM_setValue( 'ms', ms );
  115. setTimeout(function(){ GM_setValue( 'ms', 0 ); },ms);
  116. }
  117. function fn_choice( thisUI )
  118. {
  119. var clearCssList = ['orginal','normal','wide','extrawide'],
  120. UIlist = ['normal','wide','extrawide','esc','sidebar'],
  121. setListYes = 1,
  122. setVideoYes = 1,
  123. get_ms;
  124.  
  125. $.inArray( thisUI, clearCssList ) > -1 && $("style#fullplayer, style#playerWidth, style#CssBasic").empty();
  126. switch( thisUI )
  127. {
  128. case 'orginal':
  129. $( '.single .video' ).removeClass('state');
  130. break;
  131. case 'normal':
  132. fn_reSize();
  133. break;
  134. case 'wide':
  135. fn_reSize(wideWidth);
  136. break;
  137. case 'extrawide':
  138. fn_reSize(xtraWidth);
  139. break;
  140. case 'big':
  141. if( $('.paginator').size() > 0 ) return false;
  142. GM_setValue( 'drtube_big', $('.wrapper').width() );
  143. fn_reSize();
  144. fn_fullPlayer();
  145. setListYes = 0;
  146. break;
  147. case 'next':
  148. $('.pagination .next').size() > 0 && ( window.location.href = $('.pagination .next').attr('href') );
  149. setListYes = 0;
  150. setVideoYes = 0;
  151. break;
  152. case 'prev':
  153. $('.pagination .prev').size() > 0 && ( window.location.href = $('.pagination .prev').attr('href') );
  154. setListYes = 0;
  155. setVideoYes = 0;
  156. break;
  157. case 'esc':
  158. if( $('html').hasClass('fullplayer') === false ) return false;
  159. $( 'html' ).removeClass( 'fullplayer' );
  160. $( "style#fullplayerCss" ).empty();
  161. setListYes = 0;
  162. setVideoYes = 0;
  163. var gotWidth = GM_getValue( 'drtube_big' );
  164. start == 1 && ( start = 0, gotWidth = defaultEsc );
  165. fn_timer( 1000 );
  166. gotWidth < mainWidth ? ( fn_choice('orginal') ):
  167. gotWidth == mainWidth ? ( fn_choice('normal') ):
  168. gotWidth == wideWidth ? ( fn_choice('wide') ):
  169. gotWidth == xtraWidth && ( fn_choice('extrawide') );
  170. break;
  171. }
  172. // $.inArray( thisUI, UIlist ) > -1 && fn_playerWidth( $('.video_content2.fleft').width() );
  173. // ( GM_getValue('ms') === 0 ) && setVideoYes == 1 && ( $('embed#playeradx').size() > 0 ? GM_setValue( 'drtube', thisUI ) : GM_setValue( 'drtube_List', thisUI ) );
  174. }
  175. document.addEventListener('keydown', function(e) {
  176. // l('key',e.keyCode,4);
  177. // ktime = performance.now();
  178. var ui,
  179. key = e.keyCode,
  180. disabled = [27,66,78,87,69,79,82];
  181. if( $.inArray( key , disabled ) > -1 ) { return false; }
  182. ui = key == 27 ? 'esc' : //esc
  183. key == 66 ? 'big' : //b
  184. key == 78 ? 'normal' : //n
  185. key == 87 ? 'wide' : //w
  186. key == 69 ? 'extrawide' : //e
  187. key == 79 ? 'orginal' : //o
  188. key == 82 ? 'reset' : //r
  189. key == 39 ? 'next' : //next
  190. key == 37 && 'prev' ; //prev
  191.  
  192. fn_choice( ui );
  193.  
  194. }, false);
  195. fn_Basic();
  196. $( '.video-page .video-player-wrap .video-player' ).size() == 1 && fn_fullplayer();
  197. fn_reSize();
  198. $( window ).resize(function(){ fn_reSize(); });
  199.  
  200. $( document ).on( 'mouseup', '#content, .col-md-12', function(e){
  201. ( e.target == this && e.which == 1 ) && $( '.video-page .video-player-wrap .video-player' ).size() == 1 && (
  202. $( 'html' ).hasClass( 'fullplayer' ) ? (
  203. $('.video-page .video-player-wrap, .video-page .video-player-wrap .video-player, .video-page .video-player-wrap .video-player').css('width','').css('height',''),
  204. $( 'html' ).removeClass( 'fullplayer' ), $( '#fullplayer' ).empty() ) : fn_fullplayer(), fn_reSize() );
  205. });
  206. $( document ).on( 'click', '*', function(e){ this == e.target && console.log( 'target', e.target ); });
  207. }(jQuery));
  208.  
  209.  
  210. // $('.container.video-page > .row').each( function( id, elem ) { id !== 2 && $( elem ).addClass('fullhide'); });
  211.  
  212.  
  213.  
  214.  
  215.