EroProfile.com Infinite Scrolling

Adds the ability to automatically load more videos, as you scroll down the page

ของเมื่อวันที่ 30-10-2017 ดู เวอร์ชันล่าสุด

  1. // ==UserScript==
  2. // @name EroProfile.com Infinite Scrolling
  3. // @version 2.0
  4. // @description Adds the ability to automatically load more videos, as you scroll down the page
  5. // @grant none
  6. // @include http://www.eroprofile.com/m/videos/*
  7. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
  8. // @namespace https://greasyfork.org/users/11286
  9. // ==/UserScript==
  10.  
  11. $(document).ready(function () {
  12. $.addGlobalStyle = function (css) {
  13. var head,style;
  14. head = document.getElementsByTagName('head') [0];
  15. if(!head) return;
  16. style = document.createElement('style');
  17. style.type = 'text/css';
  18. style.innerHTML = css;
  19. head.appendChild(style);
  20. };
  21. $.addGlobalStyle('#divVideoListItems{height:auto;overflow:auto;}#divVideoListPageNav{height:200px!important;margin-top:20px;position:relative}#loading{position:absolute;width:256px;height:256px;top:50%;left:50%;margin:-128px 0 0 -128px;transform:scale(.6);-moz-transform:scale(.6);-webkit-transform:scale(.6);-ms-transform:scale(.6);-o-transform:scale(.6)}#loading>div{position:absolute;background-color:#E8E8E8;color:inherit;height:47px;width:47px;border-radius:23px;animation-name:map_loading;animation-duration:1.04s;animation-iteration-count:infinite;animation-direction:normal;-moz-border-radius:23px;-moz-animation-name:map_loading;-moz-animation-duration:1.04s;-moz-animation-iteration-count:infinite;-moz-animation-direction:normal;-webkit-border-radius:23px;-webkit-animation-name:map_loading;-webkit-animation-duration:1.04s;-webkit-animation-iteration-count:infinite;-webkit-animation-direction:normal;-ms-border-radius:23px;-ms-animation-name:map_loading;-ms-animation-duration:1.04s;-ms-animation-iteration-count:infinite;-ms-animation-direction:normal;-o-border-radius:23px;-o-animation-name:map_loading;-o-animation-duration:1.04s;-o-animation-iteration-count:infinite;-o-animation-direction:normal}#loading>div:nth-child(1){left:0;top:105px;animation-delay:.39s;-moz-animation-delay:.39s;-webkit-animation-delay:.39s;-ms-animation-delay:.39s;-o-animation-delay:.39s}#loading>div:nth-child(2){left:30px;top:30px;animation-delay:.52s;-moz-animation-delay:.52s;-webkit-animation-delay:.52s;-ms-animation-delay:.52s;-o-animation-delay:.52s}#loading>div:nth-child(3){left:105px;top:0;animation-delay:.65s;-moz-animation-delay:.65s;-webkit-animation-delay:.65s;-ms-animation-delay:.65s;-o-animation-delay:.65s}#loading>div:nth-child(4){right:30px;top:30px;animation-delay:.78s;-moz-animation-delay:.78s;-webkit-animation-delay:.78s;-ms-animation-delay:.78s;-o-animation-delay:.78s}#loading>div:nth-child(5){right:0;top:105px;animation-delay:.91s;-moz-animation-delay:.91s;-webkit-animation-delay:.91s;-ms-animation-delay:.91s;-o-animation-delay:.91s}#loading>div:nth-child(6){right:30px;bottom:30px;animation-delay:1.04s;-moz-animation-delay:1.04s;-webkit-animation-delay:1.04s;-ms-animation-delay:1.04s;-o-animation-delay:1.04s}#loading>div:nth-child(7){left:105px;bottom:0;animation-delay:1.17s;-moz-animation-delay:1.17s;-webkit-animation-delay:1.17s;-ms-animation-delay:1.17s;-o-animation-delay:1.17s}#loading>div:nth-child(8){left:30px;bottom:30px;animation-delay:1.3s;-moz-animation-delay:1.3s;-webkit-animation-delay:1.3s;-ms-animation-delay:1.3s;-o-animation-delay:1.3s}@-moz-keyframes map_loading{0%{background-color:#0069C6}100%{background-color:transparent}}@-webkit-keyframes map_loading{0%{background-color:#0069C6}100%{background-color:transparent}}@-ms-keyframes map_loading{0%{background-color:#0069C6}100%{background-color:transparent}}@-o-keyframes map_loading{0%{background-color:#0069C6}100%{background-color:transparent}}@keyframes map_loading{0%{background-color:#0069C6}100%{background-color:transparent}}');
  22. $.urlParam = function (name) {
  23. var results = new RegExp('[?&]' + name + '=([^&#]*)').exec(window.location.href);
  24. if(results === null) return null;
  25. else return results[1] || 0;
  26. };
  27. var loading = false;
  28. $('.boxNav2').hide();
  29. $('<div/>', {
  30. id: 'loading'
  31. }).appendTo('#divVideoListPageNav');
  32. for(var i = 0; i < 8; i++) {
  33. $('<div/>').appendTo('#loading');
  34. }
  35. $(window).on('scroll', function () {
  36. var end = $('#divVideoListAd2').offset().top;
  37. var viewEnd = $(window).scrollTop() + $(window).height();
  38. var distance = end - viewEnd;
  39. if(distance <= 0) {
  40. if(loading === false) {
  41. loading = true;
  42. $('#divVideoListPageNav').show();
  43. var params = '';
  44. var niche = $.urlParam('niche');
  45. if(niche) params += '&niche=' + niche;
  46. var text = $.urlParam('text');
  47. if(text) params += '&text=' + text;
  48. var pnum = parseInt($.urlParam('pnum')) || 1;
  49. var new_pnum = pnum + 1;
  50. params += '&pnum=' + new_pnum;
  51. new_url = '?' + params.substring(1);
  52. $.ajax({
  53. url: 'http://www.eroprofile.com/m/videos/' + new_url,
  54. type: 'post',
  55. dataType: 'html',
  56. success: function (data) {
  57. //setTimeout(function(){
  58. $(data).find('div.video').appendTo('#divVideoListItems > .videoGrid');
  59. window.history.pushState('', '', new_url);
  60. $('#divVideoListPageNav').hide();
  61. loading = false;
  62. //},5000);
  63. }
  64. });
  65. }
  66. }
  67. });
  68. });