function addLink() { var body_element=document.getElementsByTagName('body')[0]; var selection; selection=window.getSelection(); var pagelink="<br/><br/>Источник: <a href='"+document.location.href+"'>"+document.location.href+"</a><br/><br/>"; var copytext=selection+pagelink; var newdiv=document.createElement('div'); newdiv.style.position='absolute'; newdiv.style.left='-99999px'; body_element.appendChild(newdiv); newdiv.innerHTML=copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() { body_element.removeChild(newdiv); },0); } document.oncopy=addLink;
Архив
Ноябрь 2014
Всего: 3 записи
javascript: изменение высоты блоков относительно блока с максимальной высотой
В примере устанавливаем для всех элементов с class catalog_item высоту самого высокого.
function setEqualHeight(columns){ var tallestcolumn=0; columns.each( function(){ currentHeight=$(this).height(); if(currentHeight>tallestcolumn) { tallestcolumn=currentHeight; } } ); columns.height(tallestcolumn); } $(window).load(function() { setEqualHeight($(".catalog_item")); });
php: рекурсивное удаление папки
function rrmdir($dir) { if (is_dir($dir)) { $objects=scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object); } } reset($objects); rmdir($dir); } } rrmdir($_SERVER['DOCUMENT_ROOT']."/bitrix/");