www.xvideos.com II

enter something useful

  1. /**
  2. * Created by Pegaasus on 2016-03-05.
  3. */
  4.  
  5. //// ==UserScript==
  6. // @name www.xvideos.com II
  7. // @namespace http://use.i.E.your.homepage/
  8. // @version 0.45
  9. // @description enter something useful
  10.  
  11. // @match http://www.xvideos.com/*
  12.  
  13. // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
  14.  
  15. // @require https://greasyfork.org/scripts/9160-my-function-library/code/My%20Function%20library.js?version=111519
  16.  
  17. // @require https://greasyfork.org/scripts/1930-simulate-click/code/Simulate_click.js?version=5025
  18. // @require https://greasyfork.org/scripts/6883-tinysort-tsort/code/TinySorttsort.js?version=27466
  19.  
  20. // @grant GM_getValue
  21. // @grant GM_setValue
  22. // @grant GM_deleteValue
  23. // @grant GM_getResourceURL
  24.  
  25. // @resource crinkled_paper http://www.katebocciapresents.com/wp-content/uploads/2014/02/33-crinkled-paper-background-sml.jpg
  26. // @resource seamlesstexture21_1200 http://www.unsigneddesign.com/Seamless_background_textures/thumbs/seamlesstexture21_1200.jpg
  27.  
  28. // @run-at document-start
  29.  
  30. // @created 2014-10-16
  31. // @released 2014-00-00
  32. // @updated 2014-00-00
  33. // @history @version 0.1 - first version: @released - 2014-10-18
  34. // @history @version 0.2 - sec version: @updated - 2014-12-06
  35. // @history @version 0.22 - sec version: @updated - 2014-12-19
  36. // @history @version 0.40 - 3rd version: @updated - 2015-10-19
  37. // @history @version 0.45 - 4th version: @updated - 2016-03-04
  38.  
  39. // @compatible Greasemonkey, Tampermonkey
  40. // @license GNU GPL v3 (http://www.gnu.org/copyleft/gpl.html)
  41. // @copyright 2014+, Magnus Fohlström
  42. // ==/UserScript==
  43.  
  44.  
  45. /*global $, jQuery*/
  46. /*jshint -W014, -W030, -W082*/
  47. // -W014, laxbreak, Bad line breaking before '+'
  48. // -W030, Expected assignment or funtion call insted saw an expression
  49. // -W082, a function declaration inside a block statement
  50.  
  51.  
  52. (function($){
  53.  
  54. var fc = 0,
  55. fade = setInterval(function(){
  56.  
  57. c.i('fade' + fc++, $('body').length );
  58.  
  59. $('img').length && (
  60. clearInterval( fade ),
  61. $('img').fadeOut( 1, "linear" ).delay(10).fadeIn( 2200, "linear" )
  62. );
  63.  
  64. }, 10 ),
  65. videoPop = locDoc.split('#').pop();
  66.  
  67. inURL('#') && videoPop !== undefined && videoPop.length > 1 && self.close();
  68.  
  69. var config = {
  70. UI : {
  71. normal : 930,
  72. myNormal : 1111,
  73. wide : 1440,
  74. extra : 1880,
  75. dyn : 100
  76. },
  77. pageWidth : null,
  78. pageUI : 'wide',
  79. startWidth : function(){
  80. var winWidth = $w.width(), corr = 88, min = 700,
  81. uiWidth = this.pageUI == 'dyn' ? winWidth * ( this.UI.dyn / 100 ) - corr : this.UI[ this.pageUI ],
  82. setWidth = uiWidth + corr > winWidth ? winWidth - corr : uiWidth;
  83. config.pageWidth = setWidth < min ? min : setWidth;
  84. },
  85. videoFormat : '',
  86. thumbRow : 4,
  87. enhanced : true,
  88. orginal : false,
  89. isVideo : false,
  90. fullPlayer : null
  91. },
  92. css = {
  93. main : function(){
  94. var bimg = 'http://profile-pics-cdn.xvideos.com/videos/profiles/galleries/76/40/58/pegaasus68/gal671503/pic_2_big.jpg';
  95. return ''
  96. + '.enhanced #page {'
  97. + 'background-color: rgb(249, 251, 255);'
  98. + 'padding: 20px;'
  99. + 'box-shadow: 0px 0px 40px 2px rgba(56, 0, 0, 0.33);'
  100. + 'border-style: solid;'
  101. + 'border-left-width: 1px;'
  102. + 'border-right-width: 1px;'
  103. + 'border-top-width: 0px;'
  104. + 'border-bottom-width: 0;'
  105. + 'border-color: rgba(173, 110, 96, 0.5);'
  106. + '}'
  107. + '.enhanced #player {'
  108. + 'width: calc(100% - 0px) !important;'
  109. + '}'
  110.  
  111. + '.enhanced #relatedVideosWithMore, .enhanced .thumbBlock .thumbInside {'
  112. + 'height: initial !important;'
  113. + '}'
  114. + '.enhanced #relatedVideosWithMore .page {'
  115. + 'position: static;'
  116. + '}'
  117. + '.enhanced .thumbBlock {'
  118. + 'height: initial;'
  119. + 'box-sizing: border-box;'
  120. + '}'
  121. + '.enhanced .thumbProfile .thumb {'
  122. + 'width: 100%;'
  123. + 'box-sizing: border-box;'
  124. + '}'
  125. + '.enhanced .thumbProfile .thumb img {'
  126. + 'height: initial;'
  127. + '}'
  128. + '.enhanced .thumbBlock .thumb img {'
  129. + 'width: calc(100% - 10px);'
  130. + '}'
  131.  
  132. + '.enhanced .thumbBlock .thumbInside p a {'
  133. + 'height: 36px;'
  134. + 'display: inline-block;'
  135. + '}'
  136.  
  137. + '.enhanced .profilesGalleries.videoThumbs .thumb, .enhanced .profilesGalleries.videoThumbs .vcenter {'
  138. + 'height: initial;'
  139. + '}'
  140.  
  141. + '.enhanced #mv_min_title:hover{'
  142. + 'cursor: pointer;'
  143. + 'color: white;'
  144. + '}'
  145. + '.enhanced .page {'
  146. + 'top: 0% !important'
  147. + '}'
  148. + '.enhanced body {'
  149. + 'background-color: rgba(255, 233, 223, 0.33);'
  150. + 'background-repeat: repeat;'
  151. + 'background-size: cover;'
  152. + 'background-attachment: fixed;'
  153. + 'background-image: url("' + bimg + '") !important;'
  154. + '}'
  155. + '#related-videos-show-more {'
  156. + 'display: none;'
  157. + '}'
  158.  
  159. ;
  160. },
  161. dynCss : function(){
  162. return ''
  163. + '.enhanced #page {'
  164. + 'width: '+ config.pageWidth +'px;'
  165. + 'max-width: '+ config.pageWidth +'px;'
  166. + '}'
  167. + '.enhanced .thumbBlock{'
  168. + 'width: calc(100% / '+ config.thumbRow +' - 0px) !important;'
  169. + '}'
  170. + '.enhanced .thumbProfile {'
  171. + 'width: calc(100% / '+ config.thumbRow +' - 4px) !important;'
  172. + '}'
  173. + '.enhanced .thumbProfile .thumb a img {'
  174. + 'height: calc( ( '+ config.pageWidth +'px - ( '+ config.pageWidth +'px * 0.25 ) ) / '+ config.thumbRow +' - 4px ) !important;'
  175. + '}'
  176. + '.enhanced #player, .enhanced #player embed {'
  177. // + 'width: '+ config.pageWidth +'px !important;'
  178. + 'height:'+( config.pageWidth * config.videoFormat )+'px !important;'
  179. // + 'padding-bottom:'+( config.pageWidth * config.videoFormat )+'px !important;'
  180. + '}'
  181. + '.enhanced #related-videos {'
  182. + 'z-index: 100;'
  183. + 'height: initial !important;'
  184. + '}';
  185. },
  186. ads : function(){
  187. return ''
  188. + '.hideAds #ads, .hideAds #video-ad, .hideAds #ad-bottom, .hideAds #adChannel {'
  189. + 'display: none;'
  190. + '}';
  191. },
  192. menuMouse : function(){
  193. return ''
  194. + '#ClickMenu {'
  195. + 'width: 100px;'
  196. + 'position: fixed;'
  197. + 'background-color: darkgray;'
  198. + 'border: 1px black solid;'
  199. + 'padding: 0px;'
  200. + 'opacity: 0.8;'
  201. + 'z-index: 1000;'
  202. + '}'
  203. + '.UI_choice {'
  204. + 'width: calc(100% - 10px);'
  205. + 'background-color: lightgray;'
  206. + 'line-height: 30px;'
  207. + 'height: 30px;'
  208. + 'margin: 5px;'
  209. + 'text-align: center;'
  210. + 'cursor: pointer;'
  211. + 'font-weight: bold;'
  212. + '}'
  213. + '.UI_choice:hover {'
  214. + 'background-color: rgb(255, 252, 225);'
  215. + 'color: darkred;'
  216. + '}'
  217. + 'li.cActive {'
  218. + 'background-color: beige;'
  219. + 'border: 1px solid darkred;'
  220. + '}';
  221. },
  222. menuButton : function(){
  223. return '';
  224. },
  225. videoButtons: function(){
  226. return ''
  227. + '.tabsContainer ul.tabButtons li {'
  228. + 'margin: 0 3.5px 0 0;'
  229. + '}'
  230. + 'ul.tabButtons {'
  231. // + 'width: calc(100% + 36px);'
  232. + '}'
  233. + 'ul.tabButtons.subMenu {'
  234. + 'position: absolute;'
  235. + 'display: none;'
  236. + '}'
  237. + 'li#format {'
  238. // + 'width: 46px;'
  239. + '}'
  240. + 'li#format .tabformat:hover {'
  241. + 'color: white !important;'
  242. + '}'
  243. + 'li#format:hover ul.tabButtons.subMenu {'
  244. + 'display: block;'
  245. + 'color: black;'
  246. + 'margin-left: -81px;'
  247. + '}'
  248. + '#video-tabs {'
  249. + 'position: relative;'
  250. + 'z-index: 1000;'
  251. + '}'
  252. + 'ul.tabButtons.subMenu a:empty {'
  253. + 'display: none;'
  254. + '}';
  255. },
  256. orginal : function(){
  257. return ''
  258. + '.orginal #format, .orginal #maximize, .orginal #reload {'
  259. + 'display: none !important;'
  260. + '}'
  261. + '.orginal #relatedVideosMoreLinkNew {'
  262. + 'display: block !important;'
  263. + '}';
  264. },
  265. fullPlayer : function(){
  266. return ''
  267. + '.fullPlayer body {'
  268. + 'position: absolute;'
  269. + 'width: 100%;'
  270. + 'height: 100%;'
  271. + 'overflow: hidden;'
  272. + 'background-color: #C84D59;'
  273. + '}'
  274. + '.fullPlayer embed#flash-player-embed {'
  275. + 'width: 100% !important;'
  276. + 'height: 100% !important;'
  277. + '}'
  278. + '.fullPlayer #player {'
  279. + 'position: absolute;'
  280. + 'width: calc( 100% - 30px ) !important;'
  281. + 'height: calc( 100% - 30px ) !important;'
  282. + 'top: 15px;'
  283. + 'left: 15px;'
  284. + 'box-sizing: border-box;'
  285. + 'padding: 5px;'
  286. + 'border-style: solid;'
  287. + 'border-width: 5px;'
  288. + 'border-color: wheat;'
  289. + 'border-radius: 8px;'
  290. + 'box-shadow: 0px 0px 20px 2px black;'
  291. + 'background-color: black;'
  292. + '}'
  293. + '.fullPlayer #page {'
  294. + 'position: static !important;'
  295. + '}'
  296. + '.fullPlayer body > * {'
  297. + 'width: 0 !important;'
  298. + 'height: 0 !important;'
  299. + 'padding: 0px !important;'
  300. + '}';
  301. },
  302. style : function( id ){
  303. var $id = $( 'head #' + id ), cssID = css[ id ]().formatString();
  304. $id.length ? $id.html( cssID ) : $( $( '<style/>',{ id: id, class:'mySuperStyles', html: cssID } ) ).appendTo('head');
  305. }
  306. },
  307. html = {
  308. RatioButtons : function( ){
  309. return [
  310. { name :'16:9', ratio :'16:9' },
  311. { name :'16:10', ratio :'16:10' },
  312. { name :'5:4', ratio :'5:4' },
  313. { name :'588:486', ratio :'Std' }
  314. ];
  315. },
  316. ButtonsVideo : function( ){
  317. return [
  318. { name :'format' },
  319. { name :'maximize' },
  320. { name :'reload' }
  321. ];
  322. },
  323. videoButtons: function(){
  324. css.style('videoButtons');
  325.  
  326. var tmp = $('<span/>'),
  327. ratioLi = function( i, val ){
  328. return $('<li/>').append( $('<a/>',{ class:'btn btn-default', 'data-vf': val.name, 'data-choice': i, text: val.ratio }) );
  329. },
  330. normLi = function( e ){
  331. var cap = e.name.capitalizeFirst();
  332. return $('<li/>',{ id: e.name, 'data-ref': 'tab' + cap }).append( $('<a/>',{ class:'btn btn-default', text: cap }) );
  333. };
  334.  
  335. $( '#format').size() === 0 && (
  336. $.each( html.ButtonsVideo(), function( i, e ){
  337. tmp.append( normLi(e) );
  338. }),
  339. tmp.find( '#format a' ).append( $('<ul/>',{ class:'tabButtons subMenu' }) ),
  340. $.each( html.RatioButtons(), function( i, val ){
  341. i++;
  342. tmp.find( '.tabButtons' ).append( ratioLi( i, val ) );
  343. }),
  344. $( '#video-tabs ul.tab-buttons' ).append( tmp.html() )
  345. );
  346.  
  347. },
  348. menuButton : function(){
  349. css.style('menuButton');
  350.  
  351. },
  352. menuMouse : function(){
  353.  
  354.  
  355. var isVideo = config.isVideo,
  356. menuHtml =
  357. '<ul id="ClickMenu" style="display:none;">';
  358.  
  359. menuHtml += !isVideo ?
  360. '<li class="UI_choice 9" data-state="next">Next Page</li>'
  361. + '<li class="UI_choice 9" data-state="prev">Prev Page</li>' :
  362. '<li class="UI_choice 1" data-state="big">Big</li>';
  363.  
  364. menuHtml +=
  365. '<li class="UI_choice 8" data-state="reload">Reload</li>'
  366. + '<li class="UI_choice 3" data-state="normal">Normal</li>'
  367. + '<li class="UI_choice 3" data-state="myNormal">My Normal</li>'
  368. + '<li class="UI_choice 3" data-state="wide">Wide</li>'
  369. + '<li class="UI_choice 3" data-state="extra">Extra</li>'
  370. + '<li class="UI_choice 3" data-state="dyn">Dynamisk</li>'
  371. + '<li class="UI_choice 3" data-state="orginal">Orginal</li>';
  372.  
  373. menuHtml += isVideo ?
  374. '<li class="UI_choice 5" data-state="#main h2">Scroll Title</li>'
  375. + '<li class="UI_choice 5" data-state="#main #content">Scroll Video</li>'
  376. + '<li class="UI_choice 5" data-state="#relatedVideosWithMore">Scroll Related</li>' : ' ';
  377.  
  378. menuHtml +=
  379. '</ul>';
  380.  
  381. $( menuHtml ).appendTo('body');
  382.  
  383. }
  384. },
  385. fn = {
  386. fullplayer : function( type ){
  387. if( g.ms !== 0 ) return false; else g.timer( 256 );
  388.  
  389. $( 'head #fullPlayer' ).length || css.style('fullPlayer');
  390. toggleClassState( config, 'fullPlayer', type );
  391. config.isVideo && GM_setValue('fullPlayer', config.fullPlayer );
  392. },
  393. orginal : function( type ){
  394. toggleClassState( config, 'enhanced', type );
  395. toggleClassState(config, 'orginal', !config.enhanced);
  396. toggleClassState(config, 'hideAds', config.enhanced);
  397. $( 'head #orginal' ).length || css.style('orginal');
  398. $( 'head #ads' ).length || css.style('ads');
  399. },
  400. getVideoLength : function( $e ){
  401. var h, min, sec,
  402. txt = $e.find( '.duration' ).text().replace(/\(|\)/g,'');
  403.  
  404. h = txt.inElem('h') ? parseInt( txt.split( 'h' ).shift() ) * 60 * 60 : 0;
  405. txt = txt.inElem('h') ? txt.split( 'h' ).pop() : txt;
  406.  
  407. min = txt.inElem('min') ? parseInt( txt.split( 'min' ).shift() ) * 60 : 0;
  408. sec = txt.inElem('sec') ? parseInt( txt.split( 'min' ).pop().split( 'sec' ).shift() ) : 0;
  409.  
  410. return h + min + sec + '';
  411. },
  412. thumbs : function(){
  413.  
  414. var relatedVideos = $( '#relatedVideosWithMore' );
  415.  
  416. if( relatedVideos.hasClass('done') ) return false; else relatedVideos.hide().addClass('done');
  417.  
  418. var clickCounter = 0,
  419. sortCounter = 1,
  420. newContainer = $( '<span/>',{ class:"newContainer", style:"position: relative; top: 0%;" }),
  421. newMoreClone = $( '<div/>',{ id:"relatedVideosWithMore" }),
  422. reArrange = function(){
  423. relatedVideos.find( '.thumbBlock' ).each(function( i, relatedElem ){
  424. var $relatedElem = $( relatedElem ), thumbInside = $relatedElem.find( '.thumbInside ' );
  425.  
  426. thumbInside.text().length === 0 && thumbInside.each(function( i, insideElem ){
  427. var $insideElem = $( insideElem );
  428. $insideElem.append( $insideElem.html().extract('<!--','-->','inside') ); });
  429.  
  430. $relatedElem
  431. .attr( 'data-SortCounts', sortCounter++ )
  432. .attr( 'data-SortLength', fn.getVideoLength( $relatedElem ).lpad( '0', 5 ) );
  433.  
  434. newContainer.find( '#' + $relatedElem.attr('id') ).length || newContainer.append( $relatedElem );
  435. });
  436.  
  437. $( '#relatedVideosWithMore' ).replaceWith( newMoreClone.append( newContainer ) );
  438.  
  439. $( '#relatedVideosMoreLink' ).replaceWith(
  440. $( '#relatedVideosMoreLink' )
  441. .attr('id','relatedVideosMoreLinkNew')
  442. .css('cssText','margin: 0 auto; width: 131px; font-weight: bold; display: none;') );
  443.  
  444. fn.sorter('SortLength');
  445.  
  446. config.fullPlayer && fn.fullplayer( true );
  447.  
  448. return false;
  449. },
  450. loadThumbs = function(){
  451. clickCounter++;
  452. clickCounter > 3 && reArrange();
  453. $( '#relatedVideosMoreLink a').simulate('click');
  454. clickCounter > 2 && relatedVideos.show();
  455. clickCounter < 5 && setTimeout(function(){ loadThumbs(); }, clickCounter == 3 ? 0 : 250 * clickCounter );
  456. };
  457.  
  458. loadThumbs();
  459.  
  460. $d.on('click', '#relatedVideosMoreLinkNew', function(){
  461. var elem = $( '.newContainer' ), top = elem.css('top'), newTop;
  462. newTop = top == '0%' ? '-100%' : top == '-100%' ? '-200%' : top == '-200%' && '0%';
  463. elem.animate({ top: newTop }, newTop == '0%' ? 128 : 1000 );
  464. });
  465.  
  466. },
  467. thumbBlock : function() {
  468. $('.mozaique.thumbs-5').find('.thumb-block').each(function( i, elm ) {
  469. var $elm = $(elm);
  470. $elm.find('img').length || $elm.find('.thumb > a').append( $('<img/>',{ id: 'pic_' + $elm.attr('id').split('_').pop(), src: $elm.find('a').data('src') } ) );
  471. });
  472. },
  473. tabformat : function( elem ){
  474. var thisFormat = elem.data('vf').split(':'),
  475. newFormat = thisFormat[1] / thisFormat[0],
  476. thisButton = elem.attr('data-choice');
  477. config.videoFormat = newFormat;
  478. GM_setValue( 'xVideo_VF', newFormat );
  479. GM_setValue( 'xVideo_VFbutt', thisButton );
  480. },
  481. sorter : function( action ){
  482. //c.i('action',action)
  483. //$( '.sortButton' ).removeClass( 'sel' );
  484. //$( '#' + action ).addClass( 'sel' );
  485. //$( 'html' ).removeClass( 'SortCounts SortLength' ).addClass( action );
  486.  
  487. $( '.thumb-block, .thumbBlock' ).tsort({attr:'data-' + action, order: action == 'SortCounts' ? 'asc':'dec' });
  488. //$('#content, #tabVideos').delay(1100).fadeIn( 800, "linear" );
  489. //GM_setValue( 'sortState', action );
  490. },
  491. preSorter : function(){
  492.  
  493. var counter = 1;
  494. $( '.mozaique' ).find( '.thumb-block, .thumbBlock' ).each(function( i, elm ){
  495. var $elm = $( elm ), videoLen = fn.getVideoLength( $elm );
  496. $elm.attr( 'data-SortCounts', counter++ )
  497. .attr( 'data-SortLength', videoLen.lpad( '0', 5 ) )
  498. .addClass( videoLen < 300 ? 'max5': videoLen < 600 ? 'max10':'min10');
  499. });
  500. counter === 1 && fn.preSorter();
  501. fn.sorter('SortLength');
  502. },
  503. filter : function( moreOrLess, minutes ){
  504.  
  505. },
  506. reload : function( type ){
  507. type === 'page' ? loadDoc( locDoc ) : type === 'video' && refreshElement( $('#player') , 'slow' );
  508. },
  509. runUI : function(){
  510. config.startWidth();
  511. css.style('dynCss');
  512. },
  513. switchUI : function( ui ){
  514. this.orginal( ui == 'orginal' ? 'Toggle' : true );
  515. config.pageUI = ui;
  516. this.runUI();
  517. config.isVideoURL ? GM_setValue( 'xVideo', ui ) : GM_setValue( 'xVideo_List', ui );
  518. },
  519. firstRun : function(){
  520. alert('Welcome to your first time or first use after reinstallion or after reset Configuration');
  521. GM_setValue( 'firstRun', false );
  522. GM_setValue( 'xVideo', 'myNormal' );
  523. GM_setValue( 'xVideo_VF', 10/16 );
  524. GM_setValue( 'xVideo_List', 'myNormal' );
  525. GM_setValue( 'xVideo_VFbutt', '4' );
  526. },
  527. delConfig : function(){
  528. var arr = ['pageUI','fullPlayer','xVideo_List','xVideo_VFbutt','xVideo_VF','firstRun','xVideo'];
  529. $.each( arr, function(i,e){
  530. GM_deleteValue( e );
  531. });
  532. alert('Settings has now been - reset back to default settings');
  533. },
  534. setConfig : function(){
  535. c.i( 'setConfig' );
  536. GM_getValue( 'firstRun' ) === undefined && this.firstRun();
  537. config.isVideoURL = '.com/video'.inURL();
  538. config.pageUI = GM_getValue( config.isVideoURL ? 'xVideo':'xVideo_List' );
  539. config.fullPlayer = GM_getValue( 'fullPlayer' );
  540. config.videoFormat = GM_getValue( 'xVideo_VF' ) || 10/16;
  541. config.videoButton = GM_getValue( 'xVideo_VFbutt' );
  542. config.startWidth();
  543. config.next = 'next';
  544. config.prev = 'prev';
  545. },
  546. loadHref : function( dir ){
  547. // $('.pagination a:contains(Prev)' ).length
  548. // $('.pagination a:contains('+ dir +')' ).simulate('click');
  549. $('.pagination a.sel, .pagination a.active').parent()[ dir ]().find('a').simulate('click');
  550. // $('#content, #tabVideos').fadeOut( 64, "linear" ).delay(64).fadeIn( 800, "linear" );
  551. setTimeout(function(){
  552. render.sorter();
  553. }, 256);
  554. }
  555. },
  556. listners = {
  557. player : function(){
  558. c.i('player');
  559. $d.on('mousedown','.fullPlayer body, body',function(e){
  560.  
  561. //filterClick( e, this ) && g.ms == 0 && ( g.timer(64), fn.fullplayer('toggle') );
  562. });
  563. },
  564. pagenav : function(){
  565. c.i('pagenav');
  566. config.hasPagnation = true;
  567. $d.on('click','.page-body',function(e){
  568.  
  569. var X_spot = e.clientX,
  570. ContentElem = $('#page'),
  571. ContentLeft = ContentElem.offset().left,
  572. ContentRight = ContentLeft + ContentElem.width();
  573.  
  574. filterClick( e, this ) && ( X_spot < ContentLeft || X_spot > ContentRight ) &&
  575. fn.loadHref( X_spot < ContentLeft ? config.prev : config.next );
  576. });
  577. //e.stopPropagation()
  578. //e.preventDefault()
  579. },
  580. videoButtons: function(){
  581. html.videoButtons();
  582. $d.on('mouseup', 'ul.tabButtons.subMenu a', function(){
  583. fn.tabformat( $( this ) );
  584. css.style('dynCss'); });
  585. $d.on('mouseover', '#format', function(){
  586. $( '#format li' ).css('cssText','');
  587. $( '#format li[data-choice='+( GM_getValue('xVideo_VFbutt') )+']' ).css('cssText','color:red; font-weight: bold;'); });
  588. $d.on('mouseup', '#maximize', function(){
  589. config.isVideo && config.fullPlayer || fn.fullplayer( true ); });
  590. $d.on('mouseup', '#reload', function(){
  591. fn.reload('video'); });
  592. },
  593. resize : function(){
  594. $w.resize(function(){ config.fullPlayer || fn.runUI(); });
  595. },
  596. menuMouse : function(){
  597. css.style('menuMouse');
  598. html.menuMouse();
  599. $d.on('mousedown', '.UI_choice', function(e){
  600.  
  601. e.stopPropagation();
  602. e.preventDefault();
  603.  
  604. var $this, state, getIt;
  605. e.target == this && e.which == 1 && (
  606. $this = $(this),
  607. state = $this.data('state'),
  608. getIt = GM_getValue( 'xVideo_Scroll' ) == 'undefined' || GM_getValue( 'xVideo_Scroll' ) === undefined ? "#main h2" : GM_getValue( 'xVideo_Scroll' ),
  609. $('#ClickMenu').hide( 512 ),
  610. $this.hasClass('1') ? config.isVideo && config.fullPlayer || fn.fullplayer( true ) :
  611. $this.hasClass('9') ? fn.loadHref( config[ state ] ) :
  612. $this.hasClass('5') ? ( ScrollZoomTune( state, 1, -2, 1, 'slow'), GM_setValue( 'xVideo_Scroll', state ) ) :
  613. $this.hasClass('8') ? fn.reload('page') :
  614. ( fn.switchUI( state ), ScrollZoomTune( getIt, 1, -2, 1, 'slow') )
  615. );
  616. });
  617.  
  618. $d.on('mouseleave','#ClickMenu',function(){
  619. $('#ClickMenu').hide(); });
  620.  
  621. $( document ).on('click','body',function(e){
  622.  
  623. var X_spot = e.clientX,
  624. ContentElem = $('#page'),
  625. ContentLeft = ContentElem.offset().left,
  626. ContentRight = ContentLeft + ContentElem.width();
  627.  
  628. e.stopPropagation();
  629.  
  630. $('#ClickMenu').is(':hidden') && e.target == this && e.which == 1 && (
  631. config.fullPlayer ?
  632. config.isVideo && fn.fullplayer( false ) :
  633. config.fullPlayer || ( X_spot < ContentLeft || X_spot > ContentRight ) && (
  634. $('.cActive').removeClass('cActive'),
  635. $('#ClickMenu')
  636. .css('cssText', 'left: '+( e.clientX - 50 )+'px; top: '+( e.clientY - 12 )+'px; display:block;' )
  637. .find('li[data-state='+ config.pageUI +']').addClass('cActive'),
  638. $( 'ul.tm' ).hide() ) );
  639. });
  640. },
  641. keyNav : function(){
  642. d.addEventListener('keydown', function(e){
  643. if( $('input').is(':focus') || g.ms !== 0 ) return false; else g.timer( 64 );
  644.  
  645. var key = e.keyCode; c.i('Key',key);
  646.  
  647. switch( key ){
  648. case 27: config.isVideo && config.fullPlayer && ( g.ms = 0, fn.fullplayer( false ) ); break; // esc
  649. case 39: config.isVideo || fn.loadHref( config.next ); break; // arrow right
  650. case 66: config.isVideo && config.fullPlayer || ( g.ms = 0, fn.fullplayer( true ) ); break; // b
  651. case 37: config.isVideo || fn.loadHref( config.prev ); break; // arrow left
  652. case 82: fn.delConfig(); break; //r
  653. case 68: fn.switchUI('dyn'); break; //d
  654. case 69: fn.switchUI('extra'); break; //e
  655. case 87: fn.switchUI('wide'); break; //w
  656. case 78: fn.switchUI('normal'); break; //n
  657. case 77: fn.switchUI('myNormal'); break; //m
  658. case 79: fn.switchUI('orginal'); break; //o -
  659. }
  660. }, false);
  661. }
  662. },
  663. render = {
  664. start : function(){
  665. fn.setConfig();
  666. css.style('main');
  667. fn.switchUI( config.pageUI );
  668. listners.keyNav();
  669. listners.resize();
  670. },
  671. sorter : function(){
  672. c.i('sorter');
  673. fn.preSorter();
  674. // setTimeout(function(){ fn.sorter('SortLength'); },512);
  675. },
  676. video : function(){
  677. c.i('video');
  678. config.isVideo = true;
  679. listners.videoButtons();
  680. fn.thumbs();
  681. fn.thumbBlock();
  682. this.sorter();
  683. },
  684. list : function(){
  685. config.hasPagnation = true;
  686. this.sorter();
  687. }
  688. },
  689. observer = new MutationObserver( function( mutations ){
  690. mutations.forEach( function( mutation ){
  691. $( mutation.addedNodes ).each( function( i, e ){
  692. var $e = $(e), $p = $e.parent();
  693. // $e.hasId('content') || $e.hasId('tabVideos') && ( $e.fadeOut( 0, "linear" ), $e.hide(), c.i('jjj', e.id ));
  694. //$e.hasId('tabVideos') && $e.fadeOut( 128, "linear" ).delay(800).fadeIn( 800, "linear" )
  695. //$e.isTag('body') && $e.fadeOut( 1, "linear" ).delay(800).fadeIn( 1800, "linear" )
  696. });
  697. });
  698. });
  699.  
  700. observer.observe( document, { subtree: true, childList: true });
  701.  
  702. c.i('www.xvideos.com II');
  703.  
  704. $d.ready(function(){
  705. render.start();
  706. $('#player, embed').length && render.video();
  707.  
  708. setTimeout(function(){
  709. ( $('.pagination').length || !config.isVideo ) && ( render.list() );
  710. listners.menuMouse();
  711. $('.mySuperStyles').appendTo('head');
  712. }, 1512);
  713. });
  714.  
  715. setTimeout(function(){ $('footer').length || loadDoc( locDoc ); },4000 );
  716.  
  717. }(jQuery));
  718.  
  719.  
  720.