NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Qualitor Plus // @namespace http://william.moraes.nom.br/ // @version 0.1 // @description adiciona funções úteis ao Qualitor para a OEC // @author William Moraes (https://william.moraes.nom.br) // @match *://*/html/sys/sysportal/portal.php // @match *://*/html/hd/hdchamado/*_chamado.php* // @grant none // @require https://openuserjs.org/src/libs/wwmoraes/Native.js // @copyright 2018, William Moraes (https://william.moraes.nom.br/) // @license GPL-3.0; http://www.gnu.org/copyleft/gpl.html // @homepageURL https://github.com/wwmoraes/userscripts // @supportURL https://github.com/wwmoraes/userscripts/issues // @updateURL https://openuserjs.org/meta/wwmoraes/Qualitor_Plus.meta.js // @downloadURL https://openuserjs.org/src/scripts/wwmoraes/Qualitor_Plus.js // ==/UserScript== (function() { 'use strict'; // Overrides //document.addEventListener("pageshow", function(){ Function.override('window.open', function(){base.apply(this, Array.prototype.slice.call(arguments, 0, 2));}); //}); //document.addEventListener("pagehide", function(){ // Function.restore('window.open'); //}); // Shims if(Node.prototype.insertAfter !== "function"){ Node.prototype.insertAfter = function(newNode, referenceNode){ referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); }; } if(Element.prototype.setAttributes !== "function"){ Element.prototype.setAttributes = function(elementAttributesObject){ for(var k in elementAttributesObject){ if(elementAttributesObject.hasOwnProperty(k)) this.setAttribute(k, elementAttributesObject[k]); } }; } // Helpers var QualitorPlusGen = { button: function(elementBefore, attributesObject, imageUri){ var newButton = document.createElement("button"); newButton.setAttributes(attributesObject); var buttonImg = document.createElement("img"); buttonImg.setAttributes({ "title": attributesObject.title || "", "alt": attributesObject.alt || "", "src": imageUri, "style": "margin: 0px; vertical-align: middle;" }); newButton.appendChild(buttonImg); elementBefore.parentElement.insertAfter(newButton, elementBefore); } }; // Core object window.QualitorPlus = { applySolutionTemplate: function(){ var newText = "Prezado " + $F("nmcontato").trim().split(" ")[0] + ",\n\n" + $F("dsacompanhamento") + "\n\nLembre-se, responda a pesquisa de satisfação. Dessa forma, você registrará a sua opinião e contribuirá para a melhoria contínua de nossos serviços.\n\n" + "Att.,\n" + $F("nmresponsavel").trim(); dsacompanhamento.value = newText; }, setEquipeAtendimentoSisEngApoio: function(){ objcdequipe.selectItem("347,N3 - SC - SisEng - Apoio a Engenharia,Y,,"); }, setEquipeAtendimentoCitadonApoio: function(){ objcdequipe.selectItem("7,N3 - SC - Citadon - Apoio à Engenharia,Y,,"); }, setEquipeSolucaoSisEngApoio: function(){ objcdequipesolucao.selectItem("347,N3 - SC - SisEng - Apoio a Engenharia,Y,,"); }, setEquipeSolucaoCitadonApoio: function(){ objcdequipesolucao.selectItem("7,N3 - SC - Citadon - Apoio à Engenharia,Y,,"); } }; // Interface setup switch(location.pathname){ case "/html/sys/sysportal/portal.php": break; case "/html/hd/hdchamado/cadastro_chamado.php": // Change team buttons QualitorPlusGen.button(btncdequipe, { "name": "btnSetSisEngApoiocdequipe", "id": "btnSetSisEngApoiocdequipe", "type": "button", "class": "BUTTON", "style": "height: 20px; width: 22px; vertical-align:top;", "onclick": "this.className='BUTTON'; QualitorPlus.setEquipeAtendimentoSisEngApoio();", "title": "SisEng - Apoio à Engenharia", "alt": "SisEng - Apoio à Engenharia", "onmouseover": "this.className='BUTTONOVER';", "onmouseout": "this.className='BUTTON';" }, "/framework/images/default/16/money.gif"); QualitorPlusGen.button(btnSetSisEngApoiocdequipe, { "name": "btnSetCitadonApoiocdequipe", "id": "btnSetCitadonApoiocdequipe", "type": "button", "class": "BUTTON", "style": "height: 20px; width: 22px; vertical-align:top;", "onclick": "this.className='BUTTON'; QualitorPlus.setEquipeAtendimentoCitadonApoio();", "title": "Citadon - Apoio à Engenharia", "alt": "Citadon - Apoio à Engenharia", "onmouseover": "this.className='BUTTONOVER';", "onmouseout": "this.className='BUTTON';" }, "/framework/images/default/16/folderClosed.gif"); QualitorPlusGen.button(btncdequipesolucao, { "name": "btnSetSisEngApoiocdequipesolucao", "id": "btnSetSisEngApoiocdequipesolucao", "type": "button", "class": "BUTTON", "style": "height: 20px; width: 22px; vertical-align:top;", "onclick": "this.className='BUTTON'; QualitorPlus.setEquipeSolucaoSisEngApoio();", "title": "SisEng - Apoio à Engenharia", "alt": "SisEng - Apoio à Engenharia", "onmouseover": "this.className='BUTTONOVER';", "onmouseout": "this.className='BUTTON';" }, "/framework/images/default/16/money.gif"); QualitorPlusGen.button(btnSetSisEngApoiocdequipesolucao, { "name": "btnSetCitadonApoiocdequipesolucao", "id": "btnSetCitadonApoiocdequipesolucao", "type": "button", "class": "BUTTON", "style": "height: 20px; width: 22px; vertical-align:top;", "onclick": "this.className='BUTTON'; QualitorPlus.setEquipeSolucaoCitadonApoio();", "title": "Citadon - Apoio à Engenharia", "alt": "Citadon - Apoio à Engenharia", "onmouseover": "this.className='BUTTONOVER';", "onmouseout": "this.className='BUTTON';" }, "/framework/images/default/16/folderClosed.gif"); // Apply Solution Template button QualitorPlusGen.button(btnLargeViewdsacompanhamento, { "name": "btnApplySolutionTemplatedsacompanhamento", "id": "btnApplySolutionTemplatedsacompanhamento", "type": "button", "class": "BUTTON", "style": "height: 20px; width: 22px; vertical-align:top;", "onclick": "this.className='BUTTON'; QualitorPlus.applySolutionTemplate();", "title": "Aplicar modelo de solução", "alt": "Aplicar modelo de solução", "onmouseover": "this.className='BUTTONOVER';", "onmouseout": "this.className='BUTTON';" }, "/framework/images/default/16/idea.gif"); break; } })();