Skip to content

Instantly share code, notes, and snippets.

@acoppes
Created September 23, 2013 20:50
Show Gist options
  • Save acoppes/6676767 to your computer and use it in GitHub Desktop.
Save acoppes/6676767 to your computer and use it in GitHub Desktop.
A script to disable Google Play devices from developer console given a list of devices.
// ==UserScript==
// @name My Fancy New Userscript
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match https://play.google.com/apps/publish/*
// @require http://code.jquery.com/jquery-latest.js
// @copyright 2012+, You
// ==/UserScript==
function disableDevices() {
// just as example, copy here the devices exported with the other script...
var devices = ["– Z2","– P774A","– M712MC","Pad","XOLO","H928","nuclear-a7028","Fly","nuclear-evb-rtl8723au"];
var count = 0;
var notfound = [];
console.log('start disabling devices: ' + devices.length);
for (var i = 0; i < devices.length; i++) {
var device = devices[i];
var filter = 'span[data-device-name]';
var elements = $(filter).filter(function() { return $(this).text() === device }).parent().children(':first-child');
if (elements.length == 0) {
console.log('failed to filter device ' + device + ', selector (' + filter + ') not found');
notfound.push(device);
continue;
}
elements = elements.filter('[aria-checked="false"]');
if (elements.length == 0) {
// console.log('device ' + device + ' already disabled');
continue;
}
elements.each(function (index) {
$(this).click();
console.log('device ' + device + ' disabled with key: ' + $(this).next().text());
});
count++;
}
console.log('devices disabled: ' + count);
console.log('devices not disabled: ' + notfound);
}
GM_registerMenuCommand('disableDevices', disableDevices);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment