I work in the IT field, and unfortunately we're stuck using a web help
desk written a long time ago. It's very poorly written HTML, and the
help desk lacks a lot of functionality. It'll probably be at least a
year before we can get another web help desk, so I've been working on
a Greasemonkey script to improve the web help desk for the time being.
However, I'm getting an error using GM_getValue. I've already read
http://wiki.greasespot.net/0.7.20080121.0_compatibility but it didn't
seem to help. I would love some troubleshooting. Thanks! Here is my
code:
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://www.lamintak.com/misc/jquery.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);
// Check if jQuery's loaded
function GM_wait() {
if(typeof unsafeWindow.jQuery == 'undefined')
{ window.setTimeout(GM_wait,100); }
else { $ = unsafeWindow.jQuery; letsJQuery(); }
}
GM_wait();
// All your GM code must be inside this function
function letsJQuery() {
// Loop through each row in the main table and add the "Will Be
Addressed..." headers and cells
$("table.TableBody tr").each(function() {
var rowhtml = $(this).html();
if (rowhtml.indexOf("Support Personnel</a></td>") != -1) {
var AddressHeader = $("<td>*Will Be
Addressed...</td>").attr('id',
'WillBeAddressedHeader');
$(this).append(AddressHeader);
}
else {
var AddressCell = $("<td></td>").attr('class',
'WillBeAddressedCell');
$(this).append(AddressCell);
}
});
// Loop through each "Will Be Addressed..." cell and add the text
fields
$("table.TableBody td.WillBeAddressedCell").each(function() {
var InputField = $("<input type=\"text\">").attr('class',
'WillBeAddressedInput');
$(this).append(InputField);
});
// Get the saved value and put it in an array
WillBeAddressedString = GM_getValue('WillBeAddressed');
WillBeAddressedArr = new Array();
if (WillBeAddressedString) {
WillBeAddressedArr = WillBeAddressedString.split('|');
}
// Loop through the text fields that were just created
var count = 0;
$("input.WillBeAddressedInput").each(function(){
// Add the IDs
$(this).attr('id', 'WillBeAddressedInput' +
WorkOrdersArr[count]);
// Add any saved values that might exist
for (i in WillBeAddressedArr) {
if
(WillBeAddressedArr[i].indexOf('WillBeAddressedInput' +
WorkOrdersArr[count]) != -1) {
var InputValue =
WillBeAddressedArr[i].split('~!');
$(this).attr('value', InputValue[1]);
}
};
count++;
// Make it so that whenever the text field goes out of focus,
the
// "WillBeAddressed" Greasemonkey variable will be updated
$(this).blur(function() {
// Get the latest version of the "WillBeAddressed"
variable, just
in
// case it was changed in a different tab
WillBeAddressedString = GM_getValue('WillBeAddressed');
// Error: Greasemonkey access violation: unsafeWindow
cannot call
GM_getValue.
});
});
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en
-~----------~----~----~----~------~----~------~--~---