Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ozero
Last active July 16, 2017 12:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozero/1816971251d9489f55082de541944f1e to your computer and use it in GitHub Desktop.
Save ozero/1816971251d9489f55082de541944f1e to your computer and use it in GitHub Desktop.
IITC plugin: flag comm as spam
// ==UserScript==
// @id iitc-plugin-flag-comm-as-spam
// @name IITC plugin: flag comm as spam
// @category Misc
// @version 0.1.0.20160831.120000
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL none
// @downloadURL none
// @description Flag spamming comm in 3 click.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/mission/*
// @include http://www.ingress.com/mission/*
// @match https://www.ingress.com/mission/*
// @match http://www.ingress.com/mission/*
// @grant none
// ==/UserScript==
/*
Step1:
Alt+Click the agentname who spams in comm.
(-> Dialog with the 'text-data' to fill the form will open.)
Step2:
Copy 'text-data' in the dialog. and allow to open popup.
(-> The Ingress help site (form to flag the spammer) will open.)
Step3:
When the Ingress help site was completely loaded,
the form "** paste spam here **" will appears.
paste the 'text-data' and click "Fill it." button
Step4:
Check the form, scroll down and submit your form.
* */
function wrapper(plugin_info) {
// ensure plugin framework is there, even if iitc is not yet loaded
if (typeof window.plugin !== 'function') window.plugin = function () { };
// PLUGIN START ////////////////////////////////////////////////////////
// use own namespace for plugin
window.plugin.flagCommDialog = {
urlZendesk: "https://support.ingress.com/hc/ja/requests/new?ticket_form_id=164588",
//when click agent name in comm with ALT key, open flag dialog.
flagIt: function(event){
console.log("flagCommDialog.flagIt",event);
if (event.event.altKey){
var data = window.plugin.flagCommDialog.getSetting(event);
if(!data){
return;
}
window.plugin.flagCommDialog.openDialog(data);
}
},
//Get comm
getSetting: function(event){
console.log(event);
//get comm to flag
var flagCommStr = event.event.target.parentNode.parentNode.innerHTML;
if($(flagCommStr)===null){
return false;
}
var flagCommJqDom = $(flagCommStr);
if(flagCommJqDom[0] === undefined){
return false;
}
var fcTime = flagCommJqDom[0].innerText;
if(flagCommJqDom[1] === undefined){
return false;
}
var fcName = flagCommJqDom[1].innerText.replace(/\W/g,"");
if(flagCommJqDom[2] === undefined){
return false;
}
var fcText = flagCommJqDom[2].innerText;
//get Latlong in URL
var c = window.map.getCenter();
var lat = Math.round(c.lat*1E6)/1E6;
var lng = Math.round(c.lng*1E6)/1E6;
var qry = 'll='+lat+','+lng+'&z=' + map.getZoom();
var permalink = 'https://www.ingress.com/intel?' + qry;
//
var ret = {
time: fcTime,
name: fcName,
text: fcText,
p: permalink,
myname: window.PLAYER.nickname
};
return ret;
},
//setting dialog
openDialog: function(data){
var html = '<div><textarea id="tx_flagcomm" tabindex="0" style="width:380px;height:10em;'
+ 'color:black;background-color:white;margin-bottom:2px;font-family:monospace;" '
+ 'oncopy="window.plugin.flagCommDialog.openZendesk()">'
+ JSON.stringify(data)
+ '</textarea></div>'
+ '<div>Copy to clipboard to open Zendesk form</div>';
dialog({
html: html,
id: 'plugin-flag-comm-dialog',
dialogClass: 'ui-flag-comm-dialog',
title: 'Flag comm dialog.',
width:400,
closeText: "X"
});
document.getElementById("tx_flagcomm").focus();
document.getElementById("tx_flagcomm").select();
},
//openZendesk
openZendesk: function(){
$('#chatinput input').val('');//avoid miss-fire in stock chatinput
window.open(window.plugin.flagCommDialog.urlZendesk);
}
};
// boot ////////////////////////////
var setup = function () {
addHook('nicknameClicked', window.plugin.flagCommDialog.flagIt);
};
// PLUGIN END //////////////////////////////////////////////////////////
setup.info = plugin_info; //add the script info data to the function as a property
if (!window.bootPlugins) window.bootPlugins = [];
window.bootPlugins.push(setup);
// if IITC has already booted, immediately run the 'setup' function
if (window.iitcLoaded && typeof setup === 'function') setup();
} // wrapper end
// inject code into site context
var script = document.createElement('script');
var info = {};
if (typeof GM_info !== 'undefined' && GM_info && GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description };
script.appendChild(document.createTextNode('(' + wrapper + ')(' + JSON.stringify(info) + ');'));
(document.body || document.head || document.documentElement).appendChild(script);
// ==UserScript==
// @id iitc-plugin-flag-comm-as-spam-ZD
// @name IITC plugin: flag comm as spam (Zendesk side)
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @version 0.1
// @description Flag spamming comm in 1 click.
// @match https://support.ingress.com/hc/*/requests/new?ticket_form_id=164588
// @grant none
// ==/UserScript==
(function() {
'use strict';
$("div.form").prepend(
"<div id='_flagpasteform'><div>** paste spam here **</div><div><textarea style='width:400px;height:10em;'"
+" id='tx_flagCommAsSpam'></textarea></div>"
+"<div><button onclick='window.flagCommAsSpam.fillUp()'>Fill it.</button></div></div>"
);
window.flagCommAsSpam = {
//
fillUp: function(){
var data = JSON.parse($("#tx_flagCommAsSpam").val());
console.log(data);
//
if($("#request_subject")){
$("#request_subject").val(data.name);
}else{
alert("ERROR: Hey, create YOUR Zendesk account of INGRESS HELP first.");
return;
}
//
var body0 = [
data.time+" "+data.name+" "+data.text,"",
"URL:",data.p,""
];
var body1 = body0.join("\n");
$("#request_description").val(body1);
//
$("#request_custom_fields_26995447").val("harassment_spam");
//
$("#request_custom_fields_26753947").val(data.myname);
//
$("#_flagpasteform").html("");
}
};
})();
@ozero
Copy link
Author

ozero commented Sep 2, 2016

IITC plugin: flag comm as spam

Works in DESKTOP. not for Mobile.

Wrote a IITC plugin to flag the spammer in IntelMap. Install both of iitc_flag_comm.user.js and iitc_flag_comm_zendesk.user.js.

Usage

Step1:

  • Alt+Click the agentname who spams in comm.
  • (-> Dialog with the 'text-data' to fill the form will open.)

Step2:

  • Copy 'text-data' in the dialog. (and allow to open popup.)
  • (-> The Ingress help site (form to flag the spammer) will open.)

Step3:

  • When the Ingress help site was completely loaded, the form "** paste spam here **" will appears.
  • Paste the 'text-data' and click "Fill it." button

Step4:

  • Check the form, scroll down and submit your form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment