Архив

Архив Июнь 2012

В раздел инициализации tinymce добавить:

extended_valid_elements:"iframe[src|width|height|name|align]",
Categories: Javascript Tags: ,

Для перехода по ссылке не в iframe а на родительскую страницу:

onclick='parent.$.colorbox.close();window.parent.location.href="/contacts/";'
Categories: Javascript Tags: ,
7 июня 2012 1 комментарий
function blink(selector) {
	$(selector).fadeOut('slow',function() {
		$(this).fadeIn('slow',function() {
			blink(this);
		});
	});
}
$(document).ready(function () {
	blink('.bl');
});
Categories: Javascript Tags:
function fix_flash() {
	var embeds = document.getElementsByTagName('embed');
	for(i=0; i<embeds.length; i++)  {
		embed = embeds[i];
		var new_embed;
		if(embed.outerHTML) {
			var html = embed.outerHTML;
			if(html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i))
			new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i,"wmode='transparent'");
			else 
			new_embed = html.replace(/<embed\s/i,"<embed wmode='transparent' ");
			embed.insertAdjacentHTML('beforeBegin',new_embed);
			embed.parentNode.removeChild(embed);
		} else {
			new_embed = embed.cloneNode(true);
			if(!new_embed.getAttribute('wmode') || new_embed.getAttribute('wmode').toLowerCase()=='window')
			new_embed.setAttribute('wmode','transparent');
			embed.parentNode.replaceChild(new_embed,embed);
		}
	}
	var objects = document.getElementsByTagName('object');
	for(i=0; i<objects.length; i++) {
		object = objects[i];
		var new_object;
		if(object.outerHTML) {
			var html = object.outerHTML;
			if(html.match(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i))
			new_object = html.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i,"<param name='wmode' value='transparent' />");
			else 
			new_object = html.replace(/<\/object\>/i,"<param name='wmode' value='transparent' />\n</object>");
			var children = object.childNodes;
			for(j=0; j<children.length; j++) {
				if(children[j].getAttribute('name').match(/flashvars/i)) {
					new_object = new_object.replace(/<param\s+name\s*=\s*('|")flashvars('|")\s+value\s*=\s*('|")[^'"]*('|")\s*\/?\>/i,"<param name='flashvars' value='"+children[j].getAttribute('value')+"' />");
				}
			}
			object.insertAdjacentHTML('beforeBegin',new_object);
			object.parentNode.removeChild(object);
		}
	}
}
$(document).ready(function () {
	fix_flash();    
});

http://www.developersnippets.com/2010/12/04/how-to-add-wmodetransparent-for-flash-object-using-jquery-and-native-javascript/
http://www.onlineaspect.com/2009/08/13/javascript_to_fix_wmode_parameters/

Categories: Javascript Tags:

Z-index для flash-элементов

$("embed").attr("wmode", "opaque");
$(document).ready(function() {
	var embedTag;
	$("embed").each(function(i) {
		embedTag = $(this).attr("outerHTML");
		if ((embedTag != null) && (embedTag.length > 0)) {
			embedTag = embedTag.replace(/embed /gi, "embed wmode=\"opaque\" ");
			$(this).attr("outerHTML", embedTag);
		}
	});
});

http://labs.kaliko.com/2009/11/change-wmode-with-jquery.html
Не работает в IE

Categories: Javascript Tags:
$arr = array(2, 3, 4, 2, 5, 2);
function delEl($arr, $del) {
   foreach($arr as $val)  { if($val !== $del) $newArr[] = $val; }
   return $newArr;
}
// Пример
$checkDelEl = delEl($arr, 2);
print_r($checkDelEl);  // Array ( [0] => 3 [1] => 4 [2] => 5 )
Categories: PHP Tags: