parloti / ManageMyApps

// ==UserScript==
// @name ManageMyApps
// @updateURL https://openuserjs.org/meta/parloti/ManageMyApps.meta.js
// @description Gerenciar Apps do Google Play 
// @copyright 2016, Parloti
// @version 1.4
// @author parloti
// @license MIT
// @include https://play.google.com/apps*
// @include https://play.google.com/store/apps/details*
// @icon https://www.gstatic.com/android/market_images/web/favicon_v2.ico
// @require http://code.jquery.com/jquery-latest.js
// @run-at document-end
// @grant GM_setValue
// @grant GM_getValue
// @grant unsafeWindow
// ==/UserScript==

var DEVs,APPs;
console.log($(".submenu-item-wrapper:eq(1)"));
$(".submenu-item-wrapper:eq(1)").prepend('<li jsinstance="0" jstcache="25"> <ul style="display:none" jstcache="26"></ul> <div class="leaf-submenu-link-wrapper" jstcache="27"> <a class="leaf-submenu-link" title="Update" jsan="7.leaf-submenu-link,8.href,0.title" jstcache="37">Update</a> <button style="display:none" jstcache="38"></button> </div> </li>');
$(".submenu-item-wrapper:eq(1) a:eq(0)").click(update);

update();
function update(){
    APPs=JSON.parse(GM_getValue(APPs,"[]"));
    DEVs=JSON.parse(GM_getValue(DEVs,"[]"));
    
    function Dev(fields){
        this.id=fields.id;
        this.name=fields.name;
    }
    
    function App(fields){
        this.id=fields.id;
        this.title=fields.title;
        this.dev={
            name:fields.dev.name,
            id:fields.dev.id
        }
        this.updated=fields.updated;
        this.versionDate=fields.versionDate;
        this.reviewed=fields.reviewed;
    }
    
    $(".card-content.id-track-click.id-track-impression").each(
    	function(){
    		var id=$(this).attr("data-docid");
        	var title=$(this).find("a.title").attr("title");
    		var description=$(this).find(".description").text().trim();
    		
    		var dev={
    			name:$(this).find("a.subtitle").attr("title"),
    			id:decodeURIComponent($(this).find("a.subtitle").attr("href").split("id=")[1]).replace(/\+/g," ")
    		}
    		var fields={
    		    id:id,
    		    title:title,
    		    description:description,
    		    dev:dev
    		}
    		var app=new App(fields);
    		var alreadyHas=$.grep(APPs, function(e){ return e.id == fields.id; });
    		if(!alreadyHas.length&&!/details\?id=/.test(location.href)){
    		    APPs.push(app);
    		}
    		elseif(/details\?id=/.test(location.href)){
    		    var a=document.body.innerHTML.match(/datePublished[\"\']>([^<]*)/);
    		    if (a.length===2){
                    var updated=new Date(a[1]).getTime();
                    $.each(APPs, function(e){ if(e.id == fields.id; });
                }
    		}
    		else{
    		    for(var prop in app) {
                    console.log("obj." + prop + " = " + app[prop]);
                }
    		}
    		    
    		}
    );
    GM_setValue(APPs, JSON.stringify(APPs));
    console.log(APPs);
}
/*var url = 'https://play.google.com/store/apps/details?id=com.adobe.reader';
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.send();
var a=response.match(/datePublished[\"\']>([^<]*)/);
if (a.length===2){
    var updated=new Date(a[1]).getTime();
}
APPs=localStorage.APPs||{};*/