Created
March 1, 2018 08:43
-
-
Save nmn/bcab43b0a91cd6bb9497a2c78761c647 to your computer and use it in GitHub Desktop.
TamperMonkey Scripts for IC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Call Form Editable Still | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Make all View Buttons Edit Buttons | |
// @author You | |
// @match https://ic.bdsmarketing.com/IC.DataCollection/HoursCollection.aspx* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
Array.from(document.querySelectorAll('a[href^="CallFormView.aspx"]')) | |
.forEach(link => { | |
link.href = link.href.replace('CallFormView', 'StoreRelationshipManagement'); | |
if (link.text.trim() === 'View') { | |
link.innerText = 'Edit'; | |
} | |
}); | |
const queryParams = window.location.search.slice(1).split('&') | |
.map(tuple => tuple.split('=')) | |
.map(tuple => { | |
if (tuple.length === 1) { | |
return {[tuple[0]]: true}; | |
} else { | |
return {[tuple[0]]: tuple[1]}; | |
} | |
}) | |
.reduce((combined, objs) => Object.assign(combined, objs), {}); | |
function formatDate(value){ | |
const d = new Date(value); | |
return `${d.getMonth() + 1}/${d.getDate()}/${d.getFullYear()}`; | |
} | |
const date = new Date(queryParams.Date).valueOf(); | |
const nextDay = formatDate(date + 24*60*60*1000); | |
const prevDay = formatDate(date - 24*60*60*1000); | |
const html = ` | |
<div style="position:fixed;bottom:0;left:0;right:0;"><a href="${window.location.toString().replace(queryParams.Date, prevDay)}" style="display:inline-block;width:50%;background:red;text-align:center;height:30px;color:white;padding-top:6px;"> | |
Previous Day | |
</a><a href="${window.location.toString().replace(queryParams.Date, nextDay)}" style="display:inline-block;width:50%;background:green;color:white;text-align:center;height:30px;padding-top:6px;"> | |
Next Day | |
</a></div> | |
`; | |
const div = document.createElement('div'); | |
div.innerHTML = html; | |
document.body.append(div); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Enable and Enhance Call Form Entry | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://ic.bdsmarketing.com/IC.DataCollection/CallFormEntryBSRM.aspx* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Enable the Next Button | |
ctl00_MainContent_btnSave.disabled = false; | |
Array.from(document.querySelectorAll('tr[style="background-color:#C1D82F"]')) | |
.filter(tr => tr.textContent.startsWith('SrMA')) | |
.forEach(tr => { | |
tr.style.display = 'none'; | |
tr.nextElementSibling.style.display = 'none'; | |
tr.nextElementSibling.nextElementSibling.style.display = 'none'; | |
tr.nextElementSibling.nextElementSibling.nextElementSibling.style.display = 'none'; | |
}); | |
Array.from(document.querySelectorAll('tr[style="background-color:#C1D82F"]')) | |
.filter(tr => tr.textContent.startsWith('MA')) | |
.map(tr => tr.nextElementSibling.nextElementSibling.querySelector('div')) | |
.forEach(div => { | |
const nodes = div.childNodes; | |
for (let i = 0; i < nodes.length; i++){ | |
if ( nodes[i].tagName !== 'INPUT' && | |
nodes[i].tagName !== 'BR' && | |
nodes[i].tagName !== 'B' && | |
nodes[i].tagName !== 'SELECT') { | |
nodes[i].remove(); | |
} | |
} | |
}); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Enable CallFormEntryCCallForm | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description enable buttons | |
// @author You | |
// @match https://ic.bdsmarketing.com/IC.DataCollection/CallFormEntryCCallForm.aspx* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
if (typeof ctl00_MainContent_btnSave !== 'undefined') { | |
ctl00_MainContent_btnSave.disabled = false; | |
} | |
if (typeof ctl00_MainContent_btnNext !== 'undefined') { | |
ctl00_MainContent_btnNext.disabled = false; | |
} | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Enable CallFormEntryTask | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://ic.bdsmarketing.com/IC.DataCollection/CallFormEntryTask.aspx* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
if (typeof ctl00_MainContent_btnSave !== 'undefined') { | |
ctl00_MainContent_btnSave.disabled = false; | |
} | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Enable Image Reporting | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Enable the button. | |
// @author nmn | |
// @match https://ic.bdsmarketing.com/IC.Reporting/ImageReport.aspx | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let datePickers = document.getElementsByClassName('hasDatepicker'); | |
datePickers = Array.from(datePickers); | |
datePickers.forEach(picker => {picker.setAttribute('onchange', '');}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment