f36703fa69e4a6b32c895215e3bf5bd97620d1d5
1 function randomString(string_length
) {
2 var chars
= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
4 for (var i
=0; i
<string_length
; i
++) {
5 var rnum
= Math
.floor(Math
.random() * chars
.length
);
6 randomstring
+= chars
.substring(rnum
,rnum
+1);
11 String
.prototype.trim = function() {
12 return this.replace(/^\s+|\s+$/g, "");
15 String
.prototype.lpad = function(length
, character
){
17 for(var i
=0; i
<length
; i
++) padding
+= character
;
18 return (padding
+ this).slice (-length
)
25 Each function in each object is looped through and ran. The resulting text
26 is expected to be returned.
32 onprivmsg: function(inp
, tabview
){
33 return $('<div/>').text(inp
).html();
39 onprivmsg: function(inp
, tabview
){
40 if(front
.cur_channel
.name
.toLowerCase() != front
.tabviews
[tabview
.toLowerCase()].name
){
41 front
.tabviews
[tabview
].activity();
48 onprivmsg: function(inp
, tabview
){
49 if(inp
.toLowerCase().indexOf(gateway
.nick
.toLowerCase()) > -1){
50 if(front
.cur_channel
.name
.toLowerCase() != front
.tabviews
[tabview
.toLowerCase()].name
){
51 front
.tabviews
[tabview
].highlight();
53 if(front
.isChannel(front
.tabviews
[tabview
].name
))
54 inp
= '<span style="color:red;">'+inp
+'</span>';
58 !front
.isChannel(front
.tabviews
[tabview
].name
) && front
.tabviews
[tabview
].name
!= "server"
59 && front
.cur_channel
.name
.toLowerCase() != front
.tabviews
[tabview
.toLowerCase()].name
61 front
.tabviews
[tabview
].highlight();
70 onprivmsg: function(text){
71 if( !text ) return text;
72 //alert("-"+text+"-");
73 text = text.replace(/^((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?(\.jpg|\.jpeg|\.gif|\.bmp|\.png)$/gi,function(url){
74 var img = '<img src="'+url+'" height="50" width="50" />';
75 return '<a target="_blank" rel="nofollow" href="'+ url +'">'+ img +'</a>';
86 //Following method taken from: http://snipplr.com/view/13533/convert-text-urls-into-links/
87 name
: "linkify_plain",
88 onprivmsg: function(text
){
89 if( !text
) return text
;
91 text
= text
.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi,function(url
){
93 if(url
.match('^https?:\/\/')){
94 //nice = nice.replace(/^https?:\/\//i,'')
99 return '<a target="_blank" rel="nofollow" href="'+ url
+'">'+ nice
+'</a>';