ScalesImgageForJavHHH

ScaleInPics

  1. // ==UserScript==
  2. // @name ScalesImgageForJavHHH
  3. // @namespace https://4ca.st
  4. // @version 1.3.6
  5. // @description ScaleInPics
  6. // @author Nazicp
  7. // @match https://javhhh.com/*
  8. // @icon https://javhhh.com/template/javhhh/images/favicon.ico
  9. // @downloadurl https://gist.githubusercontent.com/nazicp/57443bac407c6ae77bf8b21efc0e6217/raw/b2620ea57e39affd82901015c744b2b8679b3a51/ScalesImgageForJavHHH.js
  10. // @updateurl https://gist.githubusercontent.com/nazicp/57443bac407c6ae77bf8b21efc0e6217/raw/b2620ea57e39affd82901015c744b2b8679b3a51/ScalesImgageForJavHHH.js
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. $(function(){
  15. "use strict";
  16. var modal=`<div id="picmodal" class="modal fade" tabindex="-1" role="dialog">
  17. <div class="modal-dialog" style="max-width: 1000px;" role="document">
  18. <div class="modal-content">
  19. <img id="picmodalImage" src="" style="border-radius:10px 10px 0 0">
  20. <div class="text-shadow" id="picmodalText" style="padding:10px">
  21. <h4 id="video-title"></h4>
  22. <div id="video-info"></div>
  23. <a href="" id="video-url" target="_blank" class="btn btn-info btn-lg fa fa-link hidden"></a>
  24. </div>
  25. </div>
  26. </div>
  27. </div>`;
  28. $('body').append(modal);
  29. $('#picmodal').modal({show:false}).on('show.bs.modal',function(e){
  30. let container=e.relatedTarget.offsetParent;
  31. let img=$(container).find('img[data-qazy]');
  32. let href=container.querySelector('a').href;
  33. $('#picmodalImage').attr('src',img.attr('src').replace('_400.jpg',''));
  34. $('#video-title').text(img.attr('title'));
  35. let urlseg=href.split('/');
  36. $('#video-url').attr('href',href).text(urlseg[urlseg.length-2]).removeClass('hidden');
  37.  
  38. }).on('hidden.bs.modal',function(){
  39. $('#picmodalImage').attr('src','');
  40. $('#video-info').empty();
  41. $('#video-title').empty();
  42. $('#video-url').empty().removeAttr('href').addClass('hidden');
  43. }).on('shown.bs.modal',function(){
  44. var href=$('#video-url').attr('href');
  45. $.ajax(href,{
  46. async:true,
  47. method:'GET',
  48. beforeSend:function(xhr,text){
  49. var htmltemp=`<i class="fa fa-spin fa-spinner fa-2x"></i> It might be take a few time for first load...`;
  50. $('#video-info').html(htmltemp);
  51. },
  52. cache:true,
  53. converters:{"* text": window.String, "text html": true, "application json":window.String},
  54. dataType:'text',
  55. success:function(d,status,xhr){
  56. var headers=xhr.getResponseHeader("content-type");
  57. if(headers=='application/json; charset=utf-8'){
  58. xhr.then(function(){
  59. $.get(href,{},function(dd){
  60. var info=$(dd).find('.col-12:has(.card-sub)').html();
  61. $('#video-info').html(info);
  62. },'html');
  63. });
  64. }else{
  65. var info=$(d).find('.col-12:has(.card-sub)').html();
  66. $('#video-info').html(info);
  67. }
  68. },
  69. error:function(){
  70. errFunc;
  71. }
  72. });
  73. });
  74.  
  75. $('.content-views').html(function(i,n){
  76. return n + `<a href="javascript:;" data-toggle="modal" data-target="#picmodal" class="fa fa-eye fa-fw"></a>`;
  77. });
  78. });
  79.