Example #1
0
	function loadScripts(&$module, &$params)
	{
		JHTML::_('behavior.mootools');
		
		$swidth = $params->get("start_width", 410);
		$layout = $params->get("layout_type", "layout1");
		$thumbsOpacity = $params->get("thumbs_opacity", 0.3);
		if ($swidth == 'auto' || $layout == 'layout2') $swidth = "'auto'";
		if ($layout == 'layout2') $thumbsOpacity = 1;
		
		$tlx = $params->get('left_offset_x', -40);
		$tly = $params->get('left_offset_y', -100);
		$trx = $params->get('right_offset_x', -30);
		$try = $params->get('right_offset_y', -100);
		
		if ($params->get("fixed_thumb", 1) == 0) {
			$tlx = $params->get('left_f_offset_x', -55);
			$tly = $params->get('left_f_offset_y', -105);
			$trx = $params->get('right_f_offset_x', -55);
			$try = $params->get('right_f_offset_y', -105);
		}
		
		$leftOffset = "{x: $tlx, y: $tly}";
		$rightOffset = "{x: $trx, y: $try}";
		
		
		$document =& JFactory::getDocument();
		if (!defined('ROKSTORIES')) {
			$document->addScript(JURI::Root(true)."/modules/mod_rokstories/tmpl/js/rokstories".modRokStoriesHelper::_getJSVersion().".js");
			$document->addScriptDeclaration("var RokStoriesImage = {}, RokStoriesLinks = {};");
			define('ROKSTORIES', 1);
		}
		$document->addScriptDeclaration("
		RokStoriesImage['rokstories-{$module->id}'] = [];
		RokStoriesLinks['rokstories-{$module->id}'] = [];
		window.addEvent('domready', function() {
			new RokStories('rokstories-{$module->id}', {
				'id': ".$module->id.",
				'startElement': ".$params->get("start_element", 0).",
				'thumbsOpacity': ".$thumbsOpacity.",
				'mousetype': '".$params->get("mouse_type", "click")."',
				'autorun': ".$params->get("autoplay", 0).",
				'delay': ".$params->get("autoplay_delay", 5000).",
				'scrollerDuration': ".$params->get("scrollerDuration", 5000).",
				'scrollerTransition': Fx.Transitions.".$params->get("scrollerTransition", 'Expo.easeInOut').",
				'startWidth': ".$swidth.",
				'layout': '$layout',
				'linkedImgs': ".$params->get("link_images", 0).",
				'showThumbs': ".$params->get("show_thumbs", 0).",
				'fixedThumb': ".$params->get("fixed_thumb", 1).",
				'mask': ".$params->get('show_mask', 1).",
				'descsAnim': '".$params->get('mask_desc_dir', 'topdown')."',
				'imgsAnim': '".$params->get('mask_imgs_dir', 'bottomup')."',
				'thumbLeftOffsets': $leftOffset,
				'thumbRightOffsets': $rightOffset
			});
		});");
	}