Home 
 
 
 
 
 Blog 
 
 
 
Sytling Image

Posts Tagged ‘javascript’

ASP.NET Masterpage, JavaScript, and ResolveUrl

October 6th, 2010 - Be the First Comment!

Today was an interesting day for many reasons. The one I’m going to share with you has to do with javascript and the ResolveUrl method in ASP.NET Masterpage. I recently added jQuery to our web project at work. We have a strange setup and using /Script/jQuery.js in the script tags src attribute won’t work. For that reason I decided to use ResolveUrl() which gets the URL of a file you pass it (i.e. ResolveUrl(“~/Script/jQuery.js”) ). This worked great until I was going through the application working on something else and randomly received this error message:

System.Web.HttpException:The Controls collection cannot be modifiedbecause the control contains code blocks (i.e. <% … %>).

It only happened on a couple of pages and the others would load fine which added to the confusion. Honestly, this error made little to no sense when I first saw it, so I did what any resourceful individual would. I googled it. Luckily the first result was the answer to my issue! The fix is to use data binding (<%#)  instead of writing it out (<%=). It is strange, but it resolves the problem. This is the wonderful explanation and solution: http://leedumond.com/blog/the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/.

Tiny MCE Comments – Problems on iPhone

March 30th, 2010 - 4 Comments

Today at work we realized that Tiny MCE doesn’t work properly on the iPhone. At least MCEComments for WordPress doesn’t This prevented users from commenting from a mobile device on the MSU blogs. I fixed this pretty simply by doing browser detection in PHP before loading the files for MCEComments. I modified the loaders for the plugin. Only two modifications of the tinyMCEComments.php was neccesary.

// Line 311
function mcecomment_init() {
    global $post;
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "iphone") === false) {
        $loadJS = false;
        if (is_plugin_page()) {
        $loadJS = true;
        } else if (is_singular()) {
            if (comments_open() && ( !get_option('comment_registration') || is_user_logged_in() )) {
                $loadJS = true;
            }
        }
        if ($loadJS)
        	mcecomment_getInitJS();
    }
}
// Line 350
function mcecomment_loadCoreJS() {
    global $post, $mce_locale;
    if (is_singular() && (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "iphone") === false))
    {
        if (comments_open() && ( !get_option('comment_registration') || is_user_logged_in() )) {
            wp_enqueue_script('tiny_mce', get_option('siteurl') .
            	'/wp-includes/js/tinymce/tiny_mce.js', false, '20081129');
            wp_enqueue_script('tiny_mce_lang', get_option('siteurl') .
                '/wp-includes/js/tinymce/langs/wp-langs-' . $mce_locale . '.js',
                false, '20081129');
            wp_deregister_script('comment-reply');
            wp_enqueue_script( 'comment-reply', get_option('siteurl') .
                '/wp-content/plugins/' . plugin_basename ( dirname ( __FILE__ ) ) .
                "/comment-reply.dev.js", false, '20090102');
        }
    }
}

WordPress – MCEComments and Threaded Comments Fix

February 23rd, 2010 - 1 Comment


Edit: After further investigation it looks like the only real problem was problem number 2 (hidden field and iframe named the same). All you have to do is implement the fix for problem 2 discussed below and it should work fine.
Problem number 2 was more of a conflict and wasn’t really anyones fault, but was rather troublesome to fix. We thought it would be easier to change the TinyMCEComments plugin then modify the install of WordPress. We also had already modified the plugin to remove/insert TinyMCE boxes correctly so we might as well keep working with that. To fix the problem before TinyMCE is initialized we change the hidden field with id=”comment_parent” so it is id=”comment_parent_hf”. This doesn’t effect WordPress comment submission because form submissions use the name field server side to identify an attribute.

Change in tinyMCEComments.php

Before (start line 295):

if (subBtn != null) {
	subBtn.onclick=function() {
		var inst = tinyMCE.getInstanceById("comment");
		document.getElementById("comment").value = inst.getContent();
		document.getElementById("commentform").submit();
		return false;
	}
}
tinyMCEPreInit.go();
tinyMCE.init(tinyMCEPreInit.mceInit);

After:

var subBtn = document.getElementById("submit");
	if (subBtn != null) {
	subBtn.onclick=function() {
		var inst = tinyMCE.getInstanceById("comment");
		document.getElementById("comment").value = inst.getContent();
		document.getElementById("commentform").submit();
		return false;
	}
}
tinyMCEPreInit.go();
tinymce.dom.Event.add(window, "load", function() {
	// Change the hidden fields id
	var pId = document.getElementById("comment_parent");
	if(pId) pId.id = "comment_parent_hf";
	tinyMCE.init(tinyMCEPreInit.mceInit);
});

The last thing that was changed in the script was a hard coded name of the comment_parent hidden filed inside comment-reply.dev.js in the TinyMCEComments plugin folder. Change parent = t.I(‘comment_parent’) to parent = t.I(‘comment_parent_hf’) to reflect the change we make on the load of TinyMCEComments:

Before (line 3):

var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID');

After:

var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent_hf'), post = t.I('comment_post_ID');

Now it works! Woohoo! I’m going to try to contact the other and have these changes included in the next release so everyone can enjoy threaded comments with TinyMCEComments. Thanks for reading and hopefully someone will find this helpful.


Today at work I was trying to convert our blog theme to a wider stance for an upcoming template switch, I thought this would be a very simple task. Little did I know the long day that would ensue. Our blog system at work used to use a plugin to create threaded functionality for posts. My boss decided that since WordPress now supports threaded comments we would switch over to that. I thought this would be a great idea (the less code, the less complex, the better). I began to convert our comments template to the new version required for Threaded Comments. After this was done I tried it out. It wouldn’t work with TinyMCEComments (plugin) enabled, but worked fine with it off. When TinyMCEComments was enabled it created two TinyMCE textareas whenever you tried to do a threaded reply. This seemed very odd to me but I had a feeling it had to do with moving the comment box below the comment that you’re replying too. After quite awhile and a little bit of help from my boss I was able to figure out all the issues and get TinyMCEComments working with the new threaded comments feature. There were two main issues:

  1. Double insertion of TinyMCE editors.
  2. TinyMCE has a bug where if create an editor with an id, then destroy that editor, and then try to create a new editor with that same id it will not work.
  3. TinyMCE names its iframe the id of the textarea concatenated with “_parent”. So when you add TinyMCE functionality to a textare with id=”comments” you get an iframe with id=”comments_parent”. Unfortunately, WordPress uses “comment_parent” as the id for a hidden field used to transfer information about where your new comment should be added in the threading (or to the base comments). The hidden fields are output by the function comment_id_fields(). Also WordPress says “the comment textarea, it MUST have an id=”comment”. The JavaScript expects it for focus purposes. If you used anything else, change it. Note that because of this, no other element on your page can have the “comment” ID”.

Before I explain the fixes let me first say that TinyMCEComments overrides the addComment.moveForm function that is used by WordPress to move the comment box under the comment you want to reply too. It has the same code except that it has the added functionality for enabling TinyMCE on the comment box. Unfortunately it doesn’t work out of the box with WordPress’ thread comments.

Problem 1 was an issue with the TinyMCEComments plugin and TinyMCE. Using the remove method doesn’t remove the the TinyMCE’s iframe from the DOM. This was fixed with Problem 2. The removing and adding method being used doesn’t work correctly for Problem number 2 is a TinyMCE problem and we can’t really do to much about it other then implementing a name change when we reinsert the comment box. So we modified the TinyMCEComments plugin to rename the text area on reinsertion.

Before

Remove TinyMCE Comment box:

try {
   tinyMCE.triggerSave();
   tinyMCE.execCommand('mceFocus', false,'comment');
   tinyMCE.execCommand('mceRemoveControl', false,'comment');
} catch(el) { console.error(el); }

Add TinyMCE Comment box code:

addTiny : function() {
   try { tinyMCE.execCommand('mceAddControl', false, 'comment');
   } catch (e) { console.error(e); }
}

After:

Remove TinyMCE Comment box:

// **** Remove the TinyMCE Editor
var editor = tinymce.EditorManager.activeEditor;
var editorId = editor.getParam('elements');
editor.remove();
tinymce.DOM.remove(editor.getContainer());
editor.destroy();
tinymce.EditorManager.activeEditor = null;

Add TinyMCE Comment box code:

var commentElement = document.getElementById(editorId);
if (editorId == "comment")
	editorId = "comment_1";
else {
	var count = parseInt(editorId.replace(/comment_/, ""), 10) + 1;
	editorId = "comment_" + count;
}
commentElement.id = editorId;
tinyMCEPreInit.mceInit.elements = editorId;
tinyMCE.init(tinyMCEPreInit.mceInit);

Problem number 2 was more of a conflict and wasn’t really anyones fault, but was rather troublesome to fix. We thought it would be easier to change the TinyMCEComments plugin then modify the install of WordPress. We also had already modified the plugin to remove/insert TinyMCE boxes correctly so we might as well keep working with that. To fix the problem before TinyMCE is initialized we change the hidden field with id=”comment_parent” so it is id=”comment_parent_hf”. This doesn’t effect WordPress comment submission because form submissions use the name field server side to identify an attribute.

Change in tinyMCEComments.php

Before (start line 295):

if (subBtn != null) {
	subBtn.onclick=function() {
		var inst = tinyMCE.getInstanceById("comment");
		document.getElementById("comment").value = inst.getContent();
		document.getElementById("commentform").submit();
		return false;
	}
}
tinyMCEPreInit.go();
tinyMCE.init(tinyMCEPreInit.mceInit);

After:

var subBtn = document.getElementById("submit");
	if (subBtn != null) {
	subBtn.onclick=function() {
		var inst = tinyMCE.getInstanceById("comment");
		document.getElementById("comment").value = inst.getContent();
		document.getElementById("commentform").submit();
		return false;
	}
}
tinyMCEPreInit.go();
tinymce.dom.Event.add(window, "load", function() {
	// Change the hidden fields id
	var pId = document.getElementById("comment_parent");
	if(pId) pId.id = "comment_parent_hf";
	tinyMCE.init(tinyMCEPreInit.mceInit);
});

The last thing that was changed in the script was a hard coded name of the comment_parent hidden filed inside comment-reply.dev.js in the TinyMCEComments plugin folder. Change parent = t.I(‘comment_parent’) to parent = t.I(‘comment_parent_hf’) to reflect the change we make on the load of TinyMCEComments:

Before (line 3):

var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID');

After:

var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent_hf'), post = t.I('comment_post_ID');

Now it works! Woohoo! I’m going to try to contact the other and have these changes included in the next release so everyone can enjoy threaded comments with TinyMCEComments. Thanks for reading and hopefully someone will find this helpful.

Completed Files in Zip: DevTinyMCEComments

easySlider for jQuery

February 11th, 2010 - 3 Comments

Yesterday my supervisor and I used EasySlider (a jQuery plugin) created by Alen Grakalic to make a Flickr slideshow that uses external controls to control the slideshow. It uses the Flickr feed to return a photoset in JSON to get the photos then a slightly modified version of EasySlider to do this. All that was added was a way to have a callback function on slide changes. The function is used by passing the function to trigger with the rest of options by setting onChangedCallBack to the function name. The rest of the script is unchanged. I am sending the code to author for possible future releases. The page it was used on is not currently public, but later I might update this post with a link to it. This is the page that it was used on: http://www.missouristate.edu/presidentialsearch/missouristate.htm Here is the code and at the end I will link the actual .js file.

/*
 * 	Easy Slider 1.7 - jQuery plugin
 *	written by Alen Grakalic
 *	http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
 *
 *	Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */

/*
 *	markup example for $("#slider").easySlider();
 *
 * 	<div id="slider">
 *		<ul>
 *			<li><img src="images/01.jpg" alt="" /></li>
 *			<li><img src="images/02.jpg" alt="" /></li>
 *			<li><img src="images/03.jpg" alt="" /></li>
 *			<li><img src="images/04.jpg" alt="" /></li>
 *			<li><img src="images/05.jpg" alt="" /></li>
 *		</ul>
 *	</div>
 *
 */

(function($) {

    $.fn.easySlider = function(options) {

        // default configuration properties
        var defaults = {
            prevId: 'prevBtn',
            prevText: 'Previous',
            nextId: 'nextBtn',
            nextText: 'Next',
            controlsShow: true,
            controlsBefore: '',
            controlsAfter: '',
            controlsFade: true,
            firstId: 'firstBtn',
            firstText: 'First',
            firstShow: false,
            lastId: 'lastBtn',
            lastText: 'Last',
            lastShow: false,
            vertical: false,
            speed: 800,
            auto: false,
            pause: 2000,
            continuous: false,
            numeric: false,
            numericId: 'controls',
            onChangedCallback: null
        };

        var options = $.extend(defaults, options);

        this.each(function() {
            var obj = $(this);
            var s = $("li", obj).length;
            var w = $("li", obj).width();
            var h = $("li", obj).height();
            var clickable = true;
            obj.width(w);
            obj.height(h);
            obj.css("overflow", "hidden");
            var ts = s - 1;
            var t = 0;
            $("ul", obj).css('width', s * w);

            if (options.continuous) {
                $("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left", "-" + w + "px"));
                $("ul", obj).append($("ul li:nth-child(2)", obj).clone());
                $("ul", obj).css('width', (s + 1) * w);
            };

            if (!options.vertical) $("li", obj).css('float', 'left');

            if (options.controlsShow) {
                var html = options.controlsBefore;
                if (options.numeric) {
                    html += '<ol id="' + options.numericId + '"></ol>';
                } else {
                    if (options.firstShow) html += '<span id="' + options.firstId + '"><a href=\"javascript:void(0);\">' + options.firstText + '</a></span>';
                    html += ' <span id="' + options.prevId + '"><a href=\"javascript:void(0);\">' + options.prevText + '</a></span>';
                    html += ' <span id="' + options.nextId + '"><a href=\"javascript:void(0);\">' + options.nextText + '</a></span>';
                    if (options.lastShow) html += ' <span id="' + options.lastId + '"><a href=\"javascript:void(0);\">' + options.lastText + '</a></span>';
                };

                html += options.controlsAfter;
                $(obj).after(html);
            };

            if (options.numeric) {
                for (var i = 0; i < s; i++) {
                    $(document.createElement("li"))
						.attr('id', options.numericId + (i + 1))
						.html('<a rel=' + i + ' href=\"javascript:void(0);\">' + (i + 1) + '</a>')
						.appendTo($("#" + options.numericId))
						.click(function() {
						    animate($("a", $(this)).attr('rel'), true);
						});
                };
            } else {
                $("a", "#" + options.nextId).click(function() {
                    animate("next", true);
                });
                $("a", "#" + options.prevId).click(function() {
                    animate("prev", true);
                });
                $("a", "#" + options.firstId).click(function() {
                    animate("first", true);
                });
                $("a", "#" + options.lastId).click(function() {
                    animate("last", true);
                });
            };

            function setCurrent(i) {
                i = parseInt(i) + 1;
                $("li", "#" + options.numericId).removeClass("current");
                $("li#" + options.numericId + i).addClass("current");
            };

            function showMeta(i) {
                document.getElementById("fss_meta").style.display = "block";
                debugger;
                var a = $("ul", obj);
                $("#fss_meta h3").html($("#fss ul:nth-child(" + i + ") img").attr("alt"));
                $("#fss_meta p").html(options.metaInfo[i - 1]);
            };

            function adjust() {
                if (t > ts) t = 0;
                if (t < 0) t = ts;
                if (!options.vertical) {
                    $("ul", obj).css("margin-left", (t * w * -1));
                } else {
                    $("ul", obj).css("margin-left", (t * h * -1));
                }
                clickable = true;
                if (options.numeric) setCurrent(t);
                if (options.onChangedCallback) options.onChangedCallback(t);
            };

            function animate(dir, clicked) {
                if (clickable) {
                    clickable = false;
                    var ot = t;
                    switch (dir) {
                        case "next":
                            t = (ot >= ts) ? (options.continuous ? t + 1 : ts) : t + 1;
                            break;
                        case "prev":
                            t = (t <= 0) ? (options.continuous ? t - 1 : 0) : t - 1;
                            break;
                        case "first":
                            t = 0;
                            break;
                        case "last":
                            t = ts;
                            break;
                        default:
                            t = dir;
                            break;
                    };
                    var diff = Math.abs(ot - t);
                    var speed = diff * options.speed;
                    if (!options.vertical) {
                        p = (t * w * -1);
                        $("ul", obj).animate(
							{ marginLeft: p },
							{ queue: false, duration: speed, complete: adjust }
						);
                    } else {
                        p = (t * h * -1);
                        $("ul", obj).animate(
							{ marginTop: p },
							{ queue: false, duration: speed, complete: adjust }
						);
                    };

                    if (!options.continuous && options.controlsFade) {
                        if (t == ts) {
                            $("a", "#" + options.nextId).hide();
                            $("a", "#" + options.lastId).hide();
                        } else {
                            $("a", "#" + options.nextId).show();
                            $("a", "#" + options.lastId).show();
                        };
                        if (t == 0) {
                            $("a", "#" + options.prevId).hide();
                            $("a", "#" + options.firstId).hide();
                        } else {
                            $("a", "#" + options.prevId).show();
                            $("a", "#" + options.firstId).show();
                        };
                    };

                    if (clicked) clearTimeout(timeout);
                    if (options.auto && dir == "next" && !clicked) {
                        ;
                        timeout = setTimeout(function() {
                            animate("next", false);
                        }, diff * options.speed + options.pause);
                    };

                };

            };
            // init
            var timeout;
            if (options.auto) {
                ;
                timeout = setTimeout(function() {
                    animate("next", false);
                }, options.pause);
            };

            if (options.numeric) setCurrent(0);
            if (options.onChangedCallback)
                options.onChangedCallback(0);

            if (!options.continuous && options.controlsFade) {
                $("a", "#" + options.prevId).hide();
                $("a", "#" + options.firstId).hide();
            };

        });

    };

})(jQuery);

File: easySlider1.7-Callback

/*
*     Easy Slider 1.7 – jQuery plugin
*    written by Alen Grakalic
*    http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
*
*    Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
*    Dual licensed under the MIT (MIT-LICENSE.txt)
*    and GPL (GPL-LICENSE.txt) licenses.
*
*    Built for jQuery library
*    http://jquery.com
*
*//*
*    markup example for $(“#slider”).easySlider();
*
*     <div id=”slider”>
*        <ul>
*            <li><img src=”images/01.jpg” alt=”" /></li>
*            <li><img src=”images/02.jpg” alt=”" /></li>
*            <li><img src=”images/03.jpg” alt=”" /></li>
*            <li><img src=”images/04.jpg” alt=”" /></li>
*            <li><img src=”images/05.jpg” alt=”" /></li>
*        </ul>
*    </div>
*
*/

(function($) {

$.fn.easySlider = function(options) {

// default configuration properties
var defaults = {
prevId: ‘prevBtn’,
prevText: ‘Previous’,
nextId: ‘nextBtn’,
nextText: ‘Next’,
controlsShow: true,
controlsBefore: ”,
controlsAfter: ”,
controlsFade: true,
firstId: ‘firstBtn’,
firstText: ‘First’,
firstShow: false,
lastId: ‘lastBtn’,
lastText: ‘Last’,
lastShow: false,
vertical: false,
speed: 800,
auto: false,
pause: 2000,
continuous: false,
numeric: false,
numericId: ‘controls’,
onChangedCallback: null
};

var options = $.extend(defaults, options);

this.each(function() {
var obj = $(this);
var s = $(“li”, obj).length;
var w = $(“li”, obj).width();
var h = $(“li”, obj).height();
var clickable = true;
obj.width(w);
obj.height(h);
obj.css(“overflow”, “hidden”);
var ts = s – 1;
var t = 0;
$(“ul”, obj).css(‘width’, s * w);

if (options.continuous) {
$(“ul”, obj).prepend($(“ul li:last-child”, obj).clone().css(“margin-left”, “-” + w + “px”));
$(“ul”, obj).append($(“ul li:nth-child(2)”, obj).clone());
$(“ul”, obj).css(‘width’, (s + 1) * w);
};

if (!options.vertical) $(“li”, obj).css(‘float’, ‘left’);

if (options.controlsShow) {
var html = options.controlsBefore;
if (options.numeric) {
html += ‘<ol id=”‘ + options.numericId + ‘”></ol>’;
} else {
if (options.firstShow) html += ‘<span id=”‘ + options.firstId + ‘”><a href=\”javascript:void(0);\”>’ + options.firstText + ‘</a></span>’;
html += ‘ <span id=”‘ + options.prevId + ‘”><a href=\”javascript:void(0);\”>’ + options.prevText + ‘</a></span>’;
html += ‘ <span id=”‘ + options.nextId + ‘”><a href=\”javascript:void(0);\”>’ + options.nextText + ‘</a></span>’;
if (options.lastShow) html += ‘ <span id=”‘ + options.lastId + ‘”><a href=\”javascript:void(0);\”>’ + options.lastText + ‘</a></span>’;
};

html += options.controlsAfter;
$(obj).after(html);
};

if (options.numeric) {
for (var i = 0; i < s; i++) {
$(document.createElement(“li”))
.attr(‘id’, options.numericId + (i + 1))
.html(‘<a rel=’ + i + ‘ href=\”javascript:void(0);\”>’ + (i + 1) + ‘</a>’)
.appendTo($(“#” + options.numericId))
.click(function() {
animate($(“a”, $(this)).attr(‘rel’), true);
});
};
} else {
$(“a”, “#” + options.nextId).click(function() {
animate(“next”, true);
});
$(“a”, “#” + options.prevId).click(function() {
animate(“prev”, true);
});
$(“a”, “#” + options.firstId).click(function() {
animate(“first”, true);
});
$(“a”, “#” + options.lastId).click(function() {
animate(“last”, true);
});
};

function setCurrent(i) {
i = parseInt(i) + 1;
$(“li”, “#” + options.numericId).removeClass(“current”);
$(“li#” + options.numericId + i).addClass(“current”);
};

function showMeta(i) {
document.getElementById(“fss_meta”).style.display = “block”;
debugger;
var a = $(“ul”, obj);
$(“#fss_meta h3″).html($(“#fss ul:nth-child(” + i + “) img”).attr(“alt”));
$(“#fss_meta p”).html(options.metaInfo[i - 1]);
};

function adjust() {
if (t > ts) t = 0;
if (t < 0) t = ts;
if (!options.vertical) {
$(“ul”, obj).css(“margin-left”, (t * w * -1));
} else {
$(“ul”, obj).css(“margin-left”, (t * h * -1));
}
clickable = true;
if (options.numeric) setCurrent(t);
if (options.onChangedCallback) options.onChangedCallback(t);
};

function animate(dir, clicked) {
if (clickable) {
clickable = false;
var ot = t;
switch (dir) {
case “next”:
t = (ot >= ts) ? (options.continuous ? t + 1 : ts) : t + 1;
break;
case “prev”:
t = (t <= 0) ? (options.continuous ? t – 1 : 0) : t – 1;
break;
case “first”:
t = 0;
break;
case “last”:
t = ts;
break;
default:
t = dir;
break;
};
var diff = Math.abs(ot – t);
var speed = diff * options.speed;
if (!options.vertical) {
p = (t * w * -1);
$(“ul”, obj).animate(
{ marginLeft: p },
{ queue: false, duration: speed, complete: adjust }
);
} else {
p = (t * h * -1);
$(“ul”, obj).animate(
{ marginTop: p },
{ queue: false, duration: speed, complete: adjust }
);
};

if (!options.continuous && options.controlsFade) {
if (t == ts) {
$(“a”, “#” + options.nextId).hide();
$(“a”, “#” + options.lastId).hide();
} else {
$(“a”, “#” + options.nextId).show();
$(“a”, “#” + options.lastId).show();
};
if (t == 0) {
$(“a”, “#” + options.prevId).hide();
$(“a”, “#” + options.firstId).hide();
} else {
$(“a”, “#” + options.prevId).show();
$(“a”, “#” + options.firstId).show();
};
};

if (clicked) clearTimeout(timeout);
if (options.auto && dir == “next” && !clicked) {
;
timeout = setTimeout(function() {
animate(“next”, false);
}, diff * options.speed + options.pause);
};

};

};
// init
var timeout;
if (options.auto) {
;
timeout = setTimeout(function() {
animate(“next”, false);
}, options.pause);
};

if (options.numeric) setCurrent(0);
if (options.onChangedCallback)
options.onChangedCallback(0);

if (!options.continuous && options.controlsFade) {
$(“a”, “#” + options.prevId).hide();
$(“a”, “#” + options.firstId).hide();
};

});

};

})(jQuery);

Styling Image