/usr/share/ktelepathy/showBugzillaInfo.js is in kde-telepathy-text-ui 4:17.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | //escape HTML special symbols
//this function escapes symbols &<>"' with entities
//the chars-to-codes map is created only once, not on every call
var escapeHTML = (function() {
'use strict';
var codes = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
return function(string) {
return string.replace(/[&<>"']/g, function(char) {
return codes[char];
});
};
}());
//add bugzilla information to the UI
//the message processor adds a div with a specific ID to the message
//this ID is passed to the bugzilla RPC instance as an ID, which is returned in the query
//when this callback function is run, we extract that ID and update the contents accordingly
function showBugCallback(response)
{
var id = response["id"];
if (!response["result"])
return;
var bug = response["result"]["bugs"][0];
var bugId = bug["id"];
var summary = bug["summary"]
var status = bug["status"]
var resolution = bug["resolution"]
var text = "[BUG " + bugId + "] " + summary + " " + status;
if (status == "RESOLVED") {
text += " (" + resolution +")";
}
document.getElementById(id).innerHTML = escapeHTML(text);
}
//use jsonp to avoid problems with web security origin
//see http://en.wikipedia.org/wiki/JSONP
//this function creates a new <script src = "http://bugs.kde.org/jsonrpc.cgi?=
function showBug(jsonCallUrl)
{
var script = document.createElement('script');
script.src = jsonCallUrl
document.getElementsByTagName('head')[0].appendChild(script);
}
|