arrow function + templatetag for title added

This commit is contained in:
Sanj 2011-08-10 00:50:04 +05:30
parent 6f08f6dcfe
commit a383f3ed04
3 changed files with 35 additions and 1 deletions

View File

View File

@ -0,0 +1,29 @@
from django import template
register = template.Library()
'''
Used to format titles in the front slider boxes
>>>format_title("Script Bank")
>>>SCRIPT <b>BANK</b>
>>>format_title("Script-Bank")
>>>SCRIPT-<b>BANK</b>
'''
def format_title(value):
v = value.strip()
if v.find('-') != -1:
splitter = "-"
else:
splitter = " "
words = v.split(splitter)
l = len(words)
if l > 1:
boldWord = "<b>" + words[l - 1] + "</b>"
return (splitter.join(words[:l-1]) + splitter + boldWord).upper()
else:
return words[0].upper()
register.filter("format_title")

View File

@ -22,6 +22,7 @@ $(function() {
$('#arrowLeft').mouseout(function() { $('#arrowLeft').mouseout(function() {
clearInterval(slideInterval); clearInterval(slideInterval);
slider.stop();
}); });
$('#arrowRight').mouseover(function() { $('#arrowRight').mouseover(function() {
@ -33,6 +34,7 @@ $(function() {
$('#arrowRight').mouseout(function() { $('#arrowRight').mouseout(function() {
clearInterval(slideInterval); clearInterval(slideInterval);
slider.stop();
}); });
@ -67,7 +69,10 @@ var ItfSlider = function(o) {
var arrLeft = (0 - this.getLeft()) + (this.contentWidth - 10); var arrLeft = (0 - this.getLeft()) + (this.contentWidth - 10);
console.log(arrLeft); console.log(arrLeft);
this.rightArr.animate({'left': arrLeft + "px"}); this.rightArr.animate({'left': arrLeft + "px"});
} };
this.stop = function() {
this.ul.stop();
};
}; };
ItfSlider.prototype.moveLeft = function(distance, speed) { ItfSlider.prototype.moveLeft = function(distance, speed) {