var $in = $('#input')
, $check = $('#check')
, $links = $('#links')
;
$check.on('click', function () {
var val = $in.val();
$in.val('');
$links.append(
"<a class='link' href='#'>%VALUE%</a>"
.replace('%VALUE%', val)
);
});
var els = {
input: document.getElementById('input'),
check: document.getElementById('check'),
links: document.getElementById('links'),
link: document.createElement('a')
};
els.link.className = 'link';
els.link.href = '#';
els.check.addEventListener('click', function(){
var a = els.link.cloneNode();
a.innerText = els.input.value;
els.input.value = '';
els.links.appendChild(a);
});
mix-blend-mode: multiply;
Fiddle.fx {
background-image: url( bg1.png ), url( bg2.png );
background-repeat: no-repeat, no-repeat;
background-blend-mode: multiply, normal;
}
Fiddle document
.getElementById('e-example')
.addEventListener('click', function(){
document.getElementById('search').value = this.innerText;
});
image.src = 'data:image/png;base64,...
[]
а объекты {}
._.extend = createAssigner(_.allKeys);
var createAssigner = function(keysFunc, undefinedOnly) {
return function(obj) {
var length = arguments.length;
if (length < 2 || obj == null) return obj;
for (var index = 1; index < length; index++) {
var source = arguments[index],
keys = keysFunc(source),
l = keys.length;
for (var i = 0; i < l; i++) {
var key = keys[i];
if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];
}
}
return obj;
};
};
_.allKeys = function(obj) {
if (!_.isObject(obj)) return [];
var keys = [];
for (var key in obj) keys.push(key);
if (hasEnumBug) collectNonEnumProps(obj, keys);
return keys;
};
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[ 0 ] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
// Skip the boolean and the target
target = arguments[ i ] || {};
i++;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
target = {};
}
// Extend jQuery itself if only one argument is passed
if ( i === length ) {
target = this;
i--;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( ( options = arguments[ i ] ) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
( copyIsArray = Array.isArray( copy ) ) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && Array.isArray( src ) ? src : [];
} else {
clone = src && jQuery.isPlainObject( src ) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
k * векторИзТекущегоПоложения-в-Цель
:x = x + k * (xTarget - x);
y = y + k * (yTarget - y);
<g>
.:hover
при наведении мышки пришлось обернуть SVG в <div>
$search = 'b';
$json = '{"1":{"name":"Browser"},"2":{"name":"Браузер"},"3":{"name":"Повар"},"4":{"name":"bонки"}}';
$data = json_decode($json);
$found = array();
foreach($data as $entry) {
$name = $entry->name;
if( false !== mb_stristr( $name, $search)) {
array_push( $found, $name);
}
}
print_r($found);
/* Array
(
[0] => Browser
[1] => bонки
) */
200 * 6 / 2 = 600
связей (чуть меньше из-за краёв).W = Math.max(0, D - Math.abs( length - D))/D
, где D – пороговая дистанция.W * (time - timeUpdated)