;(function($){ // プラグイン名 var PLUGIN_NAME = "movieManager"; var ImplementationClass = function(target, config) { var settings = $.extend({}, $[PLUGIN_NAME].defaults, config), myself = this; $(target).data(PLUGIN_NAME, myself); myself.publicProp001 = "test"; var $thumbnailImage,$switchers,currentIndex; function _constructor_() {currentIndex = 0;$thumbnailImage = $("img.thumbnail", $(target)).css({ cursor : "pointer" }).on('click', showMovie);$switchers = $("a[data-options]", $(target)).on('click', changeThumbnail);} $.extend( myself, { havingnopoint : "" }); _constructor_(); function changeThumbnail(event) {event.preventDefault();var movieInfo = $(this).data('options');$thumbnailImage.attr("src", movieInfo.thumbnail);currentIndex = $switchers.index(this);} function showMovie(event) {var movieInfo = $switchers.eq(currentIndex).data('options'),options = {iframe: movieInfo.iframe, innerWidth: movieInfo.width, innerHeight: movieInfo.height};if(movieInfo.href) {options.href = movieInfo.href;} else if(movieInfo.html) {options.html = $(movieInfo.html).html();}$.colorbox(options);} }; $[PLUGIN_NAME] = {defaults : {defaultProp001: 0, defaultProp002: 0}}; $.fn[PLUGIN_NAME] = function(config){ return this.each(function(i){ new ImplementationClass(this, config); });}; })(jQuery);