Курсовая работа: Разработка сайта по составлению комплектации компьютера

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

// ITS TRAJETORY BY SUBTRACTING ITS INTERMEDIATE POSITION FROM ITS FINAL POSITION.

// ALSO ADD SPEED AND EASING

$pre.each(function(){

var data = this.data

data.tX = data.finalPrePos.left != 0 ? data.finalPrePos.left - data.preInterPos.left : 0;

data.tY = data.finalPrePos.left != 0 ? data.finalPrePos.top - data.preInterPos.top : 0;

var preCSS = {};

for(var i = 0; i<2; i++){

var a = i==0 ? a = config.prefix : '';

preCSS[a+'transition'] = 'all '+speed+'ms '+config.easing;

preCSS[a+'transform'] = 'translate('+data.tX+'px,'+data.tY+'px)';

};

$(this).css('-webkit-transition', 'all '+speed+'ms '+config.easingFallback).css(preCSS);

});

// BEGIN TRANSFORMS ON ALL ELEMENTS TO BE HIDDEN

var toHideCSS = {};

for(var i = 0; i<2; i++){

var a = i==0 ? a = config.prefix : '';

toHideCSS[a+'transition'] = 'all '+speed+'ms '+config.easing+', '+a+'filter '+speed+'ms linear, opacity '+speed+'ms linear';

toHideCSS[a+'transform'] = config.scale+' '+config.rotateX+' '+config.rotateY+' '+config.rotateZ;

toHideCSS[a+'filter'] = config.blur+' '+config.grayscale;

toHideCSS['opacity'] = config.fade;

};

$tohide.css(toHideCSS);

// ALL ANIMATIONS HAVE NOW BEEN STARTED, NOW LISTEN FOR TRANSITION END:

$par.bind('webkitTransitionEnd transitionend otransitionend oTransitionEnd',function(e){

if (e.originalEvent.propertyName.indexOf('transform') > -1 || e.originalEvent.propertyName.indexOf('opacity') > -1){

if(mixSelector.indexOf('.') > -1){

// IF MIXSELECTOR IS A CLASS NAME

if($(e.target).hasClass(mixSelector.replace('.',''))){

resetFilter();

};

} else {

// IF MIXSELECTOR IS A TAG

if($(e.target).is(mixSelector)){

resetFilter();

};

};

};

});

},10);

// LAST RESORT EMERGENCY FAILSAFE

config.failsafe = setTimeout(function(){

if(config.mixing){

resetFilter();

};

}, speed + 400);

} else {

// ELSE IF NOTHING TO SHOW, AND EVERYTHING TO BE HIDDEN

// IF WE ARE RESIZING CONTAINER, SET ITS STARTING HEIGHT

if(config.resizeContainer)$par.css('height', config.origHeight+'px');

// IF IE, FUCK OFF, AND THEN GO HOME

if(!window.atob){

resetFilter();

return false;

};

// GROUP ALL ELEMENTS TO HIDE INTO JQUERY OBJECT

$tohide = $hide;

// WRAP ANIMATION FUNCTIONS IN A 10ms DELAY TO PREVENT RACE CONDITION

var delay = setTimeout(function(){

// APPLY PERSPECTIVE TO CONTAINER

$par.css(config.perspective);

// APPLY TRANSITION TIMING TO CONTAINER, AND BEGIN ANIMATION TO NEW HEIGHT

if(config.resizeContainer){

var containerCSS = {};

for(var i = 0; i<2; i++){

var a = i==0 ? a = config.prefix : '';

containerCSS[a+'transition'] = 'height '+speed+'ms ease-in-out';

containerCSS['height'] = config.minHeight+'px';

};

$par.css(containerCSS);

};

// APPLY TRANSITION TIMING TO ALL TARGET ELEMENTS

$targets.css(config.transition);

// GET TOTAL NUMBER OF ELEMENTS TO HIDE

var totalHide = $hide.length;

// IF SOMETHING TO HIDE:

if(totalHide){

// BEGIN TRANSFORMS ON ALL ELEMENTS TO BE HIDDEN

var toHideCSS = {};

for(var i = 0; i<2; i++){

var a = i==0 ? a = config.prefix : '';

toHideCSS[a+'transform'] = config.scale+' '+config.rotateX+' '+config.rotateY+' '+config.rotateZ;

toHideCSS[a+'filter'] = config.blur+' '+config.grayscale;

toHideCSS['opacity'] = config.fade;

};

$tohide.css(toHideCSS);

// ALL ANIMATIONS HAVE NOW BEEN STARTED, NOW LISTEN FOR TRANSITION END:

$par.bind('webkitTransitionEnd transitionend otransitionend oTransitionEnd',function(e){

if (e.originalEvent.propertyName.indexOf('transform') > -1 || e.originalEvent.propertyName.indexOf('opacity') > -1){

$cont.addClass(config.failClass);

resetFilter();

};

});

} else {

// ELSE, WE'RE DONE MIXING

config.mixing = false;

};

}, 10);

};

// CLEAN UP AND RESET FUNCTION

function resetFilter(){

// UNBIND TRANSITION END EVENTS FROM CONTAINER

$par.unbind('webkitTransitionEnd transitionend otransitionend oTransitionEnd');

// IF A SORT ARGUMENT HAS BEEN SENT, SORT ELEMENTS TO THEIR FINAL ORDER

if(sortby){

sort(sortby, order, $cont, config);

};

// EMPTY SORTING ARRAYS

config.startOrder = [], config.newOrder = [], config.origSort = [], config.checkSort = [];

// REMOVE INLINE STYLES FROM ALL TARGET ELEMENTS AND SLAM THE BRAKES ON

$targets.removeStyle(

config.prefix+'filter, filter, '+config.prefix+'transform, transform, opacity, display'

).css(config.clean).removeAttr('data-checksum');

// BECAUSE IE SUCKS

if(!window.atob){

$targets.css({

display: 'none',

opacity: '0'

});

};

// REMOVE HEIGHT FROM CONTAINER ONLY IF RESIZING

var remH = config.resizeContainer ? 'height' : '';

// REMOVE INLINE STYLES FROM CONTAINER

$par.removeStyle(

config.prefix+'transition, transition, '+config.prefix+'perspective, perspective, '+config.prefix+'perspective-origin, perspective-origin, '+remH

);

// ADD FINAL DISPLAY PROPERTIES AND OPACITY TO ALL SHOWN ELEMENTS

// CACHE CURRENT LAYOUT MODE & SORT FOR NEXT MIX

if(config.layoutMode == 'list'){

$show.css({display:config.targetDisplayList, opacity:'1'});

config.origDisplay = config.targetDisplayList;

} else {

$show.css({display:config.targetDisplayGrid, opacity:'1'});

config.origDisplay = config.targetDisplayGrid;

};

config.origLayout = config.layoutMode;

var wait = setTimeout(function(){

// LET GO OF THE BRAKES

$targets.removeStyle(config.prefix+'transition, transition');

// WE'RE DONE MIXING

config.mixing = false;

// FIRE "ONMIXEND" CALLBACK

if(typeof config.onMixEnd == 'function') {

var output = config.onMixEnd.call(this, config);

// UPDATE CONFIG IF DATA RETURNED

config = output ? output : config;

};

});

};

};

// SORT FUNCTION

function sort(sortby, order, $cont, config){

// COMPARE BY ATTRIBUTE

function compare(a,b) {

var sortAttrA = isNaN(a.attr(sortby) * 1) ? a.attr(sortby).toLowerCase() : a.attr(sortby) * 1,

sortAttrB = isNaN(b.attr(sortby) * 1) ? b.attr(sortby).toLowerCase() : b.attr(sortby) * 1;

if (sortAttrA < sortAttrB)

return -1;

if (sortAttrA > sortAttrB)

return 1;

return 0;

};

// REBUILD DOM

function rebuild(element){

if(order == 'asc'){

$sortWrapper.prepend(element).prepend(' ');

} else {

$sortWrapper.append(element).append(' ');

};

};

// RANDOMIZE ARRAY

function arrayShuffle(oldArray){

var newArray = oldArray.slice();

var len = newArray.length;

var i = len;

while (i--){

var p = parseInt(Math.random()*len);

var t = newArray[i];

newArray[i] = newArray[p];

newArray[p] = t;

};

return newArray;

};

// SORT

$cont.find(config.targetSelector).wrapAll('<div class="mix_sorter"/>');

var $sortWrapper = $cont.find('.mix_sorter');

if(!config.origSort.length){

$sortWrapper.find(config.targetSelector+':visible').each(function(){

$(this).wrap('<s/>');

config.origSort.push($(this).parent().html().replace(/\s+/g, ''));

$(this).unwrap();

});

};

$sortWrapper.empty();

if(sortby == 'reset'){

$.each(config.startOrder,function(){

$sortWrapper.append(this).append(' ');

});

} else if(sortby == 'default'){

$.each(config.origOrder,function(){

rebuild(this);

});

} else if(sortby == 'random'){

if(!config.newOrder.length){

config.newOrder = arrayShuffle(config.startOrder);

};

$.each(config.newOrder,function(){

$sortWrapper.append(this).append(' ');

});

} else if(sortby == 'custom'){

$.each(order, function(){

rebuild(this);

});

} else {

// SORT BY ATTRIBUTE

if(typeof config.origOrder[0].attr(sortby) === 'undefined'){

console.log('No such attribute found. Terminating');

return false;

};

if(!config.newOrder.length){

$.each(config.origOrder,function(){

config.newOrder.push($(this));

});

config.newOrder.sort(compare);

};

$.each(config.newOrder,function(){

rebuild(this);

});

};

config.checkSort = [];

$sortWrapper.find(config.targetSelector+':visible').each(function(i){

var $t = $(this);

if(i == 0){

// PREVENT COMPARE RETURNING FALSE POSITIVES ON ELEMENTS WITH NO CLASS/ATTRIBUTES

$t.attr('data-checksum','1');

};

$t.wrap('<s/>');

config.checkSort.push($t.parent().html().replace(/\s+/g, ''));

$t.unwrap();

});

$cont.find(config.targetSelector).unwrap();

};

// FIND VENDOR PREFIX

function prefix(el) {

var prefixes = ["Webkit", "Moz", "O", "ms"];

for (var i = 0; i < prefixes.length; i++){

if (prefixes[i] + "Transition" in el.style){

return prefixes[i];

};

};

return "transition" in el.style ? "" : false;

};

// REMOVE SPECIFIC STYLES

$.fn.removeStyle = function(style){

return this.each(function(){

var obj = $(this);

style = style.replace(/\s+/g, '');

var styles = style.split(',');

$.each(styles,function(){

var search = new RegExp(this.toString() + '[^;]+;?', 'g');

obj.attr('style', function(i, style){

if(style) return style.replace(search, '');

});

});

});

};

// COMPARE ARRAYS

function compareArr(a,b){

if (a.length != b.length) return false;

for (var i = 0; i < b.length; i++){

if (a[i].compare) {

if (!a[i].compare(b[i])) return false;

};

if (a[i] !== b[i]) return false;

};

return true;

};

// BUILD FILTER ARRAY(S)

function buildFilterArray(str){

// CLEAN FILTER STRING

str = str.replace(/\s{2,}/g, ' ');

// FOR EACH PEROID SEPERATED CLASS NAME, ADD STRING TO FILTER ARRAY

var arr = str.split(' ');

// IF ALL, REPLACE WITH MIX_ALL

$.each(arr,function(i){

if(this == 'all')arr[i] = 'mix_all';

});

if(arr[0] == "")arr.shift();

return arr;

};

})(jQuery);

if (typeof Object.create !== "function") {

Object.create = function (obj) {

function F() {}

F.prototype = obj;

return new F();

};

}

(function ($, window, document) {

var Carousel = {

init : function (options, el) {

var base = this;

base.$elem = $(el);

base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options);

base.userOptions = options;

base.loadContent();

},

loadContent : function () {

var base = this, url;

function getData(data) {

var i, content = "";

if (typeof base.options.jsonSuccess === "function") {

base.options.jsonSuccess.apply(this, [data]);

} else {

for (i in data.owl) {

if (data.owl.hasOwnProperty(i)) {

content += data.owl[i].item;

}

}

base.$elem.html(content);

}

base.logIn();

}

if (typeof base.options.beforeInit === "function") {

base.options.beforeInit.apply(this, [base.$elem]);

}

if (typeof base.options.jsonPath === "string") {

url = base.options.jsonPath;

$.getJSON(url, getData);

} else {

base.logIn();

}

},

logIn : function () {

var base = this;

base.$elem.data("owl-originalStyles", base.$elem.attr("style"));

base.$elem.data("owl-originalClasses", base.$elem.attr("class"));

base.$elem.css({opacity: 0});

base.orignalItems = base.options.items;

base.checkBrowser();

base.wrapperWidth = 0;

base.checkVisible = null;

base.setVars();

},

setVars : function () {

var base = this;

if (base.$elem.children().length === 0) {return false; }

base.baseClass();

base.eventTypes();

base.$userItems = base.$elem.children();

base.itemsAmount = base.$userItems.length;

base.wrapItems();

base.$owlItems = base.$elem.find(".owl-item");

base.$owlWrapper = base.$elem.find(".owl-wrapper");

base.playDirection = "next";

base.prevItem = 0;

base.prevArr = [0];

base.currentItem = 0;

base.customEvents();

base.onStartup();

},

onStartup : function () {

var base = this;

base.updateItems();

base.calculateAll();

base.buildControls();

base.updateControls();

base.response();

base.moveEvents();

base.stopOnHover();

base.owlStatus();

if (base.options.transitionStyle !== false) {

base.transitionTypes(base.options.transitionStyle);

}

if (base.options.autoPlay === true) {

base.options.autoPlay = 5000;

}

base.play();

base.$elem.find(".owl-wrapper").css("display", "block");

if (!base.$elem.is(":visible")) {

base.watchVisibility();

} else {

base.$elem.css("opacity", 1);

}

base.onstartup = false;

base.eachMoveUpdate();

if (typeof base.options.afterInit === "function") {

base.options.afterInit.apply(this, [base.$elem]);

}

},

eachMoveUpdate : function () {

var base = this;

if (base.options.lazyLoad === true) {

base.lazyLoad();

}

if (base.options.autoHeight === true) {

base.autoHeight();

}

base.onVisibleItems();

if (typeof base.options.afterAction === "function") {

base.options.afterAction.apply(this, [base.$elem]);

}

},

updateVars : function () {

var base = this;

if (typeof base.options.beforeUpdate === "function") {

base.options.beforeUpdate.apply(this, [base.$elem]);

}

base.watchVisibility();

base.updateItems();

base.calculateAll();

base.updatePosition();

base.updateControls();

base.eachMoveUpdate();

if (typeof base.options.afterUpdate === "function") {

base.options.afterUpdate.apply(this, [base.$elem]);

}

},

reload : function () {

var base = this;

window.setTimeout(function () {

base.updateVars();

}, 0);

},

watchVisibility : function () {

var base = this;

if (base.$elem.is(":visible") === false) {

base.$elem.css({opacity: 0});

window.clearInterval(base.autoPlayInterval);

window.clearInterval(base.checkVisible);