// ==UserScript== // @name GGN 1click collection add + unfold all filelists // @namespace https://gazellegames.net/torrents // @description unfolds all filelists // @include https://gazellegames.net/torrents.php?id=* // @version 1.11 // @grant none // @downloadURL none // ==/UserScript== //unfold stuff var unfoldLink = document.createElement('a'); var linkText = document.createTextNode('[Unfold all filelists]'); unfoldLink.appendChild(linkText); unfoldLink.id = 'unfoldLink'; unfoldLink.title = 'Unfold all filelists'; unfoldLink.href = '#'; unfoldLink.setAttribute('onclick', 'unfoldAll()'); document.getElementsByClassName('linkbox groupoptions') [0].appendChild(unfoldLink); var topBox = document.getElementsByClassName('linkbox groupoptions')[0]; topBox.innerHTML = topBox.innerHTML + '[Show Collection Add]
'; var ggnAuth = authkey document.getElementById('vive_excl').addEventListener('click', vive_excl, false); document.getElementById('ocul_excl').addEventListener('click', ocul_excl, false); document.getElementById('both_excl').addEventListener('click', both_excl, false); document.getElementById('ocul_supp').addEventListener('click', ocul_supp, false); document.getElementById('vive_supp').addEventListener('click', vive_supp, false); document.getElementById('both_supp').addEventListener('click', both_supp, false); document.getElementById('humble_coll').addEventListener('click', humble_coll, false); document.getElementById('gog_coll').addEventListener('click', gog_coll, false); document.getElementById('native_gamepad_coll').addEventListener('click', native_gamepad_coll, false); document.getElementById('early_access_coll').addEventListener('click', early_access_coll, false); document.getElementById('single_mp_coll').addEventListener('click', single_mp_coll, false); document.getElementById('cracked_online_coll').addEventListener('click', cracked_online_coll, false); document.getElementById('lan_supp_coll').addEventListener('click', lan_supp_coll, false); document.getElementById('procedural_coll').addEventListener('click', procedural_coll, false); document.getElementById('adult_coll').addEventListener('click', adult_coll, false); document.getElementById('zombie_coll').addEventListener('click', zombie_coll, false); document.getElementById('female_prot_coll').addEventListener('click', female_prot_coll, false); document.getElementById('unity_coll').addEventListener('click', unity_coll, false); document.getElementById('unreal_coll').addEventListener('click', unreal_coll, false); function vive_excl(){ postToColl("739"); vr_support(); vr_exclusive(); } function ocul_excl(){ postToColl("738"); vr_support(); vr_exclusive(); } function both_excl(){ postToColl("739"); postToColl("738"); vr_support(); vr_exclusive(); } function ocul_supp(){ postToColl("738"); vr_support(); } function vive_supp(){ postToColl("739"); vr_support(); } function both_supp(){ postToColl("739"); postToColl("738"); vr_support(); } function humble_coll(){postToColl("133");} function gog_coll(){postToColl("25");} function native_gamepad_coll(){postToColl("551");} function early_access_coll(){postToColl("152");} function single_mp_coll(){postToColl("476");} function cracked_online_coll(){postToColl("23");} function lan_supp_coll(){postToColl("77");} function procedural_coll(){postToColl("902");} function adult_coll(){postToColl("849");} function zombie_coll(){postToColl("586");} function female_prot_coll(){postToColl("856");} function unreal_coll(){postToColl("245");} function unity_coll(){postToColl("263");} function vr_support(){postToColl("559");} function vr_exclusive(){postToColl("683");} function postToColl(collId){ var http = new XMLHttpRequest(); var url = "collections.php"; var params = "action=add_torrent&auth="+ggnAuth+"&collageid="+collId+"&url="+window.location.href; http.open("POST", url, true); //Send the proper header information along with the request http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.onreadystatechange = function() {//Call a function when the state changes. if(http.readyState == 4 && http.status == 200) { addSuccess(); return true; } } http.send(params); return true; } var wholeThing = document.getElementById("content"); function addSuccess(){ wholeThing.innerHTML="GOOD____"+wholeThing.innerHTML; } document.getElementById('unfoldLink').addEventListener('click', unfoldAll, false); var folded = true; function unfoldAll() { var torrentGroups = document.getElementsByClassName('pad hidden'); for (var i = 0; i < torrentGroups.length; i++) { var re = /torrent_(.*)/; var id = torrentGroups[i].id.match(re) [1]; if (folded == true) { jQuery('#torrent_' + id).show(); jQuery('#files_' + id).show(); } else { jQuery('#torrent_' + id).hide(); jQuery('#files_' + id).hide(); } } folded=!folded; }