From d298002842dbc59883307551f3f30658d0d9f23a Mon Sep 17 00:00:00 2001 From: Jaseem Abid Date: Sat, 17 Dec 2011 16:07:15 +0530 Subject: [PATCH 1/3] Rewrote indexMessage module --- css/structure.less | 6 ++++-- index.php | 4 +--- js/functions.js | 21 +++++++++++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/css/structure.less b/css/structure.less index e8d6197..9cdb5fb 100644 --- a/css/structure.less +++ b/css/structure.less @@ -442,9 +442,11 @@ img.feedbackDock { } #indexMesssage { - span#cross { - margin-left:10px; + img#cross { cursor:pointer; + position: absolute; + right: 5px; top: 5px; + margin-left:10px; } background: none repeat scroll 0 0 @gray1; border: 1px solid #D4D4D4; diff --git a/index.php b/index.php index 3d2aaa7..8b7daf2 100755 --- a/index.php +++ b/index.php @@ -12,9 +12,6 @@
-
- We pay our tribute to our inspiration. RIP Steve Jobs (February 24, 1955 – October 5, 2011).X -
diff --git a/js/functions.js b/js/functions.js index 63d3f0e..60c3c12 100644 --- a/js/functions.js +++ b/js/functions.js @@ -235,6 +235,19 @@ $(this).attr('src','pics/profile.png'); }); }, + indexMesssage : function(text) { + if( $('#indexMesssage').length === 0 ) { + $("
").attr('id','indexMesssage') + .html(text) + .append($('').addClass('news').attr('id','cross').attr('src','data:image/gif;base64,R0lGODlhFAAUAMQAAPb29ubm5ejo6Onp6evr6/X19WZmZu3t7fT09G9vb/Dw8PLy8tvb28DAwMPDw7y8vL29va6urqqqqtnZ2eTk5NjY2NLS0gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAUABQAAAV8YCCOZGkCaKquqci+qwvP8vzWdhysFqVSFt3KkGCgGAmDUNUgMpCGxpJJTEp1hay2EDEYIlutCEEuT5LESbksWrjdlSQEQqy83SKFXp986B9Ee3oiB4WFEg6GBw4SigciBJGSk5SSIgOYmZqbmSICn6ChoqCeo6ahJqmqIQA7').attr('title','Close the message')).insertAfter("#top"); + } else { + $('#indexMesssage').find('span').html(text) + } + $('img.news').click(function(){ + $('div#indexMesssage').fadeOut("fast"); + }); + return this; + }, quirks : function(){ /* Stuff which i cant put anywhere else. Cant pollute the global object, hence this is here */ $('#loading') @@ -249,9 +262,6 @@ $('img#bugButton.VideoBarButton, img.feedbackDock').click(function(){ Paathshaala.showFeedback(); }); - $('span.news').click(function(){ - $('div#indexMesssage').fadeOut("fast"); - }); }, Search : function (q,tag) { /* @@ -683,9 +693,8 @@ $(document).ready(function(){ if($.browser.msie) { $("div#indexMesssage").remove(); - $("
").attr('id','indexMesssage') - .html("Have a life, use a modern browser. We dont support Internet Explorer.") - .appendTo("#container"); + P.indexMesssage("Have a life, use a modern browser. We dont support Internet Explorer."); + throw "Internet Explorer"; } else { P.searchBox(); P.dashBoard(); From 14e8f179f18a63663e82f24257c79b976792684c Mon Sep 17 00:00:00 2001 From: Jaseem Abid Date: Sat, 17 Dec 2011 16:14:31 +0530 Subject: [PATCH 2/3] jQuery style chaining enabled. --- js/functions.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/js/functions.js b/js/functions.js index 60c3c12..ad33152 100644 --- a/js/functions.js +++ b/js/functions.js @@ -54,6 +54,7 @@ $(this).attr('rows' , lineno + 2) commbox.height(ht + (14 * lineno) ); }); + return this; }, dashBoard : function() { var dashShown = 0,loginShown = 0,joinShown = 0; @@ -97,6 +98,7 @@ $("#logChangeButton").attr('src', 'pics/down.png'); } }); + return this; }, getUrlVars : function() { /* @@ -187,6 +189,7 @@ } Paathshaala.validate.video(); }); + return this; }, grayOut : function (option){ if(option) { @@ -207,6 +210,7 @@ } else { $('div#darkenScreenObject').remove(); } + return this; }, hashTag : function(elem) { var data = $(elem).html(), @@ -218,14 +222,17 @@ data = data.replace( res[i],'' + res[i] + '' ); } $(elem).html(data); + return this; }, hideEditProfile : function() { $('#editProfile').fadeOut("fast"); this.grayOut(false); + return this; }, hideFeedback : function () { this.grayOut(false); $('div#feedback').hide(); + return this; }, imageError : function() { $('img#loggedImage').error(function(){ @@ -234,6 +241,7 @@ $('div#snapShot img').error(function(){ $(this).attr('src','pics/profile.png'); }); + return this; }, indexMesssage : function(text) { if( $('#indexMesssage').length === 0 ) { @@ -262,6 +270,7 @@ $('img#bugButton.VideoBarButton, img.feedbackDock').click(function(){ Paathshaala.showFeedback(); }); + return this; }, Search : function (q,tag) { /* @@ -297,6 +306,7 @@ }).complete(function(){ $("time.timeago").timeago(); }); + return this; }, searchBox : function() { $(".searchBox").focus(function () { @@ -304,10 +314,12 @@ }).focusout(function () { $(this).animate({width: '270px'} , 150 , '' , function () {}); }); + return this; }, showEditProfile: function () { this.grayOut(true); $('div#editProfile').load('editprofile.html').fadeIn("slow"); + return this; }, showFeedback : function() { this.grayOut(true); @@ -354,6 +366,7 @@ P.hideFeedback(); }); }); + return this; }, updateStoryBox : function (type) { /* @@ -440,8 +453,7 @@ }).complete(function(){ complete(); }); break; } - - + return this; } }; @@ -594,6 +606,7 @@ } }); }); + return this; }; Paathshaala.validate.video = function() { @@ -681,6 +694,7 @@ } }, "json"); }); + return this; }; // Expose Paathshaala to the global object From 1824ceb42f84487a3db7e574caacc5fcdfea9800 Mon Sep 17 00:00:00 2001 From: Jaseem Abid Date: Sat, 17 Dec 2011 16:17:26 +0530 Subject: [PATCH 3/3] Utilizing the chaining feature --- index.php | 2 +- js/functions.js | 12 ++++++------ profile.php | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index 8b7daf2..0788821 100755 --- a/index.php +++ b/index.php @@ -22,7 +22,7 @@ diff --git a/js/functions.js b/js/functions.js index ad33152..aadd210 100644 --- a/js/functions.js +++ b/js/functions.js @@ -710,11 +710,11 @@ $(document).ready(function(){ P.indexMesssage("Have a life, use a modern browser. We dont support Internet Explorer."); throw "Internet Explorer"; } else { - P.searchBox(); - P.dashBoard(); - P.imageError(); - P.comments(); - P.quirks(); - P.validate.join(); + P.searchBox() + .dashBoard() + .imageError() + .comments() + .quirks() + .validate.join(); } }); diff --git a/profile.php b/profile.php index ef27ac8..a476c66 100644 --- a/profile.php +++ b/profile.php @@ -46,9 +46,9 @@ ?>