Логотип
Культурный центр Танцевальное Убежище ЭКОМАГ - экономия топлива и экологичность автомобиля
Загрузка. Подождите.
Если ничего не происходит, попробуйте обновить страничку — сайт построен на технологии AJAX, может что-то заело, кроме того для работы сайта необходим JavaScript и вероятно, что браузер заблокировал сайт. Разрешите запуск скриптов. Если ваш браузер Internet Explorer добавьте сайт в надёжные узлы (справа внизу). После этого нужно обновить страницу.
Вы можете посмотреть версию для печати этой страницы.

// returns the HTML-formatted string with images which width

// is bigger, than the max value, specified, replaced with

// <а href="to full image"><img width='maxwidth' height='proportional' src='to full image' /></а>

// the smaller images are left unchanged

function smallDownImages( input, maxImageWidth )

// searching for images in the source

var inputLeft = input;

var output = "";

while ( true )

{

// searching for the img tag start

var leftI = inputLeft.search( /<img[^>] >/mi );

// checking, if there is something to do

if ( leftI < 0 )

{

output = inputLeft;

break;

};

// adding the part before the image to the output

if ( leftI > 0 )

output = inputLeft.slice( 0, leftI-1 );

// the part of the input, untreated is:

inputLeft = inputLeft.slice( leftI );

// searching for the end of the image

var rightI = inputLeft.search( />/mi );

// checking, if there is a error in tags

if ( rightI < 0 )

{

output = inputLeft;

break;

};

// obtaining the image tag properties

var imageTag = inputLeft.slice( 0, rightI 1 );

var width = parseInt( imageTag.match( /width\s*=\s*[\'\"](\d )/mi )[1] );

var height = parseInt( imageTag.match( /height\s*=\s*[\'\"](\d )/mi )[1] );

var src = imageTag.match( /src\s*=\s*[\'\"]([^\'\"] )/mi )[1];

// scaling, if required

if ( width > maxImageWidth )

{

var scale = 0.5 maxImageWidth / width - 0.5;

width = Math.floor( scale * width 0.5 );

height = Math.floor( scale * height 0.5 );

var imageTag = "<a href=\"" src "\">"

imageTag.replace( /(width\s*=\s*[\'\"])(\d )/mi, "$1" width )

.replace( /(height\s*=\s*[\'\"])(\d )/mi, "$1" height )

"";

};

// and adding to the output

output = imageTag;

// the part of the input, untreated is:

inputLeft = inputLeft.slice( rightI 1 );

};

// done

return output;

}

 
 
Языки
Темы
Copyright © 2006 — 2009
Доктор Робот