Animeforce premium

Permette di godere in maniera ottimale della piattaforma Animeforce, skippando alcune pagine intermedie e avendo il download diretto delle puntate

  1. // ==UserScript==
  2. // @name Animeforce premium
  3. // @description Permette di godere in maniera ottimale della piattaforma Animeforce, skippando alcune pagine intermedie e avendo il download diretto delle puntate
  4. // @author Maxeo | maxeo.net
  5. // @license https://creativecommons.org/licenses/by-sa/4.0/
  6. // @include http://*.animeforce.org/*
  7. // @include https://*.animeforce.org/*
  8. // @homepageURL https://greasyfork.org/it/scripts/25912-animeforce-premium
  9. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js
  10. // @require https://greasyfork.org/scripts/372499-bootstrap-tooltip-js-v2-3-2/code/bootstrap-tooltipjs%20v232.js?version=631225
  11. // @require https://greasyfork.org/scripts/26454-jquery-cookie/code/jQuery%20Cookie.user.js
  12. // @version 2.4.6
  13. // @grant none
  14. // @namespace https://greasyfork.org/users/88678
  15. // @icon https://www.maxeo.net/imgs/icon/greasyfork/animeforcePremium.png
  16. // ==/UserScript==
  17.  
  18. function AFP_index() {
  19. var $ = jQuery;
  20. var AFPremium = {
  21. menu: {
  22. functions: {
  23. addPremiumMenu: {
  24. enable: true,
  25. title: "Aggiungi menu premium",
  26. description: "Aggiunge il menu premium nelle pagine non di streaming",
  27. warning: "Disabilitando questa voce sarà necessario andare su https://ww1.animeforce.org/premium per per modificare le impostazioni"
  28. },
  29. animeDownloadIstant: {
  30. enable: true,
  31. title: "Download istantaneo",
  32. description: "Aggiunge il download istantaneo nella lista degli episodi dell'anime",
  33. dependances: ['removeAdflyInPageAnime'],
  34. },
  35. decreaseAD: {
  36. enable: true,
  37. title: "DecreaseAD",
  38. description: "Riduce la pubblicità nel sito. Senza che sia necessario l'utilizzo di AdBlock o simili.",
  39. },
  40. dontBlocADblock: {
  41. enable: true,
  42. title: "Non bloccare AdBlock",
  43. description: "Su alcune pagine AdBlock non verrà 'bloccato'",
  44. },
  45. linkDirettoHomePage: {
  46. enable: true,
  47. title: "Link diretto in HomePage",
  48. description: "Nella homepage i link agli episodi saranno diretti <br> PS. Pagine secondarie non ancora supportate",
  49. dependances: ['loadAnimeList'],
  50. },
  51. miglioraUtilizzoMenu: {
  52. enable: true,
  53. title: "Menu percettivo",
  54. description: 'Il menu principale apparirà ogni volta che si passa il mouse sulla barra dei menu',
  55. },
  56. premiumSearchHomePage: {
  57. enable: true,
  58. title: "Ricerca Anime in homepage",
  59. description: 'Nella homepage sarà possibile utilizzare il form di ricerca per cercare direttamente dalla lista degli episodi',
  60. dependances: ['loadAnimeList'],
  61. },
  62. searchInList: {
  63. enable: true,
  64. title: "Ricerca aggiuntiva nelle liste",
  65. description: "In 'lista episodi' e 'Anime in corso' aggiunge una ricerca testuale",
  66. },
  67. },
  68.  
  69. },
  70. cvar: {},
  71. customElements: {
  72. afphechbox: '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;width: 30px;height: 30px;border: 2px solid #000;" xml:space="preserve"><path style="fill:none;stroke:#000000;stroke-dashoffset: 73px;stroke-width: 6px;transition: 1s cubic-bezier(.63,.41,.04,.61);" d="M14.8,58.5c0,0,13.9,23.7,21.8,28.9c7.9,5.2,48.6-75.1,48.6-75.1"></path></svg>'
  73. },
  74. pagetype: undefined,
  75. logs: 1,
  76. loadPageType: function () {
  77. if ($('body').hasClass('home')) {
  78. this.setPageType('home')
  79. } else
  80. if ($('body').hasClass('error404')) {
  81. if (location.pathname == '/premium') {
  82. this.setPageType('premium-menu')
  83. } else {
  84. this.setPageType('error404')
  85. }
  86. } else if (($('body').attr('class') == undefined || $('body').attr('class') == '') && $('#menu-menu-2').length == 0) {
  87. this.setPageType('streaming-page')
  88. } else if ($('body').hasClass('single-post')) {
  89. if ($('table img[src="/DDL/download.png"], table img[src="/DDL/streaming.png').length) {
  90. this.setPageType('episode-list')
  91. } else {
  92. this.setPageType('episode-preview')
  93. }
  94. } else if (location.pathname == '/lista-anime/' || location.pathname == '/lista-anime-in-corso/') {
  95. this.setPageType('lista-anime');
  96. } else if ($('body').hasClass('archive')) {
  97. this.setPageType('archive');
  98. } else if (location.pathname == '/lista-anime-hentai/') {
  99. this.setPageType('hentai');
  100. }
  101.  
  102. return this.pagetype;
  103. },
  104. setPageType: function (pagename) {
  105. this.pagetype = pagename;
  106. },
  107. getPageType: function () {
  108. return this.pagetype;
  109. },
  110. executeFunctionality: function (funct_name) {
  111. var dependenceLoaded = [];
  112. for (var index in arguments) {
  113. this.fComponents.loadAnimeList();
  114. if (this.menu.functions[arguments[index]].dependances != undefined) {
  115. var requiredF = this.menu.functions[arguments[index]].dependances;
  116. for (var subindex in requiredF) {
  117. if (!(dependenceLoaded.indexOf(requiredF[subindex]) + 1)) {
  118. dependenceLoaded.push(requiredF[subindex])
  119. this.fComponents[requiredF[subindex]]();
  120.  
  121. }
  122. }
  123. }
  124.  
  125. if (this.menu.functions[arguments[index]].enable) {
  126. this.functionalities[arguments[index]]();
  127. }
  128.  
  129. }
  130. },
  131. loadFunctionalities: function () {
  132. //Eseguo dipendenze
  133. for (var index in this.requiredFuntions) {
  134. this.requiredFuntions[index]();
  135. }
  136.  
  137. //funzionalità globali
  138. this.executeFunctionality('decreaseAD', 'miglioraUtilizzoMenu');
  139.  
  140.  
  141. //funzionalità specifiche
  142. switch (this.getPageType()) {
  143. case 'home':
  144. this.executeFunctionality('addPremiumMenu', 'premiumSearchHomePage', 'linkDirettoHomePage');
  145. break;
  146. case 'premium-menu':
  147. this.functionalities.premiumMenu();
  148. this.executeFunctionality('addPremiumMenu');
  149. break;
  150. case 'episode-list':
  151. this.executeFunctionality('addPremiumMenu', 'animeDownloadIstant');
  152. break;
  153. case 'episode-preview':
  154. this.executeFunctionality('addPremiumMenu');
  155. break;
  156. case 'lista-anime':
  157. this.executeFunctionality('addPremiumMenu', 'searchInList');
  158. break;
  159. case 'archive':
  160. this.executeFunctionality('addPremiumMenu', 'searchInList');
  161. break;
  162. case 'hentai':
  163. this.executeFunctionality('addPremiumMenu');
  164. break;
  165. case 'error404':
  166. this.executeFunctionality('addPremiumMenu');
  167. break;
  168. case 'streaming-page':
  169. this.executeFunctionality('dontBlocADblock');
  170. break;
  171. default:
  172.  
  173. }
  174. },
  175. functionalities: {
  176. /*
  177. * Aggiunge il menu premium alle pagine
  178. */
  179. addPremiumMenu: function () {
  180. $('#menu-menu-2').append('<li class="menu-item"><a href="/premium">Menu Premium</a></li>')
  181. },
  182. decreaseAD: function () {
  183. /*** PAGINA DI STREAMING ***/
  184. if (AFPremium.getPageType() == 'streaming-page') {
  185. var disableFunction = setInterval(function () {
  186. if ($("body > center + *").length) {
  187. $('footer').remove();
  188. while ($("body > center + *").length) {
  189. $("body > center + *").remove();
  190. }
  191. }
  192. }, 300)
  193.  
  194. } else {
  195. /*** PAGINE NON DI STREAMING ***/
  196. $('[style^="position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px; z-index: 2147483647;"]')
  197. .attr('style', "position:fixed;right:200vw")
  198. .css('display', 'none')
  199. $('.tp-loader').remove()
  200. $('#menu-menu-2 a').each(function () {
  201. $(this).attr('href', $(this).attr('href').replace('//adf.ly/16031519', ''))
  202. })
  203. $('.widget-unwrapped iframe').parent().addClass('fb-container').removeClass('widget-unwrapped')
  204. $('.widget-unwrapped').remove()
  205. if (AFPremium.getPageType() == 'episode-list') {
  206. $('.code-block.code-block-3').remove();
  207. }
  208.  
  209. }
  210. },
  211. dontBlocADblock: function () {
  212. var disableFunction = setInterval(function () {
  213. if ($('[href="http://www.animeforce.org/block/guida.html"]').parents('[id]').length) {
  214. $('[href="http://www.animeforce.org/block/guida.html"]').parents('[id]').remove();
  215. clearInterval(disableFunction);
  216. }
  217. }, 300);
  218.  
  219. },
  220. searchInList: function () {
  221. var src_input = '<input id="filtro" type="text" placeholder="Scrivi qui per cercare tra gli anime" style="width: 100%">'
  222. $('.the-content p').eq(0).append(src_input);
  223. $('#filtro').on('keyup', function () {
  224. if ($('#filtro').val().length >= 1) {
  225. $('.the-content h2').css('display', 'none');
  226. $('.the-content').find('li').each(function () {
  227. if ($(this).is(':icontains(\'' + $('#filtro').val() + '\')'))
  228. $(this).css('display', '');
  229. else
  230. $(this).css('display', 'none');
  231. });
  232. } else {
  233. $('.the-content li,.the-content h2').css('display', '');
  234. }
  235. });
  236. },
  237. miglioraUtilizzoMenu: function () {
  238. if (AFPremium.getPageType() != 'streaming-page') {
  239. $('#menu-menu-2 .sub-menu').css('display', 'none')
  240. $('#menu-menu-2').on('mouseover', function () {
  241. $('#menu-menu-2 #menu-item-21035 .sub-menu').css('display', 'block').css('visibility', 'visible')
  242. })
  243. $('#menu-menu-2').on('mouseout', function () {
  244. $('#menu-menu-2 .sub-menu').css('display', 'none')
  245. })
  246. }
  247. },
  248. animeDownloadIstant: function () {
  249. $('body').append('<div class="w8-afp-download" style="position: fixed;right: 0;top: 0;background: rgba(0, 120, 255, 0.63);padding: 18px;z-index: 3000;color: #FFF;font-size: 20px;text-align: right;font-family: Verdana;">Analizzo la pagina per il download diretto.<br>Attendere...</div>')
  250. if ($('img[src="/DDL/download.png"]').length) {
  251. var animeDownloadIstantInt = setInterval(function () {
  252. if (AFPremium.cvar.adflyRemoveUpdated != undefined && AFPremium.cvar.adflyRemoveUpdated == true) {
  253. var url = 'https:' + $('img[src="/DDL/download.png"]').eq(0).parent().attr('href');
  254. $.get('//url-redirect.maxeo.net/?url=' + encodeURI(url), function (data) {
  255. if (data.length > 12) {
  256. var filecode = url.match(/\?file=(.*)/)[1];
  257. var longData = data.match(/file=(.*)/)[1].substr();
  258. var basedata = longData.substr(0, longData.indexOf(filecode))
  259. $('img[src="/DDL/download.png"]').each(function () {
  260. url = $(this).parent().attr('href');
  261. var filecode = url.match(/\?file=(.*)/);
  262. if (filecode != null && filecode.length >= 2) {
  263. filecode = filecode[1];
  264. var downloadLink = 'http://' + basedata + filecode;
  265. $(this).parent().attr('href', downloadLink)
  266. } else {
  267. var piano_b = $(this).parents('tr').eq(0).find('td strong').eq(0).html().replace(/ <span.*$/, '').match(/[0-9]*$/);
  268. if (piano_b.length && piano_b[0].length) {
  269. //console.log('PIANO B');
  270. piano_b = piano_b[0] + '';
  271. if (piano_b.length == 1) {
  272. piano_b = '0' + piano_b;
  273. }
  274. var newLong = longData.match(/(.*\_)([0-9]{1,})\_(.*)$/);
  275. if (newLong != null) {
  276. var downloadLink = 'http://' + newLong[1] + piano_b + '_' + newLong[3];
  277. $(this).parent().attr('href', downloadLink)
  278. }
  279.  
  280. }
  281.  
  282. }
  283. })
  284. $('.w8-afp-download').remove();
  285.  
  286. }
  287. });
  288. clearInterval(animeDownloadIstantInt);
  289. }
  290. }
  291. , 100)
  292. } else {
  293. $('.w8-afp-download').remove();
  294. }
  295.  
  296. },
  297. premiumSearchHomePage: function () {
  298. var animeList = AFPremium.cvar.animeList;
  299.  
  300. $('#searchform input[type="text"]').on('keyup', function () {
  301. var animeList = AFPremium.cvar.animeList;
  302. if ($(this).val().length > 2) {
  303. var positionBox = $('#searchform input').offset()
  304. var input_ricerca = $('#searchform input')
  305. var listaRisultati = [];
  306. if (!$('#box_di_ricerca').length) {
  307. $('body').append('<div class="box-di-ricerca" id="box_di_ricerca"></div>')
  308. $('#box_di_ricerca')
  309. .css('width', input_ricerca.width())
  310. .css('top', (positionBox.top + 10 + input_ricerca.height()) + 'px')
  311. .css('left', (positionBox.left + 10) + 'px')
  312. .css('position', 'absolute')
  313. .css('background', '#FFF')
  314. .css('z-index', 10000);
  315. }
  316. $('#box_di_ricerca').html('<ul style="list-style: none;margin: 0;"></ul>');
  317. for (var index in animeList) {
  318. if (animeList[index].name.toUpperCase().indexOf($(this).val().toUpperCase()) + 1 > 0) {
  319. listaRisultati.push(animeList[index]);
  320. }
  321. }
  322. for (var index in listaRisultati) {
  323. $('#box_di_ricerca ul').append('<li style="padding: 4px;background: #009cff;margin: 2px 0;font-family: Verdana;"><a href="' + listaRisultati[index].link + '">' + listaRisultati[index].name + '</a></li>');
  324. }
  325.  
  326. }
  327. })
  328.  
  329. $('body').on('click', 'div', function () {
  330. if (!$(this).hasClass('box_di_ricerca')) {
  331. $('#box_di_ricerca').remove();
  332. }
  333. })
  334.  
  335.  
  336. },
  337. linkDirettoHomePage: function () {
  338. var linkDirettoInt = setInterval(function () {
  339. if (AFPremium.cvar.animeList != undefined) {
  340. $('.main-loop-inner .panel-wrapper a').each(function () {
  341. var search = $(this).attr('href').match(/(.*)(episodio(-[0-9]{1,}){1,}-)/)
  342. if (search != null && search.length >= 2) {
  343. search = search[1];
  344. var res = AFPremium.functionalities.searchInAnimelist(search, 'link');
  345. if (res != false) {
  346. $(this).attr('href', res).addClass('fixed-link-afp');
  347. }
  348. }
  349. })
  350. clearInterval(linkDirettoInt);
  351. }
  352. }, 100)
  353. },
  354.  
  355. searchInAnimelist: function (what, type_search) {
  356. type_search = type_search = undefined ? 'link' : type_search;
  357. var animeList = AFPremium.cvar.animeList;
  358. for (var index in animeList) {
  359. if (animeList[index][type_search].indexOf(what) + 1) {
  360. return (animeList[index])[type_search]
  361. }
  362. }
  363. return false
  364.  
  365. },
  366. premiumMenu: function () {
  367. var slug = $('.sortbar-title')
  368. var h1 = $('.main-content h1')
  369. var mainContent = $('.main-content')
  370. var searchBox = $('.form-search');
  371.  
  372. $('body').append('<style>input:checked + svg > path {stroke-dasharray: 200,200;}input + svg > path {stroke-dasharray: 70,200;}</style>')
  373.  
  374. if (!$('.content-premium').length) {
  375. mainContent.append('<div class="content-premium"></div>')
  376. }
  377. var contentPremium = $('.content-premium');
  378. slug.html('Menu Premium')
  379. h1.html('Impostazioni Premium')
  380. searchBox.find('input[type="text"]').attr('placeholder', 'Cerca tra le impostazioni')
  381. searchBox.on('submit keyup', function (e) {
  382. e.preventDefault()
  383. $('.content-premium > label').each(function () {
  384. if ($(this).is(':icontains(\'' + searchBox.find('input[type="text"]').val() + '\')'))
  385. $(this).css('display', 'flex');
  386. else
  387. $(this).css('display', 'none');
  388. });
  389. })
  390. var docFunction = AFPremium.menu.functions;
  391. var formAFP = "";
  392.  
  393.  
  394. /** Funzionalità da abilitare/disabilitare **/
  395. formAFP += "<h2>Funzionalità</h2>"
  396. formAFP += '<div class="afp-funct">'
  397. for (var funxtion_name in docFunction) {
  398. var labW = docFunction[funxtion_name].warning == undefined ? '' : 'ATTENZIONE: ' + docFunction[funxtion_name].warning;
  399. formAFP += '<label style="display: flex"><input name="' + funxtion_name + '" style="display:none" type="checkbox"' + (docFunction[funxtion_name].enable ? ' checked=""' : '') +
  400. ' name="' + funxtion_name + '">' + AFPremium.customElements.afphechbox +
  401. ' <p data-html="true" data-toggle="tooltip" ' +
  402. ' data-title="' + docFunction[funxtion_name].description + '" ' +
  403. ' data-warning="' + labW + '" ' +
  404. ' style="font-size: 18px;margin: 7px;padding: 0;">' +
  405. docFunction[funxtion_name].title +
  406. '</p></label>';
  407. }
  408. formAFP += '</div>'
  409.  
  410. contentPremium.html(formAFP);
  411.  
  412.  
  413. $('[data-toggle="tooltip"]').each(function () {
  414. var dataTooltip = $(this).data('title');
  415. if ($(this).data('warning').length) {
  416. dataTooltip += '<br><br><span style="background:red">' + $(this).data('warning') + '</span>';
  417. }
  418. $(this).tooltip({'title': dataTooltip, 'placement': 'top'});
  419.  
  420. })
  421.  
  422. $('.afp-funct input').on('change', function () {
  423. AFPremium.updateSettings($(this).attr('name'), $(this).is(':checked'))
  424. })
  425.  
  426.  
  427.  
  428. },
  429.  
  430. },
  431. fComponents: {
  432. loadAnimeList: function () {
  433. var animeList = AFPremium.cvar.animeList;
  434. $.get('https://ww1.animeforce.org/lista-anime/').done(function (data) {
  435. var bxcontainer = data.match(/(\<div\ class\=\"the\-content\"\>.*(.*\n)*\<script\ type=\"text\/javascript\"\>)+/g) [0]
  436. bxcontainer = bxcontainer.match(/\<li\>\<strong\>\<a\ href=.*\<\/a\>/g)
  437. animeList = [
  438. ];
  439. for (var index in bxcontainer) {
  440. var link = bxcontainer[index].match(/.*">/)[0].match(/\".*\//)[0].replace(/\"/g, '')
  441. var nameAnime = bxcontainer[index].match(/\"\>.*Sub Ita/i)[0].replace(/\"|\/|\>|\</g, '').replace(/\ Sub\ Ita/i)
  442.  
  443. animeList.push({'name': nameAnime, 'link': link})
  444. }
  445. AFPremium.cvar.animeList = animeList;
  446. })
  447. },
  448. removeAdflyInPageAnime: function () {
  449. $.get('#').done(function (data) {
  450. $('table[style="width: 100%;"]').html(data.match(/\<table\ style\=\"width\:\ 100\%\;\"\>\n(.*\n)*\<\/tbody\>\n<\/table>/)[0])
  451. AFPremium.cvar.adflyRemoveUpdated = true
  452. })
  453. },
  454. },
  455. requiredFuntions: {
  456. /*
  457. * Funzione necessaria per ricercare in modo incase sensitive
  458. *
  459. */
  460. icontainsJQuery: function () {
  461. jQuery.expr[':'].icontains = function (a, i, m) {
  462. return jQuery(a).text().toUpperCase()
  463. .indexOf(m[3].toUpperCase()) >= 0;
  464. };
  465. },
  466. /*
  467. * Risolve errori interni al sito
  468. *
  469. */
  470. jQueryAFfix: function () {
  471. jQuery.easing[0] = function () {}
  472. jQuery.easing.def = 0;
  473. jQuery.timer = 0;
  474. (function ($) {
  475. $.fn.jflickrfeed = function () {};
  476. $.fn.tabs = function () {};
  477. })(jQuery);
  478. },
  479. loadSettings: function () {
  480. var settings = {};
  481. if ($.cookie('AFP') != undefined) {
  482. settings = JSON.parse($.cookie('AFP'))
  483. }
  484. for (var index in AFPremium.menu.functions) {
  485. if (settings[index] == undefined) {
  486. settings[index] = AFPremium.menu.functions[index].enable;
  487. }
  488. }
  489. $.cookie('AFP', JSON.stringify(settings), {expires: 3650, path: '/'});
  490. AFPremium.cvar.settings = settings;
  491. for (var index in settings) {
  492. if (AFPremium.menu.functions[index] != undefined) {
  493. AFPremium.menu.functions[index].enable = settings[index];
  494. }
  495.  
  496. }
  497. },
  498.  
  499. },
  500. updateSettings: function (functionality, is_active) {
  501. AFPremium.cvar.settings[functionality] = is_active;
  502. $.cookie('AFP', JSON.stringify(AFPremium.cvar.settings), {expires: 3650, path: '/'});
  503. }
  504.  
  505. };
  506. AFPremium.loadPageType();
  507. AFPremium.loadFunctionalities();
  508. jQuery.test = AFPremium;
  509.  
  510. }
  511.  
  512. AFP_index(); //$('#featured-wrapper #featured img.wp-post-image')
  513.  
  514. // https://url-redirect.maxeo.net/youtube-get-download/?id=xfynvZ8sZRY