language
stringclasses
6 values
original_string
stringlengths
25
887k
text
stringlengths
25
887k
JavaScript
static from(code) { return codes[code] // check if it exists ? new Industry(code) : undefined; }
static from(code) { return codes[code] // check if it exists ? new Industry(code) : undefined; }
JavaScript
static *codes() { for (const code of Object.keys(codes)) { yield Industry.from(code); } }
static *codes() { for (const code of Object.keys(codes)) { yield Industry.from(code); } }
JavaScript
static *sectors() { for (const code of Object.keys(codes)) { if (code.length === Category.Sector) { yield Industry.from(code); } } }
static *sectors() { for (const code of Object.keys(codes)) { if (code.length === Category.Sector) { yield Industry.from(code); } } }
JavaScript
get category() { for (const [name, length] of Object.entries(Category)) { if (this._code.length === length) return name; } }
get category() { for (const [name, length] of Object.entries(Category)) { if (this._code.length === length) return name; } }
JavaScript
children() { return Array.from(Object.keys(codes)) .filter( (code) => code.startsWith(this._code) && // get the industries that start with the same code.length === this._code.length + 1 // digits and whos code is one longer ) .map((code) => Industry.from(code)); }
children() { return Array.from(Object.keys(codes)) .filter( (code) => code.startsWith(this._code) && // get the industries that start with the same code.length === this._code.length + 1 // digits and whos code is one longer ) .map((code) => Industry.from(code)); }
JavaScript
parent() { if (this._code.length !== Category.Sector) { const parentCode = this._code.slice(0, -1); return Industry.from(parentCode); } }
parent() { if (this._code.length !== Category.Sector) { const parentCode = this._code.slice(0, -1); return Industry.from(parentCode); } }
JavaScript
function purge(nozzle, track, layer, start, z, using) { if (extcount < 2) { return start; } let rec = track[nozzle]; if (rec) { track[nozzle] = null; if (layer.last()) layer.last().retract = true; start = print.polyPrintPath(rec.poly.clone().setZ(z), start, layer, { tool: using || nozzle, open: true, simple: true }); layer.last().retract = true; return start; } else { console.log({already_purged: nozzle, from: track, layer}); return start; } }
function purge(nozzle, track, layer, start, z, using) { if (extcount < 2) { return start; } let rec = track[nozzle]; if (rec) { track[nozzle] = null; if (layer.last()) layer.last().retract = true; start = print.polyPrintPath(rec.poly.clone().setZ(z), start, layer, { tool: using || nozzle, open: true, simple: true }); layer.last().retract = true; return start; } else { console.log({already_purged: nozzle, from: track, layer}); return start; } }
JavaScript
function prepare(widgets, settings, update) { let device = settings.device, process = settings.process, print = self.worker.print = KIRI.newPrint(settings, widgets), output = print.output = [], totalSlices = 0, slices = 0; // find max layers (for updates) widgets.forEach(function(widget) { totalSlices += widget.slices.length; }); // emit objects from each slice into output array widgets.forEach(function(widget) { // slice stack merging if (process.outputLaserMerged) { let merged = []; widget.slices.forEach(function(slice) { let polys = []; slice.topPolys().clone(true).forEach(p => p.flattenTo(polys)); polys.forEach(p => { let match = false; for (let i=0; i<merged.length; i++) { let mp = merged[i]; if (p.isEquivalent(mp)) { // increase weight match = true; mp.depth++; } } if (!match) { p.depth = 1; merged.push(p); } }); update((slices++ / totalSlices) * 0.5, "prepare"); }); let start = newPoint(0,0,0); let gather = []; merged.forEach(poly => { print.polyPrintPath(poly, start, gather, { extrude: poly.depth, rate: poly.depth * 10 }); }); output.push(gather); } else { widget.slices.forEach(function(slice) { sliceEmitObjects(print, slice, output); update((slices++ / totalSlices) * 0.5, "prepare"); }); } }); // compute tile width / height output.forEach(function(layerout) { let min = {w:Infinity, h:Infinity}, max = {w:-Infinity, h:-Infinity}, p; layerout.forEach(function(out) { p = out.point; out.point = p.clone(); // b/c first/last point are often shared min.w = Math.min(min.w, p.x); max.w = Math.max(max.w, p.x); min.h = Math.min(min.h, p.y); max.h = Math.max(max.h, p.y); }); layerout.w = max.w - min.w; layerout.h = max.h - min.h; // shift objects to top/left of w/h bounds layerout.forEach(function(out) { p = out.point; p.x -= min.w; p.y -= min.h; }); }); // do object layout packing let i, m, e, MOTO = self.moto, dw = device.bedWidth / 2, dh = device.bedDepth / 2, sort = !process.outputLaserLayer, // sort objects by size when not using laser layer ordering c = sort ? output.sort(MOTO.Sort) : output, p = new MOTO.Pack(dw, dh, process.outputTileSpacing).fit(c, !sort); // test different ratios until packed while (!p.packed) { dw *= 1.1; dh *= 1.1; p = new MOTO.Pack(dw, dh, process.outputTileSpacing).fit(c ,!sort); } for (i = 0; i < c.length; i++) { m = c[i]; m.fit.x += m.w + p.pad; m.fit.y += m.h + p.pad; m.forEach(function(o, i) { // because first point emitted twice (begin/end) e = o.point; e.x += p.max.w / 2 - m.fit.x; e.y += p.max.h / 2 - m.fit.y; // e.z = 0; }); } // if (process.laserKnife) { // console.log({laser_it: output}); // } return print.render = FDM.prepareRender(output, (progress, layer) => { update(0.5 + progress * 0.5, "render", layer); }, { thin: true, z: 0, action: "cut" }); }
function prepare(widgets, settings, update) { let device = settings.device, process = settings.process, print = self.worker.print = KIRI.newPrint(settings, widgets), output = print.output = [], totalSlices = 0, slices = 0; // find max layers (for updates) widgets.forEach(function(widget) { totalSlices += widget.slices.length; }); // emit objects from each slice into output array widgets.forEach(function(widget) { // slice stack merging if (process.outputLaserMerged) { let merged = []; widget.slices.forEach(function(slice) { let polys = []; slice.topPolys().clone(true).forEach(p => p.flattenTo(polys)); polys.forEach(p => { let match = false; for (let i=0; i<merged.length; i++) { let mp = merged[i]; if (p.isEquivalent(mp)) { // increase weight match = true; mp.depth++; } } if (!match) { p.depth = 1; merged.push(p); } }); update((slices++ / totalSlices) * 0.5, "prepare"); }); let start = newPoint(0,0,0); let gather = []; merged.forEach(poly => { print.polyPrintPath(poly, start, gather, { extrude: poly.depth, rate: poly.depth * 10 }); }); output.push(gather); } else { widget.slices.forEach(function(slice) { sliceEmitObjects(print, slice, output); update((slices++ / totalSlices) * 0.5, "prepare"); }); } }); // compute tile width / height output.forEach(function(layerout) { let min = {w:Infinity, h:Infinity}, max = {w:-Infinity, h:-Infinity}, p; layerout.forEach(function(out) { p = out.point; out.point = p.clone(); // b/c first/last point are often shared min.w = Math.min(min.w, p.x); max.w = Math.max(max.w, p.x); min.h = Math.min(min.h, p.y); max.h = Math.max(max.h, p.y); }); layerout.w = max.w - min.w; layerout.h = max.h - min.h; // shift objects to top/left of w/h bounds layerout.forEach(function(out) { p = out.point; p.x -= min.w; p.y -= min.h; }); }); // do object layout packing let i, m, e, MOTO = self.moto, dw = device.bedWidth / 2, dh = device.bedDepth / 2, sort = !process.outputLaserLayer, // sort objects by size when not using laser layer ordering c = sort ? output.sort(MOTO.Sort) : output, p = new MOTO.Pack(dw, dh, process.outputTileSpacing).fit(c, !sort); // test different ratios until packed while (!p.packed) { dw *= 1.1; dh *= 1.1; p = new MOTO.Pack(dw, dh, process.outputTileSpacing).fit(c ,!sort); } for (i = 0; i < c.length; i++) { m = c[i]; m.fit.x += m.w + p.pad; m.fit.y += m.h + p.pad; m.forEach(function(o, i) { // because first point emitted twice (begin/end) e = o.point; e.x += p.max.w / 2 - m.fit.x; e.y += p.max.h / 2 - m.fit.y; // e.z = 0; }); } // if (process.laserKnife) { // console.log({laser_it: output}); // } return print.render = FDM.prepareRender(output, (progress, layer) => { update(0.5 + progress * 0.5, "render", layer); }, { thin: true, z: 0, action: "cut" }); }
JavaScript
function platformGroupDone(skipLayout) { grouping = false; Widget.Groups.loadDone(); if (feature.drop_layout && !skipLayout) platform.layout(); }
function platformGroupDone(skipLayout) { grouping = false; Widget.Groups.loadDone(); if (feature.drop_layout && !skipLayout) platform.layout(); }
JavaScript
function updateFieldsFromSettings(scope) { if (!scope) return console.trace("missing scope"); for (let key in scope) { if (!scope.hasOwnProperty(key)) continue; let val = scope[key]; if (UI.hasOwnProperty(key)) { let uie = UI[key], typ = uie ? uie.type : null; if (typ === 'text') { if (uie.setv) { uie.setv(val); } else { uie.value = val; } } else if (typ === 'checkbox') { uie.checked = val; } else if (typ === 'select-one') { uie.innerHTML = ''; let source = uie.parentNode.getAttribute('source'), list = settings[source] || lists[source], chosen = null; if (list) list.forEach(function(el, index) { let id = el.id || el.name; let ev = el.value || id; if (val == id) { chosen = index; } let opt = DOC.createElement('option'); opt.appendChild(DOC.createTextNode(el.name)); opt.setAttribute('value', ev); uie.appendChild(opt); }); if (chosen) { uie.selectedIndex = chosen; } } else if (typ === 'textarea') { if (Array.isArray(val)) { uie.value = val.join('\n'); } else { uie.value = ''; } } } } }
function updateFieldsFromSettings(scope) { if (!scope) return console.trace("missing scope"); for (let key in scope) { if (!scope.hasOwnProperty(key)) continue; let val = scope[key]; if (UI.hasOwnProperty(key)) { let uie = UI[key], typ = uie ? uie.type : null; if (typ === 'text') { if (uie.setv) { uie.setv(val); } else { uie.value = val; } } else if (typ === 'checkbox') { uie.checked = val; } else if (typ === 'select-one') { uie.innerHTML = ''; let source = uie.parentNode.getAttribute('source'), list = settings[source] || lists[source], chosen = null; if (list) list.forEach(function(el, index) { let id = el.id || el.name; let ev = el.value || id; if (val == id) { chosen = index; } let opt = DOC.createElement('option'); opt.appendChild(DOC.createTextNode(el.name)); opt.setAttribute('value', ev); uie.appendChild(opt); }); if (chosen) { uie.selectedIndex = chosen; } } else if (typ === 'textarea') { if (Array.isArray(val)) { uie.value = val.join('\n'); } else { uie.value = ''; } } } } }
JavaScript
init(source) { this.source = source; this.sourceLength = source.length; this.cursor = 0; this.tokens = []; this.numTokens = 0; this.tokenCursor = 0; }
init(source) { this.source = source; this.sourceLength = source.length; this.cursor = 0; this.tokens = []; this.numTokens = 0; this.tokenCursor = 0; }
JavaScript
tokenize(str) { this.init(str); while (true) { const tk = this.getNextToken(); this.tokens.push(tk); this.numTokens++; if (tk.type === "EOF") break; } }
tokenize(str) { this.init(str); while (true) { const tk = this.getNextToken(); this.tokens.push(tk); this.numTokens++; if (tk.type === "EOF") break; } }
JavaScript
tk(type) { if (this.tokenCursor >= this.numTokens) return null; if (this.tokens[this.tokenCursor].type === type) { const tk = this.tokens[this.tokenCursor]; this.tokenCursor += 1; return tk; } return null; }
tk(type) { if (this.tokenCursor >= this.numTokens) return null; if (this.tokens[this.tokenCursor].type === type) { const tk = this.tokens[this.tokenCursor]; this.tokenCursor += 1; return tk; } return null; }
JavaScript
function modules() { // Bootstrap JS var bootstrapJS = gulp.src('./node_modules/bootstrap/dist/js/*') .pipe(gulp.dest('./vendor/bootstrap/js')); // Bootstrap SCSS var bootstrapSCSS = gulp.src('./node_modules/bootstrap/scss/**/*') .pipe(gulp.dest('./vendor/bootstrap/scss')); // Bootswatch var bootswatch = gulp.src('./node_modules/bootswatch/dist/**/*') .pipe(gulp.dest('./vendor/bootswatch')); // Font Awesome var fontAwesome = gulp.src('./node_modules/@fortawesome/**/*') .pipe(gulp.dest('./vendor')); // Fonts var fontAwesomeFonts = gulp.src('./node_modules/@fortawesome/fontawesome-free/webfonts/*') .pipe(gulp.dest('./webfonts')); // Charts var animateCss = gulp.src('./node_modules/animate.css/*') .pipe(gulp.dest('./vendor/animate')); // Charts var chartJS = gulp.src('./node_modules/chart.js/dist/*.js') .pipe(gulp.dest('./vendor/chart.js')); // dataTables var dataTables = gulp.src([ './node_modules/datatables.net/js/*.js', './node_modules/datatables.net-bs4/js/*.js', './node_modules/datatables.net-bs4/css/*.css' ]) .pipe(gulp.dest('./vendor/datatables')); // jQuery Easing var jqueryEasing = gulp.src('./node_modules/jquery.easing/*.js') .pipe(gulp.dest('./vendor/jquery-easing')); // jQuery Validation var jqueryValidation = gulp.src('./node_modules/jquery-validation/dist/*') .pipe(gulp.dest('./vendor/jquery-validation')); // Composer var popper = gulp.src('./node_modules/@popperjs/core/dist/umd/**/*') .pipe(gulp.dest('./vendor/popper/')); // jQuery var jquery = gulp.src('./node_modules/jquery/dist/*') .pipe(gulp.dest('./vendor/jquery/')); return merge(bootstrapJS, bootstrapSCSS, bootswatch, fontAwesome, fontAwesomeFonts, chartJS, dataTables, jqueryValidation, jqueryEasing, popper, jquery); }
function modules() { // Bootstrap JS var bootstrapJS = gulp.src('./node_modules/bootstrap/dist/js/*') .pipe(gulp.dest('./vendor/bootstrap/js')); // Bootstrap SCSS var bootstrapSCSS = gulp.src('./node_modules/bootstrap/scss/**/*') .pipe(gulp.dest('./vendor/bootstrap/scss')); // Bootswatch var bootswatch = gulp.src('./node_modules/bootswatch/dist/**/*') .pipe(gulp.dest('./vendor/bootswatch')); // Font Awesome var fontAwesome = gulp.src('./node_modules/@fortawesome/**/*') .pipe(gulp.dest('./vendor')); // Fonts var fontAwesomeFonts = gulp.src('./node_modules/@fortawesome/fontawesome-free/webfonts/*') .pipe(gulp.dest('./webfonts')); // Charts var animateCss = gulp.src('./node_modules/animate.css/*') .pipe(gulp.dest('./vendor/animate')); // Charts var chartJS = gulp.src('./node_modules/chart.js/dist/*.js') .pipe(gulp.dest('./vendor/chart.js')); // dataTables var dataTables = gulp.src([ './node_modules/datatables.net/js/*.js', './node_modules/datatables.net-bs4/js/*.js', './node_modules/datatables.net-bs4/css/*.css' ]) .pipe(gulp.dest('./vendor/datatables')); // jQuery Easing var jqueryEasing = gulp.src('./node_modules/jquery.easing/*.js') .pipe(gulp.dest('./vendor/jquery-easing')); // jQuery Validation var jqueryValidation = gulp.src('./node_modules/jquery-validation/dist/*') .pipe(gulp.dest('./vendor/jquery-validation')); // Composer var popper = gulp.src('./node_modules/@popperjs/core/dist/umd/**/*') .pipe(gulp.dest('./vendor/popper/')); // jQuery var jquery = gulp.src('./node_modules/jquery/dist/*') .pipe(gulp.dest('./vendor/jquery/')); return merge(bootstrapJS, bootstrapSCSS, bootswatch, fontAwesome, fontAwesomeFonts, chartJS, dataTables, jqueryValidation, jqueryEasing, popper, jquery); }
JavaScript
function applyFilters(filters, filtersConf) { for (const [key, value] of Object.entries(filters)) { const item = filtersConf[key]; // open filter selector cy.get('div.ins-c-primary-toolbar__filter') .find('button[class=pf-c-dropdown__toggle]') .click({ force: true }); // select appropriate filter cy.get(FILTERS_DROPDOWN).contains(item.selectorText).click({ force: true }); // fill appropriate filter if (item.type === 'input') { cy.get('input.ins-c-conditional-filter').type(value); } else if (item.type === 'checkbox') { cy.get(FILTER_TOGGLE).click({ force: true }); value.forEach((it) => { cy.get('ul[class=pf-c-select__menu]') .find('label') .contains(it) .parent() .find('input[type=checkbox]') .check({ force: true }); }); // close dropdown again cy.get(FILTER_TOGGLE).click({ force: true }); } else if (item.type == 'radio') { cy.get(FILTER_TOGGLE).click({ force: true }); cy.get('ul[class=pf-c-select__menu]') .find('label') .contains(value) .parent() .find('input[type=radio]') .check({ force: true }); } else { throw `${item.type} not recognized`; } } }
function applyFilters(filters, filtersConf) { for (const [key, value] of Object.entries(filters)) { const item = filtersConf[key]; // open filter selector cy.get('div.ins-c-primary-toolbar__filter') .find('button[class=pf-c-dropdown__toggle]') .click({ force: true }); // select appropriate filter cy.get(FILTERS_DROPDOWN).contains(item.selectorText).click({ force: true }); // fill appropriate filter if (item.type === 'input') { cy.get('input.ins-c-conditional-filter').type(value); } else if (item.type === 'checkbox') { cy.get(FILTER_TOGGLE).click({ force: true }); value.forEach((it) => { cy.get('ul[class=pf-c-select__menu]') .find('label') .contains(it) .parent() .find('input[type=checkbox]') .check({ force: true }); }); // close dropdown again cy.get(FILTER_TOGGLE).click({ force: true }); } else if (item.type == 'radio') { cy.get(FILTER_TOGGLE).click({ force: true }); cy.get('ul[class=pf-c-select__menu]') .find('label') .contains(value) .parent() .find('input[type=radio]') .check({ force: true }); } else { throw `${item.type} not recognized`; } } }
JavaScript
function filter(conf, data, filters) { let filteredData = data; for (const [key, value] of Object.entries(filters)) { filteredData = _.filter(filteredData, (it) => conf[key].filterFunc(it, value) ); // if length is already 0, exit if (filteredData.length === 0) { break; } } return filteredData; }
function filter(conf, data, filters) { let filteredData = data; for (const [key, value] of Object.entries(filters)) { filteredData = _.filter(filteredData, (it) => conf[key].filterFunc(it, value) ); // if length is already 0, exit if (filteredData.length === 0) { break; } } return filteredData; }
JavaScript
function showNewMsg(newChild) { var destinatario = newChild.destinatario; var mittente = newChild.mittente; var msg = newChild.msg; if (destinatario == sessionUser) { $('<div class="msg-left">' + msg + '</div>').insertBefore('[rel="' + mittente + '"] .msg_push'); $('.msg_body').scrollTop($('.msg_body')[0].scrollHeight); } }
function showNewMsg(newChild) { var destinatario = newChild.destinatario; var mittente = newChild.mittente; var msg = newChild.msg; if (destinatario == sessionUser) { $('<div class="msg-left">' + msg + '</div>').insertBefore('[rel="' + mittente + '"] .msg_push'); $('.msg_body').scrollTop($('.msg_body')[0].scrollHeight); } }
JavaScript
function send(msg, user) { var msg = msg; $(".msg_input").val(''); if (msg.trim().length != 0) { var chatbox = user; $('<div class="msg-right">' + msg + '</div>').insertBefore('[rel="' + chatbox + '"] .msg_push'); $('.msg_body').scrollTop($('.msg_body')[0].scrollHeight); //Firebase let today = new Date(); let day = today.getDate() + "-" + today.getMonth() + 1 + "-" + today.getYear(); let hour = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); let db = firebase.database(); db.ref("chat").push().set({ mittente: sessionUser, destinatario: chatbox, date: day, ora: hour, msg: msg, letto: false }) } }
function send(msg, user) { var msg = msg; $(".msg_input").val(''); if (msg.trim().length != 0) { var chatbox = user; $('<div class="msg-right">' + msg + '</div>').insertBefore('[rel="' + chatbox + '"] .msg_push'); $('.msg_body').scrollTop($('.msg_body')[0].scrollHeight); //Firebase let today = new Date(); let day = today.getDate() + "-" + today.getMonth() + 1 + "-" + today.getYear(); let hour = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); let db = firebase.database(); db.ref("chat").push().set({ mittente: sessionUser, destinatario: chatbox, date: day, ora: hour, msg: msg, letto: false }) } }
JavaScript
function pubblicaPost() { let tags = ""; let i = 0; tags += "#" + $("#tagtosend" + i).val(); i++; while (i < 5 && $("#tagtosend" + i).val() != "") { tags += ", " + "#" + $("#tagtosend" + i).val(); i++; } let toSend = { tag: tags, post: $("#postContent").val(), email: localStorage.getItem("email") } $.ajax({ type: "POST", url: "/forum/insertpost", data: toSend, success: function (done) { location.href = "./forum.html"; } }) }
function pubblicaPost() { let tags = ""; let i = 0; tags += "#" + $("#tagtosend" + i).val(); i++; while (i < 5 && $("#tagtosend" + i).val() != "") { tags += ", " + "#" + $("#tagtosend" + i).val(); i++; } let toSend = { tag: tags, post: $("#postContent").val(), email: localStorage.getItem("email") } $.ajax({ type: "POST", url: "/forum/insertpost", data: toSend, success: function (done) { location.href = "./forum.html"; } }) }
JavaScript
function sendAnswer() { timestamp = dateFormat(); let toSend = { data: timestamp.data, ora: timestamp.ora, risposta: $("#messaggio").val(), idp: $("#needId").val(), email: localStorage.getItem("email") } $.ajax({ type: "POST", url: "/forum/insertreply", data: toSend, success: function (done) { location.href = "./forum.html"; } }) }
function sendAnswer() { timestamp = dateFormat(); let toSend = { data: timestamp.data, ora: timestamp.ora, risposta: $("#messaggio").val(), idp: $("#needId").val(), email: localStorage.getItem("email") } $.ajax({ type: "POST", url: "/forum/insertreply", data: toSend, success: function (done) { location.href = "./forum.html"; } }) }
JavaScript
function dynStart(account) { API.start() const { Hive } = require('./hive') Hive.getOwners(config.msaccount).then(oa =>{ console.log('Starting URL: ', config.startURL) let consensus_init = { accounts: oa, reports: [], hash: {}, start: false, first: config.engineCrank } for(i in oa){ consensus_init.reports.push(Hive.getRecentReport(oa[i][0], walletOperationsBitmask)) } Promise.all(consensus_init.reports).then(r =>{ for(i = 0; i < r.length; i++){ if (!consensus_init.first && r[i]) { consensus_init.first = r[i][0]; } if (r[i] && consensus_init.hash[r[i][0]]) { consensus_init.hash[r[i][0]]++ } else if (r[i]) { consensus_init.hash[r[i][0]] = 1 } } for (var i in consensus_init.hash) { if (consensus_init.hash[i] > consensus_init.reports.length/2) { console.log('Starting with: ', i) startWith(i, true) consensus_init.start = true break } } if(!consensus_init.start){ console.log('Starting with: ', consensus_init.first) startWith(consensus_init.first, false) } }) }) }
function dynStart(account) { API.start() const { Hive } = require('./hive') Hive.getOwners(config.msaccount).then(oa =>{ console.log('Starting URL: ', config.startURL) let consensus_init = { accounts: oa, reports: [], hash: {}, start: false, first: config.engineCrank } for(i in oa){ consensus_init.reports.push(Hive.getRecentReport(oa[i][0], walletOperationsBitmask)) } Promise.all(consensus_init.reports).then(r =>{ for(i = 0; i < r.length; i++){ if (!consensus_init.first && r[i]) { consensus_init.first = r[i][0]; } if (r[i] && consensus_init.hash[r[i][0]]) { consensus_init.hash[r[i][0]]++ } else if (r[i]) { consensus_init.hash[r[i][0]] = 1 } } for (var i in consensus_init.hash) { if (consensus_init.hash[i] > consensus_init.reports.length/2) { console.log('Starting with: ', i) startWith(i, true) consensus_init.start = true break } } if(!consensus_init.start){ console.log('Starting with: ', consensus_init.first) startWith(consensus_init.first, false) } }) }) }
JavaScript
assignColor(col) { let back, light, dark; if (col === 'green') { back = '--color-background-short'; light = '--color-light-short'; dark = '--color-dark-short'; console.log('back green'); } if (col === 'red') { back = '--color-background-pom'; light = '--color-light-pom'; dark = '--color-dark-pom'; console.log('back red'); } if (col === 'blue') { back = '--color-background-long'; light = '--color-light-long'; dark = '--color-dark-long'; console.log('back blue'); } const backColor = getComputedStyle(document.documentElement) .getPropertyValue(back); const lightColor = getComputedStyle(document.documentElement) .getPropertyValue(light); const darkColor = getComputedStyle(document.documentElement) .getPropertyValue(dark); //setting colors (needed when starting CSS animations ~KEYFRAME 0) function setBackGround() { document.body.style.backgroundColor = backColor; this.label.style.backgroundColor = lightColor; document.querySelectorAll('.btn').forEach(element => element.style.backgroundColor = lightColor); document.querySelector('#btn-task').style.backgroundColor = lightColor; document.querySelector('#add-task').style.backgroundColor = darkColor; //set also the color for the start/stop button document.querySelector('#start').style.color = lightColor; //ruler's color document.querySelector('#ruler').style.backgroundColor = darkColor; } setTimeout(setBackGround, 1000); }
assignColor(col) { let back, light, dark; if (col === 'green') { back = '--color-background-short'; light = '--color-light-short'; dark = '--color-dark-short'; console.log('back green'); } if (col === 'red') { back = '--color-background-pom'; light = '--color-light-pom'; dark = '--color-dark-pom'; console.log('back red'); } if (col === 'blue') { back = '--color-background-long'; light = '--color-light-long'; dark = '--color-dark-long'; console.log('back blue'); } const backColor = getComputedStyle(document.documentElement) .getPropertyValue(back); const lightColor = getComputedStyle(document.documentElement) .getPropertyValue(light); const darkColor = getComputedStyle(document.documentElement) .getPropertyValue(dark); //setting colors (needed when starting CSS animations ~KEYFRAME 0) function setBackGround() { document.body.style.backgroundColor = backColor; this.label.style.backgroundColor = lightColor; document.querySelectorAll('.btn').forEach(element => element.style.backgroundColor = lightColor); document.querySelector('#btn-task').style.backgroundColor = lightColor; document.querySelector('#add-task').style.backgroundColor = darkColor; //set also the color for the start/stop button document.querySelector('#start').style.color = lightColor; //ruler's color document.querySelector('#ruler').style.backgroundColor = darkColor; } setTimeout(setBackGround, 1000); }
JavaScript
function longBreak(){ const breakObj = new BreakClass('long break', 'blue', '15:00'); breakObj.render(); const ico = 'https://ghcdn.rawgit.org/bermarte/pomofocus/main/public/imgs/long_favicon-16x16.png'; const setIco = new Ico(ico); setIco.render(); document.title = `15:00 - Time to work!`; }
function longBreak(){ const breakObj = new BreakClass('long break', 'blue', '15:00'); breakObj.render(); const ico = 'https://ghcdn.rawgit.org/bermarte/pomofocus/main/public/imgs/long_favicon-16x16.png'; const setIco = new Ico(ico); setIco.render(); document.title = `15:00 - Time to work!`; }
JavaScript
function shortBreak(){ const breakObj = new BreakClass('short break', 'green', '05:00'); breakObj.render(); const ico = 'https://ghcdn.rawgit.org/bermarte/pomofocus/main/public/imgs/short_favicon-16x16.png'; const setIco = new Ico(ico); setIco.render(); document.title = `05:00 - Time to work!`; }
function shortBreak(){ const breakObj = new BreakClass('short break', 'green', '05:00'); breakObj.render(); const ico = 'https://ghcdn.rawgit.org/bermarte/pomofocus/main/public/imgs/short_favicon-16x16.png'; const setIco = new Ico(ico); setIco.render(); document.title = `05:00 - Time to work!`; }
JavaScript
function pomBreak(){ const breakObj = new BreakClass('pomo break', 'red', '25:00'); breakObj.render(); const setIco = new Ico(ico); setIco.render(); document.title = `25:00 - Time to work!`; }
function pomBreak(){ const breakObj = new BreakClass('pomo break', 'red', '25:00'); breakObj.render(); const setIco = new Ico(ico); setIco.render(); document.title = `25:00 - Time to work!`; }
JavaScript
function moveText(btn){ const property = document.querySelector(btn); //move the item 4px down property.style.position = "relative"; property.style.top = "4px"; }
function moveText(btn){ const property = document.querySelector(btn); //move the item 4px down property.style.position = "relative"; property.style.top = "4px"; }
JavaScript
sight(selector) { const r = [] for (let i = 0; i < this.length; i++) { const tg = this.elems[i] if (tg === tg.parentElement.querySelector(selector)) r.push(tg) } return r }
sight(selector) { const r = [] for (let i = 0; i < this.length; i++) { const tg = this.elems[i] if (tg === tg.parentElement.querySelector(selector)) r.push(tg) } return r }
JavaScript
parents(selector) { const r = [] let parent = this.elem.parentElement while (parent.parentElement) { if (!selector) { r.push(parent) } else { if (parent.parentElement.querySelector(selector) === parent) r.push(parent) } parent = parent.parentElement } this.elems = r this.elem = r[0] return this }
parents(selector) { const r = [] let parent = this.elem.parentElement while (parent.parentElement) { if (!selector) { r.push(parent) } else { if (parent.parentElement.querySelector(selector) === parent) r.push(parent) } parent = parent.parentElement } this.elems = r this.elem = r[0] return this }
JavaScript
hasClass(...clses) { const target = this.elem for (let i = 0; i < clses.length; i++) if (!target.classList.contains(clses[i])) return false return true }
hasClass(...clses) { const target = this.elem for (let i = 0; i < clses.length; i++) if (!target.classList.contains(clses[i])) return false return true }
JavaScript
pop() { this._key-- const lastItem = this._storage[this._key] delete this._storage[this._key] return lastItem }
pop() { this._key-- const lastItem = this._storage[this._key] delete this._storage[this._key] return lastItem }
JavaScript
insert(value) { const node = {value, next: null}; this.tail.next = node; this.tail = node; }
insert(value) { const node = {value, next: null}; this.tail.next = node; this.tail = node; }
JavaScript
contains(value) { let currentNode = this.head; while (currentNode.value !== value) { currentNode = currentNode.next; } return currentNode.value === value; }
contains(value) { let currentNode = this.head; while (currentNode.value !== value) { currentNode = currentNode.next; } return currentNode.value === value; }
JavaScript
function handleLaunchParam() { var callerName = handleLaunchParam.caller && (handleLaunchParam.caller.displayName || handleLaunchParam.caller.name); this.log("called by: “" + callerName + "”"); setTimeout(this.processParams.bind(this), 0); }
function handleLaunchParam() { var callerName = handleLaunchParam.caller && (handleLaunchParam.caller.displayName || handleLaunchParam.caller.name); this.log("called by: “" + callerName + "”"); setTimeout(this.processParams.bind(this), 0); }
JavaScript
function createNotification(msg, contactName, threadId) { return PalmCall.call("palm://org.webosports.notifications", "create", { ownerId: "org.webosports.service.messaging", launchId: "org.webosports.app.messaging", launchParams: {threadId: threadId }, //Seems the messaging app does not support this, yet. title: contactName, body: msg.messageText, iconUrl: "file:///usr/palm/applications/org.webosports.app.messaging/icon.png", soundClass: "notifications", soundFile: "", duration: -1, doNotSuppress: false, expireTimeout: 5 }).then(function notificationDone(f) { if (f.exception) { Log.log("notification call had error: " + JSON.stringify(f.exception)); } else { var result = f.result; Log.debug("notification call came back: " + JSON.stringify(result)); f.result = result; } }); }
function createNotification(msg, contactName, threadId) { return PalmCall.call("palm://org.webosports.notifications", "create", { ownerId: "org.webosports.service.messaging", launchId: "org.webosports.app.messaging", launchParams: {threadId: threadId }, //Seems the messaging app does not support this, yet. title: contactName, body: msg.messageText, iconUrl: "file:///usr/palm/applications/org.webosports.app.messaging/icon.png", soundClass: "notifications", soundFile: "", duration: -1, doNotSuppress: false, expireTimeout: 5 }).then(function notificationDone(f) { if (f.exception) { Log.log("notification call had error: " + JSON.stringify(f.exception)); } else { var result = f.result; Log.debug("notification call came back: " + JSON.stringify(result)); f.result = result; } }); }
JavaScript
function findPerson(msg, address) { var future = new Future(); if (msg.serviceName === "sms" || msg.serviceName === "mms") { future.nest(Contacts.Person.findByPhone(address, { includeMatchingItem: false, returnAllMatches: false })); } else { future.nest(Contacts.Person.findByIM(address, msg.serviceName, { includeMatchingItem: false, returnAllMatches: false })); } return future; }
function findPerson(msg, address) { var future = new Future(); if (msg.serviceName === "sms" || msg.serviceName === "mms") { future.nest(Contacts.Person.findByPhone(address, { includeMatchingItem: false, returnAllMatches: false })); } else { future.nest(Contacts.Person.findByIM(address, msg.serviceName, { includeMatchingItem: false, returnAllMatches: false })); } return future; }
JavaScript
function updateChatthread(msg, person, future) { if (!person) { person = {}; } var result = checkResult(future), chatthread = { unreadCount: 0, flags: {}, _kind: "com.palm.chatthread:1"}; Log.debug("Get chatthread result: ", result); if (result.returnValue === true && result.results && result.results.length > 0) { if (result.results.length > 1) { //multiple threads. What to do? Probably something not right? :-/ console.warn("Multiple chatthreads found. Will only use first one."); } chatthread = result.results[0]; } chatthread.displayName = person.name || chatthread.displayName; if (!chatthread.flags) { chatthread.flags = {}; } chatthread.personId = person.personId || chatthread.personId; chatthread.flags.visible = true; //have new message. chatthread.normalizedAddress = person.normalizedAddress || chatthread.normalizedAddress; chatthread.replyAddress = person.address || chatthread.replyAddress; chatthread.replyService = msg.serviceName; chatthread.summary = msg.messageText; chatthread.timestamp = msg.localTimestamp || Date.now(); if (msg.folder === "inbox" && (!msg.flags || (!msg.flags.read && msg.flags.visible))) { chatthread.unreadCount += 1; } Log.debug("Result chatthread to write into db: ", chatthread); future.nest(DB.merge([chatthread])); }
function updateChatthread(msg, person, future) { if (!person) { person = {}; } var result = checkResult(future), chatthread = { unreadCount: 0, flags: {}, _kind: "com.palm.chatthread:1"}; Log.debug("Get chatthread result: ", result); if (result.returnValue === true && result.results && result.results.length > 0) { if (result.results.length > 1) { //multiple threads. What to do? Probably something not right? :-/ console.warn("Multiple chatthreads found. Will only use first one."); } chatthread = result.results[0]; } chatthread.displayName = person.name || chatthread.displayName; if (!chatthread.flags) { chatthread.flags = {}; } chatthread.personId = person.personId || chatthread.personId; chatthread.flags.visible = true; //have new message. chatthread.normalizedAddress = person.normalizedAddress || chatthread.normalizedAddress; chatthread.replyAddress = person.address || chatthread.replyAddress; chatthread.replyService = msg.serviceName; chatthread.summary = msg.messageText; chatthread.timestamp = msg.localTimestamp || Date.now(); if (msg.folder === "inbox" && (!msg.flags || (!msg.flags.read && msg.flags.visible))) { chatthread.unreadCount += 1; } Log.debug("Result chatthread to write into db: ", chatthread); future.nest(DB.merge([chatthread])); }
JavaScript
function logoSizeOnSmallScreens(){ "use strict"; // 100 is height of header on small screens if((100 - 20 < logo_height)){ $j('.q_logo a').height(100 - 20); }else{ $j('.q_logo a').height(logo_height); } $j('.q_logo a img').css('height','100%'); $j('header.page_header').removeClass('sticky_animate sticky'); $j('.content').css('padding-top','0px'); }
function logoSizeOnSmallScreens(){ "use strict"; // 100 is height of header on small screens if((100 - 20 < logo_height)){ $j('.q_logo a').height(100 - 20); }else{ $j('.q_logo a').height(logo_height); } $j('.q_logo a img').css('height','100%'); $j('header.page_header').removeClass('sticky_animate sticky'); $j('.content').css('padding-top','0px'); }
JavaScript
function contentMinHeightWithPaspartu(){ "use strict"; if ($j('.paspartu_enabled').length) { var content_height; var paspartu_final_width_px = 0; var paspartu_width_px = $window_width*paspartu_width; var footer_height = $j('footer').height(); if ($j('.disable_footer').length){ footer_height = 0; } if ($j('.vertical_menu_enabled').length){ if ($j('.paspartu_top').length && $j('.paspartu_middle_inner').length){ paspartu_final_width_px += paspartu_width_px; } } else { if ($j('.paspartu_top').length){ paspartu_final_width_px += paspartu_width_px; } } if ($j('.paspartu_bottom').length || !$j('.disable_bottom_paspartu').length){ paspartu_final_width_px += paspartu_width_px; } if ($j('.vertical_menu_enabled').length){ content_height = $window_height - paspartu_final_width_px - footer_height; } else { if($j('header .header_bottom').length){ var headerColorString = $j('header .header_bottom').css('background-color'); } if($j('header .bottom_header').length){ var headerColorString = $j('header .bottom_header').css('background-color'); } if( typeof headerColorString !== 'undefined' ){ var headerTransparency = headerColorString.substring(headerColorString.indexOf('(') + 1, headerColorString.lastIndexOf(')')).split(/,\s*/)[3]; } var header_height = headerTransparency == undefined && !$j('header.page_header').hasClass('transparent') ? $j('header.page_header').height() : 0; content_height = $window_height - header_height - paspartu_final_width_px - footer_height; } if($j('.content').length){ $j('.content').css('min-height',content_height); } } }
function contentMinHeightWithPaspartu(){ "use strict"; if ($j('.paspartu_enabled').length) { var content_height; var paspartu_final_width_px = 0; var paspartu_width_px = $window_width*paspartu_width; var footer_height = $j('footer').height(); if ($j('.disable_footer').length){ footer_height = 0; } if ($j('.vertical_menu_enabled').length){ if ($j('.paspartu_top').length && $j('.paspartu_middle_inner').length){ paspartu_final_width_px += paspartu_width_px; } } else { if ($j('.paspartu_top').length){ paspartu_final_width_px += paspartu_width_px; } } if ($j('.paspartu_bottom').length || !$j('.disable_bottom_paspartu').length){ paspartu_final_width_px += paspartu_width_px; } if ($j('.vertical_menu_enabled').length){ content_height = $window_height - paspartu_final_width_px - footer_height; } else { if($j('header .header_bottom').length){ var headerColorString = $j('header .header_bottom').css('background-color'); } if($j('header .bottom_header').length){ var headerColorString = $j('header .bottom_header').css('background-color'); } if( typeof headerColorString !== 'undefined' ){ var headerTransparency = headerColorString.substring(headerColorString.indexOf('(') + 1, headerColorString.lastIndexOf(')')).split(/,\s*/)[3]; } var header_height = headerTransparency == undefined && !$j('header.page_header').hasClass('transparent') ? $j('header.page_header').height() : 0; content_height = $window_height - header_height - paspartu_final_width_px - footer_height; } if($j('.content').length){ $j('.content').css('min-height',content_height); } } }
JavaScript
function calculateHeights(){ if($j('.portfolio_slides').length){ $j('.portfolio_slides').each(function(){ $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('li.item').outerHeight()-3) + 'px'}); //3 is because of the white line bellow the slider }); } if($j('.qode_carousels .slides').length){ $j('.qode_carousels .slides').each(function(){ $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('li.item').outerHeight()) + 'px'}); }); } if($j('.blog_slides').length){ $j('.blog_slides').each(function(){ $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('li.item').outerHeight()-3) + 'px'}); }); } if($j('.qode-bct-posts').length){ $j('.qode-bct-posts').each(function(){ $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('.qode-bct-post').outerHeight()) + 'px'}); }); } }
function calculateHeights(){ if($j('.portfolio_slides').length){ $j('.portfolio_slides').each(function(){ $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('li.item').outerHeight()-3) + 'px'}); //3 is because of the white line bellow the slider }); } if($j('.qode_carousels .slides').length){ $j('.qode_carousels .slides').each(function(){ $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('li.item').outerHeight()) + 'px'}); }); } if($j('.blog_slides').length){ $j('.blog_slides').each(function(){ $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('li.item').outerHeight()-3) + 'px'}); }); } if($j('.qode-bct-posts').length){ $j('.qode-bct-posts').each(function(){ $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('.qode-bct-post').outerHeight()) + 'px'}); }); } }
JavaScript
function initVerticalMobileMenu(){ "use strict"; if ($j('.vertical_menu_toggle').length) { //register tap / click event for main menu item plus icon $j('.touch .vertical_menu_toggle > ul > li.has_sub > a .plus').on('tap click', function(e){ //first prevent event propagation and it's default behavior e.stopPropagation(); e.preventDefault(); //is dropdown for clicked item visible? if($j(this).parent().next('div.second').is(":visible")){ //if it is remove 'open' class and slide it up $j(this).parents('.touch .vertical_menu_toggle > ul > li.has_sub').removeClass('open'); $j(this).parent().next('div.second').slideUp(200); } else { //if it's not visible add 'open' class and slide it down $j(this).parents('.touch .vertical_menu_toggle > ul > li.has_sub').addClass('open'); $j(this).parent().next('div.second').slideDown(200); } }); //register tap / click event for second level main menu item plus icon $j('.touch .vertical_menu_toggle ul li ul li > a .plus').on('tap click', function(e){ //first prevent event propagation and it's default behavior e.stopPropagation(); e.preventDefault(); //is dropdown for clicked item visible? if($j(this).parent().next('ul').is(":visible")){ //if it is remove 'open' class and slide it up $j(this).parents('.touch .vertical_menu_toggle ul li ul li').removeClass('open'); $j(this).parent().next('ul').slideUp(200); } else { //if it's not visible add 'open' class and slide it down $j(this).parents('.touch .vertical_menu_toggle ul li ul li').addClass('open'); $j(this).parent().next('ul').slideDown(200); } }); } else if ($j('.vertical_menu_float').length){ $j('.touch .vertical_menu_float > ul > li.has_sub > a .plus').on('tap click', function(e){ //first prevent event propagation and it's default behavior e.stopPropagation(); e.preventDefault(); //is dropdown for clicked item visible? if($j(this).parent().next('div.second').hasClass('vertical_menu_start')){ //if it is remove 'open' class and 'vertical_menu_start' $j(this).parents('.touch .vertical_menu_float > ul > li.has_sub').removeClass('open'); $j(this).parents('.touch .vertical_menu_float > ul > li.has_sub').find('.second').removeClass('vertical_menu_start'); } else { //if it's not visible add 'open' class and 'vertical_menu_start' $j(this).parents('.touch .vertical_menu_float > ul > li.has_sub').addClass('open'); $j(this).parents('.touch .vertical_menu_float > ul > li.has_sub').find('.second').addClass('vertical_menu_start'); } }); //register tap / click event for second level main menu item plus icon $j('.touch .vertical_menu_float ul li ul li > a .plus').on('tap click', function(e){ //first prevent event propagation and it's default behavior e.stopPropagation(); e.preventDefault(); //is dropdown for clicked item visible? if($j(this).parent().next('ul').hasClass('vertical_submenu_start')){ //if it is remove 'open' class and slide it up $j(this).parents('.touch .vertical_menu_float ul li ul li').removeClass('open'); $j(this).parents('.touch .vertical_menu_float ul li ul li').find('ul').removeClass('vertical_submenu_start'); } else { //if it's not visible add 'open' class and slide it down $j(this).parents('.touch .vertical_menu_float ul li ul li').addClass('open'); $j(this).parents('.touch .vertical_menu_float ul li ul li').find('ul').addClass('vertical_submenu_start'); } }); } }
function initVerticalMobileMenu(){ "use strict"; if ($j('.vertical_menu_toggle').length) { //register tap / click event for main menu item plus icon $j('.touch .vertical_menu_toggle > ul > li.has_sub > a .plus').on('tap click', function(e){ //first prevent event propagation and it's default behavior e.stopPropagation(); e.preventDefault(); //is dropdown for clicked item visible? if($j(this).parent().next('div.second').is(":visible")){ //if it is remove 'open' class and slide it up $j(this).parents('.touch .vertical_menu_toggle > ul > li.has_sub').removeClass('open'); $j(this).parent().next('div.second').slideUp(200); } else { //if it's not visible add 'open' class and slide it down $j(this).parents('.touch .vertical_menu_toggle > ul > li.has_sub').addClass('open'); $j(this).parent().next('div.second').slideDown(200); } }); //register tap / click event for second level main menu item plus icon $j('.touch .vertical_menu_toggle ul li ul li > a .plus').on('tap click', function(e){ //first prevent event propagation and it's default behavior e.stopPropagation(); e.preventDefault(); //is dropdown for clicked item visible? if($j(this).parent().next('ul').is(":visible")){ //if it is remove 'open' class and slide it up $j(this).parents('.touch .vertical_menu_toggle ul li ul li').removeClass('open'); $j(this).parent().next('ul').slideUp(200); } else { //if it's not visible add 'open' class and slide it down $j(this).parents('.touch .vertical_menu_toggle ul li ul li').addClass('open'); $j(this).parent().next('ul').slideDown(200); } }); } else if ($j('.vertical_menu_float').length){ $j('.touch .vertical_menu_float > ul > li.has_sub > a .plus').on('tap click', function(e){ //first prevent event propagation and it's default behavior e.stopPropagation(); e.preventDefault(); //is dropdown for clicked item visible? if($j(this).parent().next('div.second').hasClass('vertical_menu_start')){ //if it is remove 'open' class and 'vertical_menu_start' $j(this).parents('.touch .vertical_menu_float > ul > li.has_sub').removeClass('open'); $j(this).parents('.touch .vertical_menu_float > ul > li.has_sub').find('.second').removeClass('vertical_menu_start'); } else { //if it's not visible add 'open' class and 'vertical_menu_start' $j(this).parents('.touch .vertical_menu_float > ul > li.has_sub').addClass('open'); $j(this).parents('.touch .vertical_menu_float > ul > li.has_sub').find('.second').addClass('vertical_menu_start'); } }); //register tap / click event for second level main menu item plus icon $j('.touch .vertical_menu_float ul li ul li > a .plus').on('tap click', function(e){ //first prevent event propagation and it's default behavior e.stopPropagation(); e.preventDefault(); //is dropdown for clicked item visible? if($j(this).parent().next('ul').hasClass('vertical_submenu_start')){ //if it is remove 'open' class and slide it up $j(this).parents('.touch .vertical_menu_float ul li ul li').removeClass('open'); $j(this).parents('.touch .vertical_menu_float ul li ul li').find('ul').removeClass('vertical_submenu_start'); } else { //if it's not visible add 'open' class and slide it down $j(this).parents('.touch .vertical_menu_float ul li ul li').addClass('open'); $j(this).parents('.touch .vertical_menu_float ul li ul li').find('ul').addClass('vertical_submenu_start'); } }); } }
JavaScript
function checkVerticalMenuTransparency(){ if($scroll !== 0){ $j('body.vertical_menu_transparency').removeClass('vertical_menu_transparency_on'); }else{ $j('body.vertical_menu_transparency').addClass('vertical_menu_transparency_on'); } }
function checkVerticalMenuTransparency(){ if($scroll !== 0){ $j('body.vertical_menu_transparency').removeClass('vertical_menu_transparency_on'); }else{ $j('body.vertical_menu_transparency').addClass('vertical_menu_transparency_on'); } }
JavaScript
function showHideVerticalMenu(){ if($j('.vertical_menu_hidden').length) { var vertical_menu = $j('aside.vertical_menu_area'); var vertical_menu_bottom_logo = $j('.vertical_menu_area_bottom_logo'); var hovered_flag = true; $j('.vertical_menu_hidden_button').on('click',function (e) { e.preventDefault(); if(hovered_flag) { hovered_flag = false; current_scroll = $j(window).scrollTop(); //current scroll is defined in front of "initSideMenu" function vertical_menu.addClass('active'); vertical_menu_bottom_logo.addClass('active'); }else{ hovered_flag = true; vertical_menu.removeClass('active'); vertical_menu_bottom_logo.removeClass('active'); } }); $j(window).scroll(function() { if(Math.abs($scroll - current_scroll) > 400){ hovered_flag = true; vertical_menu.removeClass('active'); vertical_menu_bottom_logo.removeClass('active'); } }); //take click outside vertical left/rifgt area and close it (function() { var Outclick, outclick, _this = this; Outclick = (function() { Outclick.name = 'Outclick'; function Outclick() { this.objects = []; } Outclick.prototype.check = function(element, event) { return !element.is(event.target) && element.has(event.target).length === 0; }; Outclick.prototype.trigger = function(e) { var execute, _this = this; execute = false; return $j.each(this.objects, function(index, el) { if (_this.check(el.container, e)) { if (el.related.length < 1) { execute = true; } else { $j.each(el.related, function(index, relation) { if (_this.check(relation, e)) { return execute = true; } else { execute = false; return false; } }); } if (execute) { return el.callback.call(el.container); } } }); }; return Outclick; })(); outclick = new Outclick; $j.fn.outclick = function(options) { var _this = this; if (options == null) { options = {}; } options.related || (options.related = []); options.callback || (options.callback = function() { return _this.hide(); }); return outclick.objects.push({ container: this, related: options.related, callback: options.callback }); }; $j(document).mouseup(function(e) { return outclick.trigger(e); }); }).call(this); $j(vertical_menu).outclick({ callback: function() { hovered_flag = true; vertical_menu.removeClass('active'); vertical_menu_bottom_logo.removeClass('active'); } }); } }
function showHideVerticalMenu(){ if($j('.vertical_menu_hidden').length) { var vertical_menu = $j('aside.vertical_menu_area'); var vertical_menu_bottom_logo = $j('.vertical_menu_area_bottom_logo'); var hovered_flag = true; $j('.vertical_menu_hidden_button').on('click',function (e) { e.preventDefault(); if(hovered_flag) { hovered_flag = false; current_scroll = $j(window).scrollTop(); //current scroll is defined in front of "initSideMenu" function vertical_menu.addClass('active'); vertical_menu_bottom_logo.addClass('active'); }else{ hovered_flag = true; vertical_menu.removeClass('active'); vertical_menu_bottom_logo.removeClass('active'); } }); $j(window).scroll(function() { if(Math.abs($scroll - current_scroll) > 400){ hovered_flag = true; vertical_menu.removeClass('active'); vertical_menu_bottom_logo.removeClass('active'); } }); //take click outside vertical left/rifgt area and close it (function() { var Outclick, outclick, _this = this; Outclick = (function() { Outclick.name = 'Outclick'; function Outclick() { this.objects = []; } Outclick.prototype.check = function(element, event) { return !element.is(event.target) && element.has(event.target).length === 0; }; Outclick.prototype.trigger = function(e) { var execute, _this = this; execute = false; return $j.each(this.objects, function(index, el) { if (_this.check(el.container, e)) { if (el.related.length < 1) { execute = true; } else { $j.each(el.related, function(index, relation) { if (_this.check(relation, e)) { return execute = true; } else { execute = false; return false; } }); } if (execute) { return el.callback.call(el.container); } } }); }; return Outclick; })(); outclick = new Outclick; $j.fn.outclick = function(options) { var _this = this; if (options == null) { options = {}; } options.related || (options.related = []); options.callback || (options.callback = function() { return _this.hide(); }); return outclick.objects.push({ container: this, related: options.related, callback: options.callback }); }; $j(document).mouseup(function(e) { return outclick.trigger(e); }); }).call(this); $j(vertical_menu).outclick({ callback: function() { hovered_flag = true; vertical_menu.removeClass('active'); vertical_menu_bottom_logo.removeClass('active'); } }); } }
JavaScript
function initToCounter(){ "use strict"; if($j('.counter.zero').length){ $j('.counter.zero').each(function() { var parent = $j(this).parent(); var axis = 100; if(typeof parent.data('element-appearance') !== 'undefined' && parent.data('element-appearance') !== false) { axis = parent.data('element-appearance'); } if(!$j(this).hasClass('executed')){ $j(this).addClass('executed'); if($j(this).parents('.vertical_split_slider').length){ $j(this).parent().css('opacity', '1'); var $max = parseFloat($j(this).text()); $j(this).countTo({ from: 0, to: $max, speed: 1500, refreshInterval: 100 }); } else{ $j(this).appear(function() { $j(this).parent().css('opacity', '1'); var $max = parseFloat($j(this).text()); $j(this).countTo({ from: 0, to: $max, speed: 1500, refreshInterval: 100 }); },{accX: 0, accY: -axis}); } } }); } }
function initToCounter(){ "use strict"; if($j('.counter.zero').length){ $j('.counter.zero').each(function() { var parent = $j(this).parent(); var axis = 100; if(typeof parent.data('element-appearance') !== 'undefined' && parent.data('element-appearance') !== false) { axis = parent.data('element-appearance'); } if(!$j(this).hasClass('executed')){ $j(this).addClass('executed'); if($j(this).parents('.vertical_split_slider').length){ $j(this).parent().css('opacity', '1'); var $max = parseFloat($j(this).text()); $j(this).countTo({ from: 0, to: $max, speed: 1500, refreshInterval: 100 }); } else{ $j(this).appear(function() { $j(this).parent().css('opacity', '1'); var $max = parseFloat($j(this).text()); $j(this).countTo({ from: 0, to: $max, speed: 1500, refreshInterval: 100 }); },{accX: 0, accY: -axis}); } } }); } }
JavaScript
function initToCounterHorizontalProgressBar($this){ "use strict"; var percentage = parseFloat($this.find('.progress_content').data('percentage')); if($this.find('.progress_number span').length) { $this.find('.progress_number span').each(function() { $j(this).parents('.progress_number_wrapper').css('opacity', '1'); $j(this).countTo({ from: 0, to: percentage, speed: 1500, refreshInterval: 50 }); }); } }
function initToCounterHorizontalProgressBar($this){ "use strict"; var percentage = parseFloat($this.find('.progress_content').data('percentage')); if($this.find('.progress_number span').length) { $this.find('.progress_number span').each(function() { $j(this).parents('.progress_number_wrapper').css('opacity', '1'); $j(this).countTo({ from: 0, to: percentage, speed: 1500, refreshInterval: 50 }); }); } }
JavaScript
function initToCounterPieChart($this){ "use strict"; $j($this).css('opacity', '1'); var $max = parseFloat($j($this).find('.tocounter').text()); $j($this).find('.tocounter').countTo({ from: 0, to: $max, speed: 1500, refreshInterval: 50 }); }
function initToCounterPieChart($this){ "use strict"; $j($this).css('opacity', '1'); var $max = parseFloat($j($this).find('.tocounter').text()); $j($this).find('.tocounter').countTo({ from: 0, to: $max, speed: 1500, refreshInterval: 50 }); }
JavaScript
function initPortfolioZIndex(){ "use strict"; if($j('.projects_holder_outer.portfolio_no_space').length){ $j('.no_space.hover_text article').each(function(i){ $j(this).css('z-index', i +10); }); } }
function initPortfolioZIndex(){ "use strict"; if($j('.projects_holder_outer.portfolio_no_space').length){ $j('.no_space.hover_text article').each(function(i){ $j(this).css('z-index', i +10); }); } }
JavaScript
function qodeInitPortFilterCounter(container){ if(container.hasClass('portfolio_holder_fwn')){ var articles = (container.find('article')); var filters = (container.find('.filter_holder ul li')); filters.each(function(){ var item = $j(this); if((item).data('filter') == 'all' || (item).data('filter') == '*'){ updateResult(item,".filter_number_of_items", articles.length); } else{ var categoryClass = item.attr('data-filter'); categoryClass = categoryClass.replace(/\./g, ''); updateResult(item,".filter_number_of_items", container.find('article.'+categoryClass).length); } }); filters.css('opacity','1'); } function updateResult(item, pos ,value){ item.find(pos).text(value); } }
function qodeInitPortFilterCounter(container){ if(container.hasClass('portfolio_holder_fwn')){ var articles = (container.find('article')); var filters = (container.find('.filter_holder ul li')); filters.each(function(){ var item = $j(this); if((item).data('filter') == 'all' || (item).data('filter') == '*'){ updateResult(item,".filter_number_of_items", articles.length); } else{ var categoryClass = item.attr('data-filter'); categoryClass = categoryClass.replace(/\./g, ''); updateResult(item,".filter_number_of_items", container.find('article.'+categoryClass).length); } }); filters.css('opacity','1'); } function updateResult(item, pos ,value){ item.find(pos).text(value); } }
JavaScript
function initSideAreaScroll(){ "use strict"; if($j('.side_menu').length){ $j(".side_menu").niceScroll({ scrollspeed: 60, mousescrollstep: 40, cursorwidth: 0, cursorborder: 0, cursorborderradius: 0, cursorcolor: "transparent", autohidemode: false, horizrailenabled: false }); } }
function initSideAreaScroll(){ "use strict"; if($j('.side_menu').length){ $j(".side_menu").niceScroll({ scrollspeed: 60, mousescrollstep: 40, cursorwidth: 0, cursorborder: 0, cursorborderradius: 0, cursorcolor: "transparent", autohidemode: false, horizrailenabled: false }); } }
JavaScript
function initVerticalAreaMenuScroll(){ "use strict"; if($j('.vertical_menu_area.with_scroll').length){ $j(".vertical_menu_area.with_scroll").niceScroll({ scrollspeed: 60, mousescrollstep: 40, cursorwidth: 0, cursorborder: 0, cursorborderradius: 0, cursorcolor: "transparent", autohidemode: false, horizrailenabled: false }); } }
function initVerticalAreaMenuScroll(){ "use strict"; if($j('.vertical_menu_area.with_scroll').length){ $j(".vertical_menu_area.with_scroll").niceScroll({ scrollspeed: 60, mousescrollstep: 40, cursorwidth: 0, cursorborder: 0, cursorborderradius: 0, cursorcolor: "transparent", autohidemode: false, horizrailenabled: false }); } }
JavaScript
function prettyPhoto(){ "use strict"; $j('a[data-rel]').each(function() { $j(this).attr('rel', $j(this).data('rel')); }); // TODO make this in one call of prettyPhoto $j("a[rel^='prettyPhoto']:not(.qode-single-image-pretty-photo)").prettyPhoto({ animation_speed: 'normal', /* fast/slow/normal */ slideshow: false, /* false OR interval time in ms */ autoplay_slideshow: false, /* true/false */ opacity: 0.80, /* Value between 0 and 1 */ show_title: true, /* true/false */ allow_resize: true, /* Resize the photos bigger than viewport. true/false */ horizontal_padding: 0, default_width: 650, default_height: 400, counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */ hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */ wmode: 'opaque', /* Set the flash wmode attribute */ autoplay: true, /* Automatically start videos: True/False */ modal: false, /* If set to true, only the close button will close the window */ overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */ keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */ deeplinking: false, social_tools: false }); $j("a[rel^='prettyPhoto'].qode-single-image-pretty-photo").prettyPhoto({ animation_speed: 'normal', /* fast/slow/normal */ slideshow: false, /* false OR interval time in ms */ autoplay_slideshow: false, /* true/false */ opacity: 0.80, /* Value between 0 and 1 */ show_title: true, /* true/false */ allow_resize: true, /* Resize the photos bigger than viewport. true/false */ horizontal_padding: 0, default_width: 650, default_height: 400, counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */ hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */ wmode: 'opaque', /* Set the flash wmode attribute */ autoplay: true, /* Automatically start videos: True/False */ modal: false, /* If set to true, only the close button will close the window */ overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */ keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */ deeplinking: false, social_tools: false, changepicturecallback: function(){ $j('.pp_pic_holder').addClass('qode-pretty-photo-hide-navigation'); }, /* Called everytime an item is shown/changed */ }); }
function prettyPhoto(){ "use strict"; $j('a[data-rel]').each(function() { $j(this).attr('rel', $j(this).data('rel')); }); // TODO make this in one call of prettyPhoto $j("a[rel^='prettyPhoto']:not(.qode-single-image-pretty-photo)").prettyPhoto({ animation_speed: 'normal', /* fast/slow/normal */ slideshow: false, /* false OR interval time in ms */ autoplay_slideshow: false, /* true/false */ opacity: 0.80, /* Value between 0 and 1 */ show_title: true, /* true/false */ allow_resize: true, /* Resize the photos bigger than viewport. true/false */ horizontal_padding: 0, default_width: 650, default_height: 400, counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */ hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */ wmode: 'opaque', /* Set the flash wmode attribute */ autoplay: true, /* Automatically start videos: True/False */ modal: false, /* If set to true, only the close button will close the window */ overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */ keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */ deeplinking: false, social_tools: false }); $j("a[rel^='prettyPhoto'].qode-single-image-pretty-photo").prettyPhoto({ animation_speed: 'normal', /* fast/slow/normal */ slideshow: false, /* false OR interval time in ms */ autoplay_slideshow: false, /* true/false */ opacity: 0.80, /* Value between 0 and 1 */ show_title: true, /* true/false */ allow_resize: true, /* Resize the photos bigger than viewport. true/false */ horizontal_padding: 0, default_width: 650, default_height: 400, counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */ hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */ wmode: 'opaque', /* Set the flash wmode attribute */ autoplay: true, /* Automatically start videos: True/False */ modal: false, /* If set to true, only the close button will close the window */ overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */ keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */ deeplinking: false, social_tools: false, changepicturecallback: function(){ $j('.pp_pic_holder').addClass('qode-pretty-photo-hide-navigation'); }, /* Called everytime an item is shown/changed */ }); }
JavaScript
function fitVideo(){ "use strict"; $j(".portfolio_images").fitVids(); $j(".video_holder").fitVids(); $j(".format-video .post_image").fitVids(); $j(".format-video .q_masonry_blog_post_image").fitVids(); }
function fitVideo(){ "use strict"; $j(".portfolio_images").fitVids(); $j(".video_holder").fitVids(); $j(".format-video .post_image").fitVids(); $j(".format-video .q_masonry_blog_post_image").fitVids(); }
JavaScript
function initAccordionContentLink(){ "use strict"; if($j(".accordion").length){ $j('.accordion_holder .accordion_inner .accordion_content a').on('click', function(){ if($j(this).attr('target') === '_blank'){ window.open($j(this).attr('href'),'_blank'); }else{ window.open($j(this).attr('href'),'_self'); } return false; }); } }
function initAccordionContentLink(){ "use strict"; if($j(".accordion").length){ $j('.accordion_holder .accordion_inner .accordion_content a').on('click', function(){ if($j(this).attr('target') === '_blank'){ window.open($j(this).attr('href'),'_blank'); }else{ window.open($j(this).attr('href'),'_self'); } return false; }); } }
JavaScript
function qodeNumberOfTestimonialsItems($this){ var maxItems = $this.data('number-per-slide'); if ($window_width < 768 && maxItems > 1){ maxItems = 1; }else if ($window_width < 1024 && maxItems > 2) { maxItems = 2; } return maxItems; }
function qodeNumberOfTestimonialsItems($this){ var maxItems = $this.data('number-per-slide'); if ($window_width < 768 && maxItems > 1){ maxItems = 1; }else if ($window_width < 1024 && maxItems > 2) { maxItems = 2; } return maxItems; }
JavaScript
function qodeNumberOfTestimonialsItemsResize(){ var testimonialsSlider = $j('.testimonials_carousel, .testimonials_c_carousel'); if(testimonialsSlider.length){ testimonialsSlider.each(function(){ var thisSliderHolder = $j(this); var items = qodeNumberOfTestimonialsItems(thisSliderHolder); if (typeof thisSliderHolder.data('flexslider') !== 'undefined') { thisSliderHolder.data('flexslider').vars.minItems = items; } if (typeof thisSliderHolder.data('flexslider') !== 'undefined') { thisSliderHolder.data('flexslider').vars.maxItems = items; } }); } }
function qodeNumberOfTestimonialsItemsResize(){ var testimonialsSlider = $j('.testimonials_carousel, .testimonials_c_carousel'); if(testimonialsSlider.length){ testimonialsSlider.each(function(){ var thisSliderHolder = $j(this); var items = qodeNumberOfTestimonialsItems(thisSliderHolder); if (typeof thisSliderHolder.data('flexslider') !== 'undefined') { thisSliderHolder.data('flexslider').vars.minItems = items; } if (typeof thisSliderHolder.data('flexslider') !== 'undefined') { thisSliderHolder.data('flexslider').vars.maxItems = items; } }); } }
JavaScript
function fitAudio(){ "use strict"; $j('audio.blog_audio').mediaelementplayer({ audioWidth: '100%' }); }
function fitAudio(){ "use strict"; $j('audio.blog_audio').mediaelementplayer({ audioWidth: '100%' }); }
JavaScript
function initBlog() { "use strict"; if($j('.blog_holder.masonry, .blog_holder.blog_pinterest').length) { var width_blog = $j(this).closest('.container_inner').width(), filters = $j('.filter'), firstFilter = $j('.filter_holder ul > .filter:first-of-type'); if($j('.blog_holder').closest(".column_inner").length) { width_blog = $j('.blog_holder').closest(".column_inner").width(); } $j('.blog_holder').width(width_blog); var $container = $j('.blog_holder'); $container.waitForImages(function() { setTimeout(function() { $container.isotope({ itemSelector: 'article', resizable: false, masonry: {columnWidth: '.blog_holder_grid_sizer', gutter: '.blog_holder_grid_gutter'} }); $j('.blog_holder.masonry, .blog_holder.blog_pinterest').animate({opacity: "1"}, 500); }, 400); }); firstFilter.addClass('active'); filters.on('click', function() { filters.removeClass('active'); $j(this).addClass('active'); var selector = $j(this).attr('data-filter'); $container.isotope({filter: selector}); return false; }); var loading_label_holder = $j('.qode-infinite-scroll-loading-label'), finished_label_holder = $j('.qode-infinite-scroll-finished-label'); if($container.hasClass('masonry_infinite_scroll')) { $container.infiniteScroll({ path: '.blog_infinite_scroll_button a', append: '.post', history: false, }); $container.on( 'request.infiniteScroll', function( event, path ) { loading_label_holder.fadeIn('fast'); }); $container.on( 'load.infiniteScroll', function( event, response, path ) { loading_label_holder.fadeOut('fast'); }); $container.on( 'append.infiniteScroll', function( event, response, path, items ) { $container.isotope('appended', items); fitVideo(); fitAudio(); initFlexSlider(); setTimeout(function() { $j('.blog_holder.masonry, .blog_holder.blog_pinterest').isotope('layout'); }, 400); }); $container.on( 'last.infiniteScroll', function( event, response, path ) { finished_label_holder.fadeIn('fast'); }); } else if($container.hasClass('masonry_load_more')) { var i = 1; $j('.blog_load_more_button a').off('click tap').on('click tap', function(e) { e.preventDefault(); var load_more_holder = $j('.blog_load_more_button'); var load_more_loading = $j('.blog_load_more_button_loading'); load_more_holder.hide(); load_more_loading.show(); var link = $j(this).attr('href'); var $content = '.masonry_load_more'; var $anchor = '.blog_load_more_button a'; var $next_href = $j($anchor).attr('href'); $j.get(link + '', function(data) { var $new_content = $j($content, data).wrapInner('').html(); $next_href = $j($anchor, data).attr('href'); $container.append($j($new_content)).isotope('reloadItems').isotope({sortBy: 'original-order'}); fitVideo(); fitAudio(); initFlexSlider(); setTimeout(function() { $j('.blog_holder.masonry, .blog_holder.blog_pinterest').isotope('layout'); }, 400); load_more_holder.show(); load_more_loading.hide(); if($j('.blog_load_more_button span').attr('rel') > i) { $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL } else { $j('.blog_load_more_button').remove(); } }); i++; }); } } }
function initBlog() { "use strict"; if($j('.blog_holder.masonry, .blog_holder.blog_pinterest').length) { var width_blog = $j(this).closest('.container_inner').width(), filters = $j('.filter'), firstFilter = $j('.filter_holder ul > .filter:first-of-type'); if($j('.blog_holder').closest(".column_inner").length) { width_blog = $j('.blog_holder').closest(".column_inner").width(); } $j('.blog_holder').width(width_blog); var $container = $j('.blog_holder'); $container.waitForImages(function() { setTimeout(function() { $container.isotope({ itemSelector: 'article', resizable: false, masonry: {columnWidth: '.blog_holder_grid_sizer', gutter: '.blog_holder_grid_gutter'} }); $j('.blog_holder.masonry, .blog_holder.blog_pinterest').animate({opacity: "1"}, 500); }, 400); }); firstFilter.addClass('active'); filters.on('click', function() { filters.removeClass('active'); $j(this).addClass('active'); var selector = $j(this).attr('data-filter'); $container.isotope({filter: selector}); return false; }); var loading_label_holder = $j('.qode-infinite-scroll-loading-label'), finished_label_holder = $j('.qode-infinite-scroll-finished-label'); if($container.hasClass('masonry_infinite_scroll')) { $container.infiniteScroll({ path: '.blog_infinite_scroll_button a', append: '.post', history: false, }); $container.on( 'request.infiniteScroll', function( event, path ) { loading_label_holder.fadeIn('fast'); }); $container.on( 'load.infiniteScroll', function( event, response, path ) { loading_label_holder.fadeOut('fast'); }); $container.on( 'append.infiniteScroll', function( event, response, path, items ) { $container.isotope('appended', items); fitVideo(); fitAudio(); initFlexSlider(); setTimeout(function() { $j('.blog_holder.masonry, .blog_holder.blog_pinterest').isotope('layout'); }, 400); }); $container.on( 'last.infiniteScroll', function( event, response, path ) { finished_label_holder.fadeIn('fast'); }); } else if($container.hasClass('masonry_load_more')) { var i = 1; $j('.blog_load_more_button a').off('click tap').on('click tap', function(e) { e.preventDefault(); var load_more_holder = $j('.blog_load_more_button'); var load_more_loading = $j('.blog_load_more_button_loading'); load_more_holder.hide(); load_more_loading.show(); var link = $j(this).attr('href'); var $content = '.masonry_load_more'; var $anchor = '.blog_load_more_button a'; var $next_href = $j($anchor).attr('href'); $j.get(link + '', function(data) { var $new_content = $j($content, data).wrapInner('').html(); $next_href = $j($anchor, data).attr('href'); $container.append($j($new_content)).isotope('reloadItems').isotope({sortBy: 'original-order'}); fitVideo(); fitAudio(); initFlexSlider(); setTimeout(function() { $j('.blog_holder.masonry, .blog_holder.blog_pinterest').isotope('layout'); }, 400); load_more_holder.show(); load_more_loading.hide(); if($j('.blog_load_more_button span').attr('rel') > i) { $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL } else { $j('.blog_load_more_button').remove(); } }); i++; }); } } }
JavaScript
function initBlogMasonryFullWidth(){ "use strict"; if($j('.masonry_full_width').length){ var width_blog = $j('.full_width_inner').width(); $j('.masonry_full_width').width(width_blog); var $container = $j('.masonry_full_width'); $j('.filter').on('click', function(){ var selector = $j(this).attr('data-filter'); $container.isotope({ filter: selector }); return false; }); var loading_label_holder = $j('.qode-infinite-scroll-loading-label'), finished_label_holder = $j('.qode-infinite-scroll-finished-label'); if( $container.hasClass('masonry_infinite_scroll')){ $container.infiniteScroll({ path: '.blog_infinite_scroll_button a', append: '.post', history: false, }); $container.on( 'request.infiniteScroll', function( event, path ) { loading_label_holder.fadeIn('fast'); }); $container.on( 'load.infiniteScroll', function( event, response, path ) { loading_label_holder.fadeOut('fast'); }); $container.on( 'append.infiniteScroll', function( event, response, path, items ) { $container.isotope('appended', items); fitVideo(); fitAudio(); initFlexSlider(); setTimeout(function() { $j('.blog_holder.masonry_full_width').isotope( 'layout'); }, 400); }); $container.on( 'last.infiniteScroll', function( event, response, path ) { finished_label_holder.fadeIn('fast'); }); }else if($container.hasClass('masonry_load_more')){ var i = 1; $j('.blog_load_more_button a').off('click tap').on('click tap', function(e) { e.preventDefault(); var link = $j(this).attr('href'); var $content = '.masonry_load_more'; var $anchor = '.blog_load_more_button a'; var $next_href = $j($anchor).attr('href'); $j.get(link+'', function(data){ var $new_content = $j($content, data).wrapInner('').html(); $next_href = $j($anchor, data).attr('href'); $container.append( $j( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); fitVideo(); fitAudio(); initFlexSlider(); setTimeout(function() { $j('.blog_holder.masonry_full_width').isotope( 'layout'); }, 400); if($j('.blog_load_more_button span').attr('rel') > i) { $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL } else { $j('.blog_load_more_button').remove(); } }); i++; }); } $container.waitForImages(function() { setTimeout(function() { $container.isotope({ itemSelector: 'article', resizable: false, masonry: { columnWidth: '.blog_holder_grid_sizer',gutter: '.blog_holder_grid_gutter'} }); $j('.masonry_full_width').animate({opacity: "1"}, 500); }, 400); }); } }
function initBlogMasonryFullWidth(){ "use strict"; if($j('.masonry_full_width').length){ var width_blog = $j('.full_width_inner').width(); $j('.masonry_full_width').width(width_blog); var $container = $j('.masonry_full_width'); $j('.filter').on('click', function(){ var selector = $j(this).attr('data-filter'); $container.isotope({ filter: selector }); return false; }); var loading_label_holder = $j('.qode-infinite-scroll-loading-label'), finished_label_holder = $j('.qode-infinite-scroll-finished-label'); if( $container.hasClass('masonry_infinite_scroll')){ $container.infiniteScroll({ path: '.blog_infinite_scroll_button a', append: '.post', history: false, }); $container.on( 'request.infiniteScroll', function( event, path ) { loading_label_holder.fadeIn('fast'); }); $container.on( 'load.infiniteScroll', function( event, response, path ) { loading_label_holder.fadeOut('fast'); }); $container.on( 'append.infiniteScroll', function( event, response, path, items ) { $container.isotope('appended', items); fitVideo(); fitAudio(); initFlexSlider(); setTimeout(function() { $j('.blog_holder.masonry_full_width').isotope( 'layout'); }, 400); }); $container.on( 'last.infiniteScroll', function( event, response, path ) { finished_label_holder.fadeIn('fast'); }); }else if($container.hasClass('masonry_load_more')){ var i = 1; $j('.blog_load_more_button a').off('click tap').on('click tap', function(e) { e.preventDefault(); var link = $j(this).attr('href'); var $content = '.masonry_load_more'; var $anchor = '.blog_load_more_button a'; var $next_href = $j($anchor).attr('href'); $j.get(link+'', function(data){ var $new_content = $j($content, data).wrapInner('').html(); $next_href = $j($anchor, data).attr('href'); $container.append( $j( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); fitVideo(); fitAudio(); initFlexSlider(); setTimeout(function() { $j('.blog_holder.masonry_full_width').isotope( 'layout'); }, 400); if($j('.blog_load_more_button span').attr('rel') > i) { $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL } else { $j('.blog_load_more_button').remove(); } }); i++; }); } $container.waitForImages(function() { setTimeout(function() { $container.isotope({ itemSelector: 'article', resizable: false, masonry: { columnWidth: '.blog_holder_grid_sizer',gutter: '.blog_holder_grid_gutter'} }); $j('.masonry_full_width').animate({opacity: "1"}, 500); }, 400); }); } }
JavaScript
function initBlogMasonryGallery(){ "use strict"; if($j('.blog_holder.masonry_gallery').length) { qodeResizeBlogMasonryGallery($j('.blog_holder_grid_sizer').width()); var container = $j('.blog_holder.masonry_gallery'); container.width(Math.round(container.parent().width())); container.isotope({ itemSelector: 'article', resizable: false, masonry: { columnWidth: '.blog_holder_grid_sizer', gutter: '.blog_holder_grid_gutter' } }); container.waitForImages(function(){ container.animate({opacity: "1"}, 300, function() { container.isotope().isotope('layout'); }); }); var loading_label_holder = $j('.qode-infinite-scroll-loading-label'), finished_label_holder = $j('.qode-infinite-scroll-finished-label'); if( container.hasClass('masonry_infinite_scroll')){ container.infiniteScroll({ path: '.blog_infinite_scroll_button a', append: '.post', history: false, }); container.on( 'request.infiniteScroll', function( event, path ) { loading_label_holder.fadeIn('fast'); }); container.on( 'load.infiniteScroll', function( event, response, path ) { loading_label_holder.fadeOut('fast'); }); container.on( 'append.infiniteScroll', function( event, response, path, items ) { container.isotope('appended', items); fitVideo(); fitAudio(); initFlexSlider(); qodeResizeBlogMasonryGallery($j('.blog_holder_grid_sizer').width()); setTimeout(function() { container.isotope( 'layout'); }, 300); }); container.on( 'last.infiniteScroll', function( event, response, path ) { finished_label_holder.fadeIn('fast'); }); }else if(container.hasClass('masonry_load_more')){ var i = 1; $j('.blog_load_more_button a').off('click tap').on('click tap', function(e) { e.preventDefault(); var link = $j(this).attr('href'); var $content = '.masonry_load_more'; var $anchor = '.blog_load_more_button a'; var $next_href = $j($anchor).attr('href'); $j.get(link+'', function(data){ var $new_content = $j($content, data).wrapInner('').html(); $next_href = $j($anchor, data).attr('href'); container.append( $j( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); fitVideo(); fitAudio(); initFlexSlider(); qodeResizeBlogMasonryGallery($j('.blog_holder_grid_sizer').width()); setTimeout(function() { container.isotope( 'layout'); }, 300); if($j('.blog_load_more_button span').attr('rel') > i) { $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL } else { $j('.blog_load_more_button').remove(); } }); i++; }); } $j(window).resize(function() { qodeResizeBlogMasonryGallery($j('.blog_holder_grid_sizer').width()); container.isotope().isotope('layout'); container.width(Math.round(container.parent().width())); }); } }
function initBlogMasonryGallery(){ "use strict"; if($j('.blog_holder.masonry_gallery').length) { qodeResizeBlogMasonryGallery($j('.blog_holder_grid_sizer').width()); var container = $j('.blog_holder.masonry_gallery'); container.width(Math.round(container.parent().width())); container.isotope({ itemSelector: 'article', resizable: false, masonry: { columnWidth: '.blog_holder_grid_sizer', gutter: '.blog_holder_grid_gutter' } }); container.waitForImages(function(){ container.animate({opacity: "1"}, 300, function() { container.isotope().isotope('layout'); }); }); var loading_label_holder = $j('.qode-infinite-scroll-loading-label'), finished_label_holder = $j('.qode-infinite-scroll-finished-label'); if( container.hasClass('masonry_infinite_scroll')){ container.infiniteScroll({ path: '.blog_infinite_scroll_button a', append: '.post', history: false, }); container.on( 'request.infiniteScroll', function( event, path ) { loading_label_holder.fadeIn('fast'); }); container.on( 'load.infiniteScroll', function( event, response, path ) { loading_label_holder.fadeOut('fast'); }); container.on( 'append.infiniteScroll', function( event, response, path, items ) { container.isotope('appended', items); fitVideo(); fitAudio(); initFlexSlider(); qodeResizeBlogMasonryGallery($j('.blog_holder_grid_sizer').width()); setTimeout(function() { container.isotope( 'layout'); }, 300); }); container.on( 'last.infiniteScroll', function( event, response, path ) { finished_label_holder.fadeIn('fast'); }); }else if(container.hasClass('masonry_load_more')){ var i = 1; $j('.blog_load_more_button a').off('click tap').on('click tap', function(e) { e.preventDefault(); var link = $j(this).attr('href'); var $content = '.masonry_load_more'; var $anchor = '.blog_load_more_button a'; var $next_href = $j($anchor).attr('href'); $j.get(link+'', function(data){ var $new_content = $j($content, data).wrapInner('').html(); $next_href = $j($anchor, data).attr('href'); container.append( $j( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); fitVideo(); fitAudio(); initFlexSlider(); qodeResizeBlogMasonryGallery($j('.blog_holder_grid_sizer').width()); setTimeout(function() { container.isotope( 'layout'); }, 300); if($j('.blog_load_more_button span').attr('rel') > i) { $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL } else { $j('.blog_load_more_button').remove(); } }); i++; }); } $j(window).resize(function() { qodeResizeBlogMasonryGallery($j('.blog_holder_grid_sizer').width()); container.isotope().isotope('layout'); container.width(Math.round(container.parent().width())); }); } }
JavaScript
function initBlogGallery(){ "use strict"; if($j('.blog_holder.blog_gallery, .blog_holder.blog_chequered').length) { qodeResizeBlogGallery($j('.blog_holder_grid_sizer').width()); var container = $j('.blog_holder.blog_gallery, .blog_holder.blog_chequered'); container.width(Math.round(container.parent().width())); container.isotope({ itemSelector: 'article', resizable: false, masonry: { columnWidth: '.blog_holder_grid_sizer', gutter: '.blog_holder_grid_gutter' } }); container.waitForImages(function(){ container.animate({opacity: "1"}, 300, function() { container.isotope().isotope('layout'); }); }); var loading_label_holder = $j('.qode-infinite-scroll-loading-label'), finished_label_holder = $j('.qode-infinite-scroll-finished-label'); if( container.hasClass('masonry_infinite_scroll')){ container.infiniteScroll({ path: '.blog_infinite_scroll_button a', append: '.post', history: false, }); container.on( 'request.infiniteScroll', function( event, path ) { loading_label_holder.fadeIn('fast'); }); container.on( 'load.infiniteScroll', function( event, response, path ) { loading_label_holder.fadeOut('fast'); }); container.on( 'append.infiniteScroll', function( event, response, path, items ) { container.isotope('appended', items); fitVideo(); fitAudio(); initFlexSlider(); qodeResizeBlogGallery($j('.blog_holder_grid_sizer').width()); setTimeout(function() { container.isotope( 'layout'); }, 300); }); container.on( 'last.infiniteScroll', function( event, response, path ) { finished_label_holder.fadeIn('fast'); }); }else if(container.hasClass('masonry_load_more')){ var i = 1; $j('.blog_load_more_button a').off('click tap').on('click tap', function(e) { e.preventDefault(); var link = $j(this).attr('href'); var $content = '.masonry_load_more'; var $anchor = '.blog_load_more_button a'; var $next_href = $j($anchor).attr('href'); $j.get(link+'', function(data){ var $new_content = $j($content, data).wrapInner('').html(); $next_href = $j($anchor, data).attr('href'); container.append( $j( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); fitVideo(); fitAudio(); initFlexSlider(); qodeResizeBlogGallery($j('.blog_holder_grid_sizer').width()); setTimeout(function() { container.isotope( 'layout'); }, 300); if($j('.blog_load_more_button span').attr('rel') > i) { $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL } else { $j('.blog_load_more_button').remove(); } qodeBlogGalleryAnimation(); }); i++; }); } $j(window).resize(function() { qodeResizeBlogGallery($j('.blog_holder_grid_sizer').width()); container.isotope().isotope('layout'); container.width(Math.round(container.parent().width())); }); } }
function initBlogGallery(){ "use strict"; if($j('.blog_holder.blog_gallery, .blog_holder.blog_chequered').length) { qodeResizeBlogGallery($j('.blog_holder_grid_sizer').width()); var container = $j('.blog_holder.blog_gallery, .blog_holder.blog_chequered'); container.width(Math.round(container.parent().width())); container.isotope({ itemSelector: 'article', resizable: false, masonry: { columnWidth: '.blog_holder_grid_sizer', gutter: '.blog_holder_grid_gutter' } }); container.waitForImages(function(){ container.animate({opacity: "1"}, 300, function() { container.isotope().isotope('layout'); }); }); var loading_label_holder = $j('.qode-infinite-scroll-loading-label'), finished_label_holder = $j('.qode-infinite-scroll-finished-label'); if( container.hasClass('masonry_infinite_scroll')){ container.infiniteScroll({ path: '.blog_infinite_scroll_button a', append: '.post', history: false, }); container.on( 'request.infiniteScroll', function( event, path ) { loading_label_holder.fadeIn('fast'); }); container.on( 'load.infiniteScroll', function( event, response, path ) { loading_label_holder.fadeOut('fast'); }); container.on( 'append.infiniteScroll', function( event, response, path, items ) { container.isotope('appended', items); fitVideo(); fitAudio(); initFlexSlider(); qodeResizeBlogGallery($j('.blog_holder_grid_sizer').width()); setTimeout(function() { container.isotope( 'layout'); }, 300); }); container.on( 'last.infiniteScroll', function( event, response, path ) { finished_label_holder.fadeIn('fast'); }); }else if(container.hasClass('masonry_load_more')){ var i = 1; $j('.blog_load_more_button a').off('click tap').on('click tap', function(e) { e.preventDefault(); var link = $j(this).attr('href'); var $content = '.masonry_load_more'; var $anchor = '.blog_load_more_button a'; var $next_href = $j($anchor).attr('href'); $j.get(link+'', function(data){ var $new_content = $j($content, data).wrapInner('').html(); $next_href = $j($anchor, data).attr('href'); container.append( $j( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); fitVideo(); fitAudio(); initFlexSlider(); qodeResizeBlogGallery($j('.blog_holder_grid_sizer').width()); setTimeout(function() { container.isotope( 'layout'); }, 300); if($j('.blog_load_more_button span').attr('rel') > i) { $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL } else { $j('.blog_load_more_button').remove(); } qodeBlogGalleryAnimation(); }); i++; }); } $j(window).resize(function() { qodeResizeBlogGallery($j('.blog_holder_grid_sizer').width()); container.isotope().isotope('layout'); container.width(Math.round(container.parent().width())); }); } }
JavaScript
function initSmallImageBlogHeight(){ "use strict"; if($j('.blog_small_image').length){ $j('article').each(function() { $j(this).find('.post_text_inner').css('min-height', $j(this).find('.post_image').height() - 46); //46 is top and bottom padding }); } }
function initSmallImageBlogHeight(){ "use strict"; if($j('.blog_small_image').length){ $j('article').each(function() { $j(this).find('.post_text_inner').css('min-height', $j(this).find('.post_image').height() - 46); //46 is top and bottom padding }); } }
JavaScript
function initQBlog(){ "use strict"; if($j('.q_masonry_blog').length){ $j('.q_masonry_blog').each(function() { var thisItem = $j(this); thisItem.waitForImages(function() { setTimeout(function() { thisItem.isotope({ itemSelector: 'article', resizable: false, masonry: {columnWidth: '.q_masonry_blog_grid_sizer', gutter: '.q_masonry_blog_grid_gutter'} }); thisItem.animate({opacity: "1"}, 500); }, 400); }); }); } }
function initQBlog(){ "use strict"; if($j('.q_masonry_blog').length){ $j('.q_masonry_blog').each(function() { var thisItem = $j(this); thisItem.waitForImages(function() { setTimeout(function() { thisItem.isotope({ itemSelector: 'article', resizable: false, masonry: {columnWidth: '.q_masonry_blog_grid_sizer', gutter: '.q_masonry_blog_grid_gutter'} }); thisItem.animate({opacity: "1"}, 500); }, 400); }); }); } }
JavaScript
function initMasonryGallery(){ "use strict"; resizeMasonryGallery($j('.grid-sizer').width()); if($j('.masonry_gallery_holder').length){ $j('.masonry_gallery_holder').each(function(){ var $this = $j(this); $this.waitForImages(function(){ $this.animate({opacity:1}); $this.isotope({ itemSelector: '.masonry_gallery_item', masonry: { columnWidth: '.grid-sizer' } }); $this.find('.masonry_gallery_item.parallax_item').each(function(i){ $j(this).masonryParallax($this.data('parallax_item_speed'), true, $this.data('parallax_item_offset')); }); }); }); $j(window).resize(function(){ resizeMasonryGallery($j('.grid-sizer').width()); $j('.masonry_gallery_holder').isotope('reloadItems'); }); } }
function initMasonryGallery(){ "use strict"; resizeMasonryGallery($j('.grid-sizer').width()); if($j('.masonry_gallery_holder').length){ $j('.masonry_gallery_holder').each(function(){ var $this = $j(this); $this.waitForImages(function(){ $this.animate({opacity:1}); $this.isotope({ itemSelector: '.masonry_gallery_item', masonry: { columnWidth: '.grid-sizer' } }); $this.find('.masonry_gallery_item.parallax_item').each(function(i){ $j(this).masonryParallax($this.data('parallax_item_speed'), true, $this.data('parallax_item_offset')); }); }); }); $j(window).resize(function(){ resizeMasonryGallery($j('.grid-sizer').width()); $j('.masonry_gallery_holder').isotope('reloadItems'); }); } }
JavaScript
function initToCounterVerticalProgressBar($this){ "use strict"; if($this.find('.progress_number span').length){ $this.find('.progress_number span').each(function() { var $max = parseFloat($j(this).text()); $j(this).countTo({ from: 0, to: $max, speed: 1500, refreshInterval: 50 }); }); } }
function initToCounterVerticalProgressBar($this){ "use strict"; if($this.find('.progress_number span').length){ $this.find('.progress_number span').each(function() { var $max = parseFloat($j(this).text()); $j(this).countTo({ from: 0, to: $max, speed: 1500, refreshInterval: 50 }); }); } }
JavaScript
function checkAnchorOnLoad(){ "use strict"; var hash = window.location.hash; var newHash = encodeURI(window.location.hash.split('#')[1]); var paspartuScrollAdd = $j('body').hasClass('paspartu_on_top_fixed') ? $window_width*paspartu_width : 0; var scrollToAmount; var top_header_height; if(hash !== "" && $j('[data-q_id="#'+newHash+'"]').length > 0){ if($j('header.page_header').hasClass('fixed') && !$j('body').hasClass('vertical_menu_enabled')){ if($j('header.page_header').hasClass('scroll_top')){ top_header_height = header_top_height; }else{ top_header_height = 0; } if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) { if(header_height - ($j('[data-q_id="' + hash + '"]').offset().top + top_header_height)/4 >= min_header_height_scroll){ var diff_of_header_and_section = $j('[data-q_id="' + hash + '"]').offset().top - header_height - paspartuScrollAdd; scrollToAmount = diff_of_header_and_section + (diff_of_header_and_section/4) + (diff_of_header_and_section/16) + (diff_of_header_and_section/64) + 1; //several times od dividing to minimize the error, because fixed header is shrinking while scroll, 1 is just to ensure }else{ if($j('header.page_header').hasClass('centered_logo')){ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - logo_height - 30 - paspartuScrollAdd; //30 is top/bottom margin of logo } else { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - paspartuScrollAdd; } } }else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } } else if($j('header.page_header').hasClass('fixed_top_header') && !$j('body').hasClass('vertical_menu_enabled')){ if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')){ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - header_top_height - paspartuScrollAdd; }else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } } else if($j('header.page_header').hasClass('fixed_hiding') && !$j('body').hasClass('vertical_menu_enabled')){ if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) { if ($j('[data-q_id="' + hash + '"]').offset().top - (header_height + logo_height / 2 + 40) <= scroll_amount_for_fixed_hiding) { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - header_height - logo_height / 2 - 40 - paspartuScrollAdd; //40 is top/bottom margin of logo } else { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_fixed_hidden - 40 - paspartuScrollAdd; //40 is top/bottom margin of logo } }else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } }else if($j('header.page_header').hasClass('stick') || $j('header.page_header').hasClass('stick_with_left_right_menu') && !$j('body').hasClass('vertical_menu_enabled')) { if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) { if (sticky_amount >= $j('[data-q_id="' + hash + '"]').offset().top) { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top + 1 - paspartuScrollAdd; // 1 is to show sticky menu } else { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_sticky - paspartuScrollAdd; } }else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } } else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } $j('html, body').animate({ scrollTop: Math.round(scrollToAmount) }, 1500, function() {}); } //remove active state on anchors if section is not visible $j(".main_menu a, .vertical_menu a, .mobile_menu a").each(function(){ var i = $j(this).prop("hash"); if(i !== "" && ($j('[data-q_id="' + i + '"]').length > 0) && ($j('[data-q_id="' + i + '"]').offset().top >= $window_height) && $scroll === 0){ $j(this).parent().removeClass('active current-menu-item'); $j(this).removeClass('current'); } }); }
function checkAnchorOnLoad(){ "use strict"; var hash = window.location.hash; var newHash = encodeURI(window.location.hash.split('#')[1]); var paspartuScrollAdd = $j('body').hasClass('paspartu_on_top_fixed') ? $window_width*paspartu_width : 0; var scrollToAmount; var top_header_height; if(hash !== "" && $j('[data-q_id="#'+newHash+'"]').length > 0){ if($j('header.page_header').hasClass('fixed') && !$j('body').hasClass('vertical_menu_enabled')){ if($j('header.page_header').hasClass('scroll_top')){ top_header_height = header_top_height; }else{ top_header_height = 0; } if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) { if(header_height - ($j('[data-q_id="' + hash + '"]').offset().top + top_header_height)/4 >= min_header_height_scroll){ var diff_of_header_and_section = $j('[data-q_id="' + hash + '"]').offset().top - header_height - paspartuScrollAdd; scrollToAmount = diff_of_header_and_section + (diff_of_header_and_section/4) + (diff_of_header_and_section/16) + (diff_of_header_and_section/64) + 1; //several times od dividing to minimize the error, because fixed header is shrinking while scroll, 1 is just to ensure }else{ if($j('header.page_header').hasClass('centered_logo')){ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - logo_height - 30 - paspartuScrollAdd; //30 is top/bottom margin of logo } else { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - paspartuScrollAdd; } } }else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } } else if($j('header.page_header').hasClass('fixed_top_header') && !$j('body').hasClass('vertical_menu_enabled')){ if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')){ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - header_top_height - paspartuScrollAdd; }else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } } else if($j('header.page_header').hasClass('fixed_hiding') && !$j('body').hasClass('vertical_menu_enabled')){ if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) { if ($j('[data-q_id="' + hash + '"]').offset().top - (header_height + logo_height / 2 + 40) <= scroll_amount_for_fixed_hiding) { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - header_height - logo_height / 2 - 40 - paspartuScrollAdd; //40 is top/bottom margin of logo } else { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_fixed_hidden - 40 - paspartuScrollAdd; //40 is top/bottom margin of logo } }else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } }else if($j('header.page_header').hasClass('stick') || $j('header.page_header').hasClass('stick_with_left_right_menu') && !$j('body').hasClass('vertical_menu_enabled')) { if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) { if (sticky_amount >= $j('[data-q_id="' + hash + '"]').offset().top) { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top + 1 - paspartuScrollAdd; // 1 is to show sticky menu } else { scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_sticky - paspartuScrollAdd; } }else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } } else{ scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; } $j('html, body').animate({ scrollTop: Math.round(scrollToAmount) }, 1500, function() {}); } //remove active state on anchors if section is not visible $j(".main_menu a, .vertical_menu a, .mobile_menu a").each(function(){ var i = $j(this).prop("hash"); if(i !== "" && ($j('[data-q_id="' + i + '"]').length > 0) && ($j('[data-q_id="' + i + '"]').offset().top >= $window_height) && $scroll === 0){ $j(this).parent().removeClass('active current-menu-item'); $j(this).removeClass('current'); } }); }
JavaScript
function changeActiveState(id){ "use strict"; if($j(".main_menu a[href*='#']").length) { $j('.main_menu a').parent().removeClass('active'); } $j(".main_menu a").each(function(){ var i = $j(this).prop("hash"); if(i === id){ if($j(this).closest('.second').length === 0){ $j(this).parent().addClass('active'); }else{ $j(this).closest('.second').parent().addClass('active'); } $j('.main_menu a').removeClass('current'); $j(this).addClass('current'); } }); if($j(".vertical_menu a[href*='#']").length) { $j('.vertical_menu a').parent().removeClass('active'); } $j(".vertical_menu a").each(function(){ var i = $j(this).prop("hash"); if(i === id){ if($j(this).closest('.second').length === 0){ $j(this).parent().addClass('active'); }else{ $j(this).closest('.second').parent().addClass('active'); } $j('.vertical_menu a').removeClass('current'); $j(this).addClass('current'); } }); if($j(".mobile_menu a[href*='#']").length) { $j('.mobile_menu a').parent().removeClass('active'); } $j(".mobile_menu a").each(function(){ var i = $j(this).prop("hash"); if(i === id){ if($j(this).closest('.sub_menu').length === 0){ $j(this).parent().addClass('active'); }else{ $j(this).closest('.sub_menu').parent().addClass('active'); } $j('.mobile_menu a').removeClass('current'); $j(this).addClass('current'); } }); }
function changeActiveState(id){ "use strict"; if($j(".main_menu a[href*='#']").length) { $j('.main_menu a').parent().removeClass('active'); } $j(".main_menu a").each(function(){ var i = $j(this).prop("hash"); if(i === id){ if($j(this).closest('.second').length === 0){ $j(this).parent().addClass('active'); }else{ $j(this).closest('.second').parent().addClass('active'); } $j('.main_menu a').removeClass('current'); $j(this).addClass('current'); } }); if($j(".vertical_menu a[href*='#']").length) { $j('.vertical_menu a').parent().removeClass('active'); } $j(".vertical_menu a").each(function(){ var i = $j(this).prop("hash"); if(i === id){ if($j(this).closest('.second').length === 0){ $j(this).parent().addClass('active'); }else{ $j(this).closest('.second').parent().addClass('active'); } $j('.vertical_menu a').removeClass('current'); $j(this).addClass('current'); } }); if($j(".mobile_menu a[href*='#']").length) { $j('.mobile_menu a').parent().removeClass('active'); } $j(".mobile_menu a").each(function(){ var i = $j(this).prop("hash"); if(i === id){ if($j(this).closest('.sub_menu').length === 0){ $j(this).parent().addClass('active'); }else{ $j(this).closest('.sub_menu').parent().addClass('active'); } $j('.mobile_menu a').removeClass('current'); $j(this).addClass('current'); } }); }
JavaScript
function checkAnchorOnScroll(){ "use strict"; if($j('[data-q_id]').length && !$j('header.page_header').hasClass('regular')){ $j('[data-q_id]').waypoint( function(direction) { if(direction === 'down') { //retrieve section object from waypoint object var sectionObject = $j(this)[0].adapter.$element; changeActiveState(sectionObject.data("q_id")); } }, { offset: '50%' }); $j('[data-q_id]').waypoint( function(direction) { if(direction === 'up') { //retrieve section object from waypoint object var sectionObject = $j(this)[0].adapter.$element; changeActiveState(sectionObject.data("q_id")); } }, { offset: function(){ //retrieve section object from waypoint object var sectionObject = $j(this)[0].adapter.$element; return -(sectionObject.outerHeight() - 150); } }); } }
function checkAnchorOnScroll(){ "use strict"; if($j('[data-q_id]').length && !$j('header.page_header').hasClass('regular')){ $j('[data-q_id]').waypoint( function(direction) { if(direction === 'down') { //retrieve section object from waypoint object var sectionObject = $j(this)[0].adapter.$element; changeActiveState(sectionObject.data("q_id")); } }, { offset: '50%' }); $j('[data-q_id]').waypoint( function(direction) { if(direction === 'up') { //retrieve section object from waypoint object var sectionObject = $j(this)[0].adapter.$element; changeActiveState(sectionObject.data("q_id")); } }, { offset: function(){ //retrieve section object from waypoint object var sectionObject = $j(this)[0].adapter.$element; return -(sectionObject.outerHeight() - 150); } }); } }
JavaScript
function countClientsPerRow(){ "use strict"; if($j('.qode_clients').length){ $j('.qode_clients').each(function() { var $clients = $j(this); var qode_clients_height = $clients.height(); var qode_clients_width = $clients.width(); var maxHeightClient; var clientWidth = $clients.find('.qode_client_holder').width(); var countClient = $clients.find('.qode_client_holder').length; $clients.find('.qode_client_holder').each(function() { maxHeightClient = maxHeightClient > $j(this).height() ? maxHeightClient : $j(this).height(); }); maxHeightClient = maxHeightClient + 35; //margin for client is 35 var numberOfRows = Math.ceil(qode_clients_height / maxHeightClient); var numberOfClientsPerRow = Math.ceil(qode_clients_width/clientWidth); var numberOffullRows = Math.floor(countClient / numberOfClientsPerRow); var numberOfClientsInLastRow = countClient - (numberOfClientsPerRow * numberOffullRows); if(numberOfClientsInLastRow === 0){ numberOfClientsInLastRow = numberOfClientsPerRow; } $clients.find( ".qode_client_holder" ).removeClass('border-bottom-none'); var item_start_from = countClient - numberOfClientsInLastRow - 1; $clients.find( ".qode_client_holder:gt("+ item_start_from +")" ).addClass('border-bottom-none'); }); } }
function countClientsPerRow(){ "use strict"; if($j('.qode_clients').length){ $j('.qode_clients').each(function() { var $clients = $j(this); var qode_clients_height = $clients.height(); var qode_clients_width = $clients.width(); var maxHeightClient; var clientWidth = $clients.find('.qode_client_holder').width(); var countClient = $clients.find('.qode_client_holder').length; $clients.find('.qode_client_holder').each(function() { maxHeightClient = maxHeightClient > $j(this).height() ? maxHeightClient : $j(this).height(); }); maxHeightClient = maxHeightClient + 35; //margin for client is 35 var numberOfRows = Math.ceil(qode_clients_height / maxHeightClient); var numberOfClientsPerRow = Math.ceil(qode_clients_width/clientWidth); var numberOffullRows = Math.floor(countClient / numberOfClientsPerRow); var numberOfClientsInLastRow = countClient - (numberOfClientsPerRow * numberOffullRows); if(numberOfClientsInLastRow === 0){ numberOfClientsInLastRow = numberOfClientsPerRow; } $clients.find( ".qode_client_holder" ).removeClass('border-bottom-none'); var item_start_from = countClient - numberOfClientsInLastRow - 1; $clients.find( ".qode_client_holder:gt("+ item_start_from +")" ).addClass('border-bottom-none'); }); } }
JavaScript
function animatedTextIconHeight(){ "use strict"; if($j('.animated_icons_with_text').length){ var $icons = $j('.animated_icons_with_text'); var maxHeight; $icons.find('.animated_text p').each(function() { maxHeight = maxHeight > $j(this).height() ? maxHeight : $j(this).height(); }); if(maxHeight < 155) { maxHeight = 155; } $icons.find('.animated_icon_with_text_inner').height(maxHeight); } }
function animatedTextIconHeight(){ "use strict"; if($j('.animated_icons_with_text').length){ var $icons = $j('.animated_icons_with_text'); var maxHeight; $icons.find('.animated_text p').each(function() { maxHeight = maxHeight > $j(this).height() ? maxHeight : $j(this).height(); }); if(maxHeight < 155) { maxHeight = 155; } $icons.find('.animated_icon_with_text_inner').height(maxHeight); } }
JavaScript
function countAnimatedTextIconPerRow(){ "use strict"; if($j('.animated_icons_with_text').length){ $j('.animated_icons_with_text').each(function() { var $icons = $j(this); var qode_icons_height = $icons.height(); var qode_icons_width = $icons.width(); var maxHeightIcons; var iconWidth = $icons.find('.animated_icon_with_text_holder').width() + 1; // 1px because safari round on smaller number var countIcons = $icons.find('.animated_icon_with_text_holder').length; $icons.find('.animated_icon_with_text_holder').each(function() { maxHeightIcons = maxHeightIcons > $j(this).height() ? maxHeightIcons : $j(this).height(); }); maxHeightIcons = maxHeightIcons + 30; //margin for client is 30 var numberOfIconsPerRow = Math.ceil((qode_icons_width/iconWidth)); var numberOffullRows = Math.floor(countIcons / numberOfIconsPerRow); var numberOfIconsInLastRow = countIcons - (numberOfIconsPerRow * numberOffullRows); if(numberOfIconsInLastRow === 0){ numberOfIconsInLastRow = numberOfIconsPerRow; } $icons.find( ".animated_icon_with_text_holder" ).removeClass('border-bottom-none'); var item_start_from = countIcons - numberOfIconsInLastRow - 1; $icons.find( ".animated_icon_with_text_holder:gt("+ item_start_from +")" ).addClass('border-bottom-none'); }); } }
function countAnimatedTextIconPerRow(){ "use strict"; if($j('.animated_icons_with_text').length){ $j('.animated_icons_with_text').each(function() { var $icons = $j(this); var qode_icons_height = $icons.height(); var qode_icons_width = $icons.width(); var maxHeightIcons; var iconWidth = $icons.find('.animated_icon_with_text_holder').width() + 1; // 1px because safari round on smaller number var countIcons = $icons.find('.animated_icon_with_text_holder').length; $icons.find('.animated_icon_with_text_holder').each(function() { maxHeightIcons = maxHeightIcons > $j(this).height() ? maxHeightIcons : $j(this).height(); }); maxHeightIcons = maxHeightIcons + 30; //margin for client is 30 var numberOfIconsPerRow = Math.ceil((qode_icons_width/iconWidth)); var numberOffullRows = Math.floor(countIcons / numberOfIconsPerRow); var numberOfIconsInLastRow = countIcons - (numberOfIconsPerRow * numberOffullRows); if(numberOfIconsInLastRow === 0){ numberOfIconsInLastRow = numberOfIconsPerRow; } $icons.find( ".animated_icon_with_text_holder" ).removeClass('border-bottom-none'); var item_start_from = countIcons - numberOfIconsInLastRow - 1; $icons.find( ".animated_icon_with_text_holder:gt("+ item_start_from +")" ).addClass('border-bottom-none'); }); } }
JavaScript
function anchorActiveState(me){ if(me.closest('.main_menu').length > 0){ $j('.main_menu a').parent().removeClass('active'); } if(me.closest('.vertical_menu').length > 0){ $j('.vertical_menu a').parent().removeClass('active'); } if(me.closest('.second').length === 0){ me.parent().addClass('active'); }else{ me.closest('.second').parent().addClass('active'); } if(me.closest('.mobile_menu').length > 0){ $j('.mobile_menu a').parent().removeClass('active'); me.parent().addClass('active'); } $j('.mobile_menu a, .main_menu a, .vertical_menu a').removeClass('current'); me.addClass('current'); }
function anchorActiveState(me){ if(me.closest('.main_menu').length > 0){ $j('.main_menu a').parent().removeClass('active'); } if(me.closest('.vertical_menu').length > 0){ $j('.vertical_menu a').parent().removeClass('active'); } if(me.closest('.second').length === 0){ me.parent().addClass('active'); }else{ me.closest('.second').parent().addClass('active'); } if(me.closest('.mobile_menu').length > 0){ $j('.mobile_menu a').parent().removeClass('active'); me.parent().addClass('active'); } $j('.mobile_menu a, .main_menu a, .vertical_menu a').removeClass('current'); me.addClass('current'); }
JavaScript
function initCheckSafariBrowser(){ "use strict"; if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) { $j('body').addClass('safari_browser'); } }
function initCheckSafariBrowser(){ "use strict"; if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) { $j('body').addClass('safari_browser'); } }
JavaScript
function footerWidth(){ "use strict"; if($j('.uncover').length && $j('body').hasClass('vertical_menu_enabled') && $window_width > 1000){ $j('.uncover').width($window_width - $j('.vertical_menu_area').width()); } else{ $j('.uncover').css('width','100%'); } }
function footerWidth(){ "use strict"; if($j('.uncover').length && $j('body').hasClass('vertical_menu_enabled') && $window_width > 1000){ $j('.uncover').width($window_width - $j('.vertical_menu_area').width()); } else{ $j('.uncover').css('width','100%'); } }
JavaScript
function initCoverBoxes(){ if($j('.cover_boxes').length) { $j('.cover_boxes').each(function(){ var active_element = 0; var data_active_element = 1; if(typeof $j(this).data('active-element') !== 'undefined' && $j(this).data('active-element') !== false) { data_active_element = parseFloat($j(this).data('active-element')); active_element = data_active_element - 1; } var number_of_columns = 3; //validate active element active_element = data_active_element > number_of_columns ? 0 : active_element; $j(this).find('li').eq(active_element).addClass('act'); var cover_boxed = $j(this); $j(this).find('li').each(function(){ $j(this).on('mouseenter', function() { $j(cover_boxed).find('li').removeClass('act'); $j(this).addClass('act'); }); }); }); } }
function initCoverBoxes(){ if($j('.cover_boxes').length) { $j('.cover_boxes').each(function(){ var active_element = 0; var data_active_element = 1; if(typeof $j(this).data('active-element') !== 'undefined' && $j(this).data('active-element') !== false) { data_active_element = parseFloat($j(this).data('active-element')); active_element = data_active_element - 1; } var number_of_columns = 3; //validate active element active_element = data_active_element > number_of_columns ? 0 : active_element; $j(this).find('li').eq(active_element).addClass('act'); var cover_boxed = $j(this); $j(this).find('li').each(function(){ $j(this).on('mouseenter', function() { $j(cover_boxed).find('li').removeClass('act'); $j(this).addClass('act'); }); }); }); } }
JavaScript
function createContentMenu(){ "use strict"; var content_menu = $j(".content_menu"); content_menu.each(function(){ if($j(this).find('ul').length === 0){ if($j(this).css('background-color') !== ""){ var background_color = $j(this).css('background-color'); } var content_menu_ul = $j("<ul class='menu'></ul>"); content_menu_ul.appendTo($j(this)); var sections = $j(this).siblings('.in_content_menu'); if(sections.length){ sections.each(function(){ var section_href = $j(this).data("q_id"); var section_title = $j(this).data('q_title'); var section_icon = $j(this).data('q_icon'); var li = $j("<li />"); var icon = $j("<i />", {"class": 'fa '+section_icon}); var link = $j("<a />", {"href": section_href, "html": "<span>" + section_title + "</span>"}); var arrow; if(background_color !== ""){ arrow = $j("<div />", {"class": 'arrow', "style": 'border-color: '+background_color+' transparent transparent transparent'}); } else { arrow = $j("<div />", {"class": 'arrow'}); } icon.prependTo(link); link.appendTo(li); arrow.appendTo(li); li.appendTo(content_menu_ul); }); } } }); }
function createContentMenu(){ "use strict"; var content_menu = $j(".content_menu"); content_menu.each(function(){ if($j(this).find('ul').length === 0){ if($j(this).css('background-color') !== ""){ var background_color = $j(this).css('background-color'); } var content_menu_ul = $j("<ul class='menu'></ul>"); content_menu_ul.appendTo($j(this)); var sections = $j(this).siblings('.in_content_menu'); if(sections.length){ sections.each(function(){ var section_href = $j(this).data("q_id"); var section_title = $j(this).data('q_title'); var section_icon = $j(this).data('q_icon'); var li = $j("<li />"); var icon = $j("<i />", {"class": 'fa '+section_icon}); var link = $j("<a />", {"href": section_href, "html": "<span>" + section_title + "</span>"}); var arrow; if(background_color !== ""){ arrow = $j("<div />", {"class": 'arrow', "style": 'border-color: '+background_color+' transparent transparent transparent'}); } else { arrow = $j("<div />", {"class": 'arrow'}); } icon.prependTo(link); link.appendTo(li); arrow.appendTo(li); li.appendTo(content_menu_ul); }); } } }); }
JavaScript
function createSelectContentMenu(){ "use strict"; var content_menu = $j(".content_menu"); content_menu.each(function(){ var $this = $j(this); var $menu_select = $j("<ul></ul>"); $menu_select.appendTo($j(this).find('.nav_select_menu')); $j(this).find("ul.menu li a").each(function(){ var menu_url = $j(this).attr("href"); var menu_text = $j(this).text(); var menu_icon = $j(this).find('i').clone(); if ($j(this).parents("li").length === 2) { menu_text = "&nbsp;&nbsp;&nbsp;" + menu_text; } if ($j(this).parents("li").length === 3) { menu_text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + menu_text; } if ($j(this).parents("li").length > 3) { menu_text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + menu_text; } var li = $j("<li />"); var link = $j("<a />", {"href": menu_url, "html": menu_text}); menu_icon.prependTo(link); link.appendTo(li); li.appendTo($menu_select); }); $this.find(".nav_select_button").on('click', function() { if ($this.find('.nav_select_menu ul').is(":visible")){ $this.find('.nav_select_menu ul').slideUp(); } else { $this.find('.nav_select_menu ul').slideDown(); } return false; }); $this.find(".nav_select_menu ul li a").on('click',function () { $this.find('.nav_select_menu ul').slideUp(); var $link = $j(this); var $target = $link.attr("href"); var targetOffset = $j("div.wpb_row[data-q_id='" + $target + "'],section.parallax_section_holder[data-q_id='" + $target + "'],.qode-elementor-content-menu-item[data-q_id='" + $target + "']").offset().top; $j('html,body').stop().animate({scrollTop: targetOffset }, 500, 'swing', function(){ $j('nav.content_menu ul li').removeClass('active'); $link.parent().addClass('active'); }); return false; }); }); }
function createSelectContentMenu(){ "use strict"; var content_menu = $j(".content_menu"); content_menu.each(function(){ var $this = $j(this); var $menu_select = $j("<ul></ul>"); $menu_select.appendTo($j(this).find('.nav_select_menu')); $j(this).find("ul.menu li a").each(function(){ var menu_url = $j(this).attr("href"); var menu_text = $j(this).text(); var menu_icon = $j(this).find('i').clone(); if ($j(this).parents("li").length === 2) { menu_text = "&nbsp;&nbsp;&nbsp;" + menu_text; } if ($j(this).parents("li").length === 3) { menu_text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + menu_text; } if ($j(this).parents("li").length > 3) { menu_text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + menu_text; } var li = $j("<li />"); var link = $j("<a />", {"href": menu_url, "html": menu_text}); menu_icon.prependTo(link); link.appendTo(li); li.appendTo($menu_select); }); $this.find(".nav_select_button").on('click', function() { if ($this.find('.nav_select_menu ul').is(":visible")){ $this.find('.nav_select_menu ul').slideUp(); } else { $this.find('.nav_select_menu ul').slideDown(); } return false; }); $this.find(".nav_select_menu ul li a").on('click',function () { $this.find('.nav_select_menu ul').slideUp(); var $link = $j(this); var $target = $link.attr("href"); var targetOffset = $j("div.wpb_row[data-q_id='" + $target + "'],section.parallax_section_holder[data-q_id='" + $target + "'],.qode-elementor-content-menu-item[data-q_id='" + $target + "']").offset().top; $j('html,body').stop().animate({scrollTop: targetOffset }, 500, 'swing', function(){ $j('nav.content_menu ul li').removeClass('active'); $link.parent().addClass('active'); }); return false; }); }); }
JavaScript
function contentMenuPosition(){ "use strict"; if($j('nav.content_menu').length){ if(content_menu_position > sticky_amount){ var x = min_header_height_sticky; }else{ var x = 0; } if(content_menu_position - x - content_menu_top_add - $scroll <= 0 && ($j('header').hasClass('stick') || $j('header').hasClass('stick_with_left_right_menu'))){ if(content_menu_position < sticky_amount){ if($scroll > sticky_amount){ $j('nav.content_menu').css({'position': 'fixed', 'top': min_header_height_sticky + content_menu_top_add}).addClass('fixed'); }else{ $j('nav.content_menu').css({'position': 'fixed', 'top': 0, transition:'none'}).addClass('fixed'); } }else{ $j('nav.content_menu').css({'position': 'fixed', 'top': min_header_height_sticky + content_menu_top_add}).addClass('fixed'); } $j('header.sticky').addClass('no_shadow'); $j('.content > .content_inner > .container > .container_inner').css('margin-top',content_line_height); $j('.content > .content_inner > .full_width').css('margin-top',content_line_height); } else if(content_menu_position - content_menu_top - content_menu_top_add - $scroll <= 0 && !($j('header').hasClass('stick'))) { $j('nav.content_menu').css({'position': 'fixed', 'top': content_menu_top + content_menu_top_add}).addClass('fixed'); $j('.content > .content_inner > .container > .container_inner').css('margin-top',content_line_height); $j('.content > .content_inner > .full_width').css('margin-top',content_line_height); } else { $j('nav.content_menu').css({'position': 'relative', 'top': '0px'}).removeClass('fixed'); $j('header.sticky').removeClass('no_shadow'); $j('.content > .content_inner > .container > .container_inner').css('margin-top','0px'); $j('.content > .content_inner > .full_width').css('margin-top','0px'); } $j('.content .in_content_menu').waypoint( function(direction) { var $active = $j(this); var id = $active.data("q_id"); $j("nav.content_menu.fixed li a").each(function(){ var i = $j(this).attr("href"); if(i === id){ $j(this).parent().addClass('active'); }else{ $j(this).parent().removeClass('active'); } }); }, { offset: '150' }); } }
function contentMenuPosition(){ "use strict"; if($j('nav.content_menu').length){ if(content_menu_position > sticky_amount){ var x = min_header_height_sticky; }else{ var x = 0; } if(content_menu_position - x - content_menu_top_add - $scroll <= 0 && ($j('header').hasClass('stick') || $j('header').hasClass('stick_with_left_right_menu'))){ if(content_menu_position < sticky_amount){ if($scroll > sticky_amount){ $j('nav.content_menu').css({'position': 'fixed', 'top': min_header_height_sticky + content_menu_top_add}).addClass('fixed'); }else{ $j('nav.content_menu').css({'position': 'fixed', 'top': 0, transition:'none'}).addClass('fixed'); } }else{ $j('nav.content_menu').css({'position': 'fixed', 'top': min_header_height_sticky + content_menu_top_add}).addClass('fixed'); } $j('header.sticky').addClass('no_shadow'); $j('.content > .content_inner > .container > .container_inner').css('margin-top',content_line_height); $j('.content > .content_inner > .full_width').css('margin-top',content_line_height); } else if(content_menu_position - content_menu_top - content_menu_top_add - $scroll <= 0 && !($j('header').hasClass('stick'))) { $j('nav.content_menu').css({'position': 'fixed', 'top': content_menu_top + content_menu_top_add}).addClass('fixed'); $j('.content > .content_inner > .container > .container_inner').css('margin-top',content_line_height); $j('.content > .content_inner > .full_width').css('margin-top',content_line_height); } else { $j('nav.content_menu').css({'position': 'relative', 'top': '0px'}).removeClass('fixed'); $j('header.sticky').removeClass('no_shadow'); $j('.content > .content_inner > .container > .container_inner').css('margin-top','0px'); $j('.content > .content_inner > .full_width').css('margin-top','0px'); } $j('.content .in_content_menu').waypoint( function(direction) { var $active = $j(this); var id = $active.data("q_id"); $j("nav.content_menu.fixed li a").each(function(){ var i = $j(this).attr("href"); if(i === id){ $j(this).parent().addClass('active'); }else{ $j(this).parent().removeClass('active'); } }); }, { offset: '150' }); } }
JavaScript
function contentMenuCheckLastSection(){ "use strict"; if($j('nav.content_menu').length){ if($j('.content .in_content_menu').length){ var last_from_top = $j('.content .in_content_menu:last').offset().top + $j('.content .in_content_menu:last').height(); var first_from_top = $j('.content .in_content_menu:first').offset().top - content_menu_top - content_menu_top_add - 100; //60 is height of content menu if(last_from_top < $scroll){ $j("nav.content_menu.fixed li").removeClass('active'); } if(first_from_top > $scroll){ $j('nav.content_menu li:first, nav.content_menu ul.menu li:first').removeClass('active'); } } } }
function contentMenuCheckLastSection(){ "use strict"; if($j('nav.content_menu').length){ if($j('.content .in_content_menu').length){ var last_from_top = $j('.content .in_content_menu:last').offset().top + $j('.content .in_content_menu:last').height(); var first_from_top = $j('.content .in_content_menu:first').offset().top - content_menu_top - content_menu_top_add - 100; //60 is height of content menu if(last_from_top < $scroll){ $j("nav.content_menu.fixed li").removeClass('active'); } if(first_from_top > $scroll){ $j('nav.content_menu li:first, nav.content_menu ul.menu li:first').removeClass('active'); } } } }
JavaScript
function contentMenuScrollTo(){ "use strict"; if($j('nav.content_menu').length){ $j("nav.content_menu ul.menu li a").on('click', function(e){ e.preventDefault(); var $this = $j(this); if($j(this).parent().hasClass('active')){ return false; } var $target = $this.attr("href"); var targetOffset = $j("div.wpb_row[data-q_id='" + $target + "'],section.parallax_section_holder[data-q_id='" + $target + "'],.qode-elementor-content-menu-item[data-q_id='" + $target + "']").offset().top - content_line_height - content_menu_top - content_menu_top_add; $j('html,body').stop().animate({scrollTop: targetOffset }, 500, 'swing', function(){ $j('nav.content_menu ul li').removeClass('active'); $this.parent().addClass('active'); }); return false; }); } }
function contentMenuScrollTo(){ "use strict"; if($j('nav.content_menu').length){ $j("nav.content_menu ul.menu li a").on('click', function(e){ e.preventDefault(); var $this = $j(this); if($j(this).parent().hasClass('active')){ return false; } var $target = $this.attr("href"); var targetOffset = $j("div.wpb_row[data-q_id='" + $target + "'],section.parallax_section_holder[data-q_id='" + $target + "'],.qode-elementor-content-menu-item[data-q_id='" + $target + "']").offset().top - content_line_height - content_menu_top - content_menu_top_add; $j('html,body').stop().animate({scrollTop: targetOffset }, 500, 'swing', function(){ $j('nav.content_menu ul li').removeClass('active'); $this.parent().addClass('active'); }); return false; }); } }
JavaScript
function initImageGallerySliderNoSpace(){ if($j('.qode_image_gallery_no_space').length){ $j('.qode_image_gallery_no_space').each(function(){ $j(this).animate({'opacity': 1},1000); $j(this).find('.qode_image_gallery_holder').lemmonSlider({infinite: true}); }); //disable click on non active image $j('.qode_image_gallery_no_space').on('click', 'li:not(.active) a', function() { if(window.innerWidth>800){ return false; } else { return true; } }); } }
function initImageGallerySliderNoSpace(){ if($j('.qode_image_gallery_no_space').length){ $j('.qode_image_gallery_no_space').each(function(){ $j(this).animate({'opacity': 1},1000); $j(this).find('.qode_image_gallery_holder').lemmonSlider({infinite: true}); }); //disable click on non active image $j('.qode_image_gallery_no_space').on('click', 'li:not(.active) a', function() { if(window.innerWidth>800){ return false; } else { return true; } }); } }
JavaScript
function checkVerticalSplitSectionsForHeaderStyle(section_header_style, default_header_style, data_disable_header_skin_change){ "use strict"; if(section_header_style != ""){ if(data_disable_header_skin_change == 'no'){$j('header.page_header').removeClass('dark light').addClass(section_header_style)}; $j('#multiscroll-nav').removeClass('dark light').addClass(section_header_style); }else{ if(data_disable_header_skin_change == 'no'){$j('header.page_header').removeClass('dark light').addClass(default_header_style)}; $j('#multiscroll-nav').removeClass('dark light').addClass(default_header_style); } }
function checkVerticalSplitSectionsForHeaderStyle(section_header_style, default_header_style, data_disable_header_skin_change){ "use strict"; if(section_header_style != ""){ if(data_disable_header_skin_change == 'no'){$j('header.page_header').removeClass('dark light').addClass(section_header_style)}; $j('#multiscroll-nav').removeClass('dark light').addClass(section_header_style); }else{ if(data_disable_header_skin_change == 'no'){$j('header.page_header').removeClass('dark light').addClass(default_header_style)}; $j('#multiscroll-nav').removeClass('dark light').addClass(default_header_style); } }
JavaScript
function qodeHorizontalMarqueeLoop() { var marquees = $j('.qode-horizontal-marquee.qode-loop'); if (marquees.length) { marquees.each(function(){ var marquee = $j(this); //clone content holder for loop effect marquee.find('.qode-horizontal-marquee-inner').clone().appendTo(marquee); var marqueeElements = marquee.find('.qode-horizontal-marquee-inner'), originalItem = marqueeElements.first(), auxItem = marqueeElements.last(); var qodeMarqueeInit = function () { var delta = 1, //pixel movement speedCoeff = 1, // below 1 to slow down, above 1 to speed up currentPos, offsetCorrection = marquee.data('spacing') !== '' ? marquee.data('spacing') : 0, //add item spacing to calculations to preserve whitespace marqueeWidth; var marqueeReset = function() { marqueeWidth = originalItem.width() + offsetCorrection; currentPos = 0; originalItem.css({ 'left': 0 }); auxItem.css({ 'width': marqueeWidth, //same width as the original marquee element 'left': marqueeWidth //set to the right of the original marquee element }); } marqueeReset(); qodeRequestAnimationFrame(); //show marquee item one by one on shortcode initialization if (marquee.hasClass('qode-appear-fx')) { marquee.addClass('qode-appeared'); } marqueeElements.each(function(i){ var marqueeElement = $j(this); //movement loop var qodeMarqueeSequence = function() { currentPos -= delta; //reset marquee element if (marqueeElement.position().left <= -marqueeWidth) { marqueeElement.css('left', parseInt(marqueeWidth - delta)); currentPos = 0; } //move marquee element marqueeElement.css({ 'transform': 'translate3d('+speedCoeff*currentPos+'px,0,0)' }); //fix overlap issue if (Math.abs(originalItem.position().left - auxItem.position().left) < marqueeWidth - 1) { marqueeReset(); } //repeat requestNextAnimationFrame(qodeMarqueeSequence); }; //start loop qodeMarqueeSequence(); }); //reset marquee on resize end $j(window).resize(function(){ setTimeout(function(){ marqueeReset(); }, 200); }); }; //init marquee.waitForImages(function(){ qodeMarqueeInit(); }); }); } }
function qodeHorizontalMarqueeLoop() { var marquees = $j('.qode-horizontal-marquee.qode-loop'); if (marquees.length) { marquees.each(function(){ var marquee = $j(this); //clone content holder for loop effect marquee.find('.qode-horizontal-marquee-inner').clone().appendTo(marquee); var marqueeElements = marquee.find('.qode-horizontal-marquee-inner'), originalItem = marqueeElements.first(), auxItem = marqueeElements.last(); var qodeMarqueeInit = function () { var delta = 1, //pixel movement speedCoeff = 1, // below 1 to slow down, above 1 to speed up currentPos, offsetCorrection = marquee.data('spacing') !== '' ? marquee.data('spacing') : 0, //add item spacing to calculations to preserve whitespace marqueeWidth; var marqueeReset = function() { marqueeWidth = originalItem.width() + offsetCorrection; currentPos = 0; originalItem.css({ 'left': 0 }); auxItem.css({ 'width': marqueeWidth, //same width as the original marquee element 'left': marqueeWidth //set to the right of the original marquee element }); } marqueeReset(); qodeRequestAnimationFrame(); //show marquee item one by one on shortcode initialization if (marquee.hasClass('qode-appear-fx')) { marquee.addClass('qode-appeared'); } marqueeElements.each(function(i){ var marqueeElement = $j(this); //movement loop var qodeMarqueeSequence = function() { currentPos -= delta; //reset marquee element if (marqueeElement.position().left <= -marqueeWidth) { marqueeElement.css('left', parseInt(marqueeWidth - delta)); currentPos = 0; } //move marquee element marqueeElement.css({ 'transform': 'translate3d('+speedCoeff*currentPos+'px,0,0)' }); //fix overlap issue if (Math.abs(originalItem.position().left - auxItem.position().left) < marqueeWidth - 1) { marqueeReset(); } //repeat requestNextAnimationFrame(qodeMarqueeSequence); }; //start loop qodeMarqueeSequence(); }); //reset marquee on resize end $j(window).resize(function(){ setTimeout(function(){ marqueeReset(); }, 200); }); }; //init marquee.waitForImages(function(){ qodeMarqueeInit(); }); }); } }
JavaScript
function qodeRequestAnimationFrame() { if (!$j('html').hasClass('touch') && !window.requestAnimFrame) { window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function */ callback, /* DOMElement */ element){ window.setTimeout(callback, 1000 / 60); }; })(); } }
function qodeRequestAnimationFrame() { if (!$j('html').hasClass('touch') && !window.requestAnimFrame) { window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function */ callback, /* DOMElement */ element){ window.setTimeout(callback, 1000 / 60); }; })(); } }
JavaScript
function initInDeviceSlider() { "use strict"; var sliders = $j('.qode-in-device-slider'); sliders.each(function() { var slider = $j(this).find('.qode-ids-slider'); var navigation = slider.data('navigation') == 'yes' ? true : false; var auto_start = slider.data('auto-start') == 'yes' ? true : false; var slide_timeout = auto_start ? slider.data('timeout') : 0; var is_in_marquee = slider.closest('.qode-horizontal-marquee').length ? true : false; var IEver = getIEversion(); if (IEver > 0) { slider.addClass('qode-ids-ie-specific'); } slider.flexslider({ animation: "slide", animationSpeed: 700, animationLoop: true, useCSS: true, touch: !is_in_marquee, slideshow: auto_start, slideshowSpeed: slide_timeout, directionNav: navigation, controlNav: false, prevText: '<i class="icon-arrows-left"></i>', nextText: '<i class="icon-arrows-right"></i>', start: function(slider) { slider.find('img').addClass('visible'); slider.closest('.qode-ids-slider-holder').find('.qode-ids-frame').addClass('visible'); if (slider.is('.qode-ids-titles-on-hover')) { slider.hover( function() { $j(this).find('.qode-ids-link').addClass('hovered'); }, function() { $j(this).find('.qode-ids-link').removeClass('hovered'); } ); } } }); if (is_in_marquee) { var dragStart, clickable = false; var handleDragStart = function(event) { event = typeof event.originalEvent !== 'undefined' ? event.originalEvent : event; event = event.type == 'touchstart' ? event.touches[0] : event; dragStart = { x: event.clientX, y: event.clientY }; }; var handleDragStop = function(event) { event = typeof event.originalEvent !== 'undefined' ? event.originalEvent : event; event = event.type == 'touchend' ? event.changedTouches[0] : event; var dragEnd = { x: event.clientX, y: event.clientY }; if (Math.abs(dragEnd.x - dragStart.x) < 10) { clickable = true; } }; var handleClick = function(event) { if (clickable) { clickable = false; } else { event.preventDefault(); } }; slider.find('.qode-ids-link') .on('dragstart', function(event) { event.preventDefault(); }) .on('click', handleClick) .on('mousedown touchstart', handleDragStart) .on('mouseup touchend', handleDragStop); } }); }
function initInDeviceSlider() { "use strict"; var sliders = $j('.qode-in-device-slider'); sliders.each(function() { var slider = $j(this).find('.qode-ids-slider'); var navigation = slider.data('navigation') == 'yes' ? true : false; var auto_start = slider.data('auto-start') == 'yes' ? true : false; var slide_timeout = auto_start ? slider.data('timeout') : 0; var is_in_marquee = slider.closest('.qode-horizontal-marquee').length ? true : false; var IEver = getIEversion(); if (IEver > 0) { slider.addClass('qode-ids-ie-specific'); } slider.flexslider({ animation: "slide", animationSpeed: 700, animationLoop: true, useCSS: true, touch: !is_in_marquee, slideshow: auto_start, slideshowSpeed: slide_timeout, directionNav: navigation, controlNav: false, prevText: '<i class="icon-arrows-left"></i>', nextText: '<i class="icon-arrows-right"></i>', start: function(slider) { slider.find('img').addClass('visible'); slider.closest('.qode-ids-slider-holder').find('.qode-ids-frame').addClass('visible'); if (slider.is('.qode-ids-titles-on-hover')) { slider.hover( function() { $j(this).find('.qode-ids-link').addClass('hovered'); }, function() { $j(this).find('.qode-ids-link').removeClass('hovered'); } ); } } }); if (is_in_marquee) { var dragStart, clickable = false; var handleDragStart = function(event) { event = typeof event.originalEvent !== 'undefined' ? event.originalEvent : event; event = event.type == 'touchstart' ? event.touches[0] : event; dragStart = { x: event.clientX, y: event.clientY }; }; var handleDragStop = function(event) { event = typeof event.originalEvent !== 'undefined' ? event.originalEvent : event; event = event.type == 'touchend' ? event.changedTouches[0] : event; var dragEnd = { x: event.clientX, y: event.clientY }; if (Math.abs(dragEnd.x - dragStart.x) < 10) { clickable = true; } }; var handleClick = function(event) { if (clickable) { clickable = false; } else { event.preventDefault(); } }; slider.find('.qode-ids-link') .on('dragstart', function(event) { event.preventDefault(); }) .on('click', handleClick) .on('mousedown touchstart', handleDragStart) .on('mouseup touchend', handleDragStop); } }); }
JavaScript
function checkSVG(element) { "use strict"; var el = element.find('.active .qode_slide-svg-holder'); var drawing_enabled = el.data('svg-drawing'); if (drawing_enabled === 'yes') { drawSVG(el); } }
function checkSVG(element) { "use strict"; var el = element.find('.active .qode_slide-svg-holder'); var drawing_enabled = el.data('svg-drawing'); if (drawing_enabled === 'yes') { drawSVG(el); } }
JavaScript
function drawSVG(svg){ "use strict"; var svgs = Array.prototype.slice.call( svg.find('svg') ), svgArr = [], resizeTimeout; // the svgs already shown... svgs.forEach( function( el, i ) { var svg = new SVGEl( el ); svgArr[i] = svg; setTimeout(function( el ) { return function() { svg.render(); }; }( el ), 0 );//0ms pause before drawing } ); }
function drawSVG(svg){ "use strict"; var svgs = Array.prototype.slice.call( svg.find('svg') ), svgArr = [], resizeTimeout; // the svgs already shown... svgs.forEach( function( el, i ) { var svg = new SVGEl( el ); svgArr[i] = svg; setTimeout(function( el ) { return function() { svg.render(); }; }( el ), 0 );//0ms pause before drawing } ); }
JavaScript
function qodeLazyImages() { $j.fn.preloader = function (action, callback) { if (!!action && action == 'destroy') { this.find('.qode-lazy-preloader').remove(); } else { var block = $j('<div class="qode-lazy-preloader"></div>'); $j('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="75" width="75" viewbox="0 0 75 75"><circle stroke-linecap="round" cx="37.5" cy="37.5" r="33.5" stroke-width="4"/></svg>').appendTo(block); block.appendTo(this); if(typeof callback == 'function') callback(); } return this; }; $j('.qode-lazy-image[data-image][data-lazy="true"]:not(.lazyLoading)').each(function(i, object) { object = $j(object); if(object.attr('data-ratio')) { object.height(object.width()*object.data('ratio')); } var rect = object[0].getBoundingClientRect(), vh = ($window_height || document.documentElement.clientHeight), vw = ($window_width || document.documentElement.clientWidth), oh = object.outerHeight(), ow = object.outerWidth(); if( ( rect.top !=0 || rect.right !=0 || rect.bottom !=0 || rect.left !=0 ) && ( rect.top >= 0 || rect.top + oh >= 0 ) && ( rect.bottom >=0 && rect.bottom - oh - vh <= 0 ) && ( rect.left >= 0 || rect.left + ow >= 0 ) && ( rect.right >=0 && rect.right - ow - vw <= 0 ) ) { var preloader = null; if(object.prop('tagName') == 'IMG') { preloader = object.parent(); } else { preloader = object; } if(!!preloader) { preloader.preloader('init'); } object.addClass('lazyLoading'); var imageObj = new Image(); $j(imageObj).on('load', function() { preloader.preloader('destroy'); object .removeAttr('data-image') .removeData('image') .removeAttr('data-lazy') .removeData('lazy') .removeClass('lazyLoading'); switch(object.prop('tagName')) { case 'IMG': object.attr('src', $j(this).attr('src')); object.height('auto'); break; case 'DIV': default: object.css('background-image', 'url(' + $j(this).attr('src') + ')'); break; } }).attr('src', object.data('image')); } }); }
function qodeLazyImages() { $j.fn.preloader = function (action, callback) { if (!!action && action == 'destroy') { this.find('.qode-lazy-preloader').remove(); } else { var block = $j('<div class="qode-lazy-preloader"></div>'); $j('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="75" width="75" viewbox="0 0 75 75"><circle stroke-linecap="round" cx="37.5" cy="37.5" r="33.5" stroke-width="4"/></svg>').appendTo(block); block.appendTo(this); if(typeof callback == 'function') callback(); } return this; }; $j('.qode-lazy-image[data-image][data-lazy="true"]:not(.lazyLoading)').each(function(i, object) { object = $j(object); if(object.attr('data-ratio')) { object.height(object.width()*object.data('ratio')); } var rect = object[0].getBoundingClientRect(), vh = ($window_height || document.documentElement.clientHeight), vw = ($window_width || document.documentElement.clientWidth), oh = object.outerHeight(), ow = object.outerWidth(); if( ( rect.top !=0 || rect.right !=0 || rect.bottom !=0 || rect.left !=0 ) && ( rect.top >= 0 || rect.top + oh >= 0 ) && ( rect.bottom >=0 && rect.bottom - oh - vh <= 0 ) && ( rect.left >= 0 || rect.left + ow >= 0 ) && ( rect.right >=0 && rect.right - ow - vw <= 0 ) ) { var preloader = null; if(object.prop('tagName') == 'IMG') { preloader = object.parent(); } else { preloader = object; } if(!!preloader) { preloader.preloader('init'); } object.addClass('lazyLoading'); var imageObj = new Image(); $j(imageObj).on('load', function() { preloader.preloader('destroy'); object .removeAttr('data-image') .removeData('image') .removeAttr('data-lazy') .removeData('lazy') .removeClass('lazyLoading'); switch(object.prop('tagName')) { case 'IMG': object.attr('src', $j(this).attr('src')); object.height('auto'); break; case 'DIV': default: object.css('background-image', 'url(' + $j(this).attr('src') + ')'); break; } }).attr('src', object.data('image')); } }); }
JavaScript
function qodeInitAdvancedImageGalleryMasonry(){ var holder = $('.qode-advanced-image-gallery.qode-aig-masonry-type'); if(holder.length){ holder.each(function(){ var thisHolder = $(this), masonry = thisHolder.find('.qode-aig-masonry'), size = thisHolder.find('.qode-aig-grid-sizer').width(); qodeResizeAdvancedImageGalleryMasonryItems(size, thisHolder); masonry.waitForImages(function() { masonry.isotope({ layoutMode: 'packery', itemSelector: '.qode-aig-image', percentPosition: true, packery: { gutter: '.qode-aig-grid-gutter', columnWidth: '.qode-aig-grid-sizer' } }); setTimeout(function() { masonry.isotope('layout'); initParallax(); }, 800); masonry.css('opacity', '1'); }); }); } }
function qodeInitAdvancedImageGalleryMasonry(){ var holder = $('.qode-advanced-image-gallery.qode-aig-masonry-type'); if(holder.length){ holder.each(function(){ var thisHolder = $(this), masonry = thisHolder.find('.qode-aig-masonry'), size = thisHolder.find('.qode-aig-grid-sizer').width(); qodeResizeAdvancedImageGalleryMasonryItems(size, thisHolder); masonry.waitForImages(function() { masonry.isotope({ layoutMode: 'packery', itemSelector: '.qode-aig-image', percentPosition: true, packery: { gutter: '.qode-aig-grid-gutter', columnWidth: '.qode-aig-grid-sizer' } }); setTimeout(function() { masonry.isotope('layout'); initParallax(); }, 800); masonry.css('opacity', '1'); }); }); } }
JavaScript
function receiveSort(event, ui) { event.stopPropagation(); if (this.view.isCollectionFilled()) { jQuery(ui.sender).sortable('cancel'); return; } var model = elementor.channels.data.request('dragging:model'), draggedElType = model.get('elType'), draggedIsInnerSection = 'section' === draggedElType && model.get('isInner'), targetIsInnerColumn = 'column' === this.view.getElementType() && this.view.isInner(); if (draggedIsInnerSection && targetIsInnerColumn) { jQuery(ui.sender).sortable('cancel'); return; } $e.run('document/elements/move', { container: elementor.channels.data.request('dragging:view').getContainer(), target: this.view.getContainer(), options: { at: this.getSortedElementNewIndex(ui.item) } }); }
function receiveSort(event, ui) { event.stopPropagation(); if (this.view.isCollectionFilled()) { jQuery(ui.sender).sortable('cancel'); return; } var model = elementor.channels.data.request('dragging:model'), draggedElType = model.get('elType'), draggedIsInnerSection = 'section' === draggedElType && model.get('isInner'), targetIsInnerColumn = 'column' === this.view.getElementType() && this.view.isInner(); if (draggedIsInnerSection && targetIsInnerColumn) { jQuery(ui.sender).sortable('cancel'); return; } $e.run('document/elements/move', { container: elementor.channels.data.request('dragging:view').getContainer(), target: this.view.getContainer(), options: { at: this.getSortedElementNewIndex(ui.item) } }); }
JavaScript
function qodefOnDocumentReady() { qodefThemeRegistration.init(); qodefInitDemosMasonry.init(); qodefInitDemoImportPopup.init(); }
function qodefOnDocumentReady() { qodefThemeRegistration.init(); qodefInitDemosMasonry.init(); qodefInitDemoImportPopup.init(); }
JavaScript
copy() { let cell = new Cell(); cell.setState(this.alive); return cell; }
copy() { let cell = new Cell(); cell.setState(this.alive); return cell; }
JavaScript
step() { // Make a new map containing the future state of the world. Game of Life rules are based on // current timestep. We will use this to maintain next state. const nextState = {}; Object.keys(this.cells).forEach(coordStr => { const pastCell = this.cells[coordStr]; let livingNeighbors = 0; const coords = Coord.fromString(coordStr); const nextCell = pastCell.copy(); // Grab the number of living cells surrounding the current cell. neighbors(coords).forEach(neighborCoords => { const neighbor = this.cells[neighborCoords]; if (neighbor && neighbor.alive) { livingNeighbors++; } }); // Apply Conway's rules. if (pastCell.alive) { if (livingNeighbors < 2) { // Kill due to underpopulation nextCell.kill(); } else if (livingNeighbors > 3) { // Kill due to overpopulation nextCell.kill(); } } else { if (livingNeighbors == 3) { // Reproduce nextCell.spawn(); } } nextState[coordStr] = nextCell; }); this.cells = nextState; }
step() { // Make a new map containing the future state of the world. Game of Life rules are based on // current timestep. We will use this to maintain next state. const nextState = {}; Object.keys(this.cells).forEach(coordStr => { const pastCell = this.cells[coordStr]; let livingNeighbors = 0; const coords = Coord.fromString(coordStr); const nextCell = pastCell.copy(); // Grab the number of living cells surrounding the current cell. neighbors(coords).forEach(neighborCoords => { const neighbor = this.cells[neighborCoords]; if (neighbor && neighbor.alive) { livingNeighbors++; } }); // Apply Conway's rules. if (pastCell.alive) { if (livingNeighbors < 2) { // Kill due to underpopulation nextCell.kill(); } else if (livingNeighbors > 3) { // Kill due to overpopulation nextCell.kill(); } } else { if (livingNeighbors == 3) { // Reproduce nextCell.spawn(); } } nextState[coordStr] = nextCell; }); this.cells = nextState; }
JavaScript
draw() { let outputString = ""; for (let row = 0; row < WORLD_HEIGHT; row++) { for (let col = 0; col < WORLD_WIDTH; col++) { const coords = new Coord(row, col); const cell = this.cells[coords.toString()]; if (cell.alive) { outputString += " 0 "; } else { outputString += " . "; }; } outputString += "\n\r" } console.log(outputString); }
draw() { let outputString = ""; for (let row = 0; row < WORLD_HEIGHT; row++) { for (let col = 0; col < WORLD_WIDTH; col++) { const coords = new Coord(row, col); const cell = this.cells[coords.toString()]; if (cell.alive) { outputString += " 0 "; } else { outputString += " . "; }; } outputString += "\n\r" } console.log(outputString); }
JavaScript
destroy() { for (const layerId of this.groups) { const current = this.current[layerId]; if (current && !current.isFinished) { current.kill(); } } this.animations = {}; this.animGroupMap = {}; this.animFinalValueMap = {}; this.animUnstoppableMap = {}; this.current = {}; this.currentAnimName = {}; delete this.object.animator; }
destroy() { for (const layerId of this.groups) { const current = this.current[layerId]; if (current && !current.isFinished) { current.kill(); } } this.animations = {}; this.animGroupMap = {}; this.animFinalValueMap = {}; this.animUnstoppableMap = {}; this.current = {}; this.currentAnimName = {}; delete this.object.animator; }
JavaScript
_default() { return { insight() { statistics.sendSubGenEvent('generator', 'service-kotlin', { interface: this.useInterface }); }, }; }
_default() { return { insight() { statistics.sendSubGenEvent('generator', 'service-kotlin', { interface: this.useInterface }); }, }; }
JavaScript
_writing() { return { write() { this.serviceClass = _.upperFirst(this.name) + (this.name.endsWith('Service') ? '' : 'Service'); this.serviceInstance = _.lowerCase(this.serviceClass); this.template( `${SERVER_MAIN_SRC_DIR}package/service/Service.kt.ejs`, `${SERVER_MAIN_SRC_DIR + this.packageFolder}/service/${this.serviceClass}.kt` ); if (this.useInterface) { this.template( `${SERVER_MAIN_SRC_DIR}package/service/impl/ServiceImpl.kt.ejs`, `${SERVER_MAIN_SRC_DIR + this.packageFolder}/service/impl/${this.serviceClass}Impl.kt` ); } }, }; }
_writing() { return { write() { this.serviceClass = _.upperFirst(this.name) + (this.name.endsWith('Service') ? '' : 'Service'); this.serviceInstance = _.lowerCase(this.serviceClass); this.template( `${SERVER_MAIN_SRC_DIR}package/service/Service.kt.ejs`, `${SERVER_MAIN_SRC_DIR + this.packageFolder}/service/${this.serviceClass}.kt` ); if (this.useInterface) { this.template( `${SERVER_MAIN_SRC_DIR}package/service/impl/ServiceImpl.kt.ejs`, `${SERVER_MAIN_SRC_DIR + this.packageFolder}/service/impl/${this.serviceClass}Impl.kt` ); } }, }; }
JavaScript
_initializing() { return { validateFromCli() { this.checkInvocationFromCLI(); }, initializing() { this.log(`The spring-controller ${this.name} is being created.`); const configuration = this.config; this.baseName = configuration.get('baseName'); this.packageName = configuration.get('packageName'); this.packageFolder = configuration.get('packageFolder'); this.databaseType = configuration.get('databaseType'); this.messageBroker = configuration.get('messageBroker') === 'no' ? false : configuration.get('messageBroker'); if (this.messageBroker === undefined) { this.messageBroker = false; } this.reactiveController = false; this.applicationType = configuration.get('applicationType'); this.reactive = configuration.get('reactive'); this.reactiveController = this.reactive; this.controllerActions = []; }, }; }
_initializing() { return { validateFromCli() { this.checkInvocationFromCLI(); }, initializing() { this.log(`The spring-controller ${this.name} is being created.`); const configuration = this.config; this.baseName = configuration.get('baseName'); this.packageName = configuration.get('packageName'); this.packageFolder = configuration.get('packageFolder'); this.databaseType = configuration.get('databaseType'); this.messageBroker = configuration.get('messageBroker') === 'no' ? false : configuration.get('messageBroker'); if (this.messageBroker === undefined) { this.messageBroker = false; } this.reactiveController = false; this.applicationType = configuration.get('applicationType'); this.reactive = configuration.get('reactive'); this.reactiveController = this.reactive; this.controllerActions = []; }, }; }
JavaScript
_prompting() { return { askForControllerActions: prompts.askForControllerActions, }; }
_prompting() { return { askForControllerActions: prompts.askForControllerActions, }; }
JavaScript
_default() { return { insight() { statistics.sendSubGenEvent('generator', 'spring-controller-kotlin'); }, }; }
_default() { return { insight() { statistics.sendSubGenEvent('generator', 'spring-controller-kotlin'); }, }; }
JavaScript
_writing() { return { writing() { this.controllerClass = _.upperFirst(this.name) + (this.name.endsWith('Resource') ? '' : 'Resource'); this.controllerInstance = _.lowerFirst(this.controllerClass); this.apiPrefix = _.kebabCase(this.name); if (this.controllerActions.length === 0) { this.log(chalk.green('No controller actions found, adding a default action')); this.controllerActions.push({ actionName: 'defaultAction', actionMethod: 'Get', }); } // helper for Java imports this.usedMethods = _.uniq(this.controllerActions.map(action => action.actionMethod)); this.usedMethods = this.usedMethods.sort(); this.mappingImports = this.usedMethods.map(method => `org.springframework.web.bind.annotation.${method}Mapping`); this.mockRequestImports = this.usedMethods.map( method => `org.springframework.test.web.servlet.request.MockMvcRequestBuilders.${method.toLowerCase()}` ); this.mockRequestImports = this.mockRequestImports.length > 3 ? ['org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*'] : this.mockRequestImports; this.mainClass = this.getMainClassName(); this.controllerActions.forEach(action => { action.actionPath = _.kebabCase(action.actionName); action.actionNameUF = _.upperFirst(action.actionName); this.log( chalk.green( `adding ${action.actionMethod} action '${action.actionName}' for /api/${this.apiPrefix}/${action.actionPath}` ) ); }); this.template( `${SERVER_TEST_SRC_DIR}package/web/rest/ResourceIT.kt.ejs`, `${SERVER_TEST_SRC_DIR}${this.packageFolder}/web/rest/${this.controllerClass}IT.kt` ); this.template( `${SERVER_MAIN_SRC_DIR}package/web/rest/Resource.kt.ejs`, `${SERVER_MAIN_SRC_DIR}${this.packageFolder}/web/rest/${this.controllerClass}.kt` ); }, }; }
_writing() { return { writing() { this.controllerClass = _.upperFirst(this.name) + (this.name.endsWith('Resource') ? '' : 'Resource'); this.controllerInstance = _.lowerFirst(this.controllerClass); this.apiPrefix = _.kebabCase(this.name); if (this.controllerActions.length === 0) { this.log(chalk.green('No controller actions found, adding a default action')); this.controllerActions.push({ actionName: 'defaultAction', actionMethod: 'Get', }); } // helper for Java imports this.usedMethods = _.uniq(this.controllerActions.map(action => action.actionMethod)); this.usedMethods = this.usedMethods.sort(); this.mappingImports = this.usedMethods.map(method => `org.springframework.web.bind.annotation.${method}Mapping`); this.mockRequestImports = this.usedMethods.map( method => `org.springframework.test.web.servlet.request.MockMvcRequestBuilders.${method.toLowerCase()}` ); this.mockRequestImports = this.mockRequestImports.length > 3 ? ['org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*'] : this.mockRequestImports; this.mainClass = this.getMainClassName(); this.controllerActions.forEach(action => { action.actionPath = _.kebabCase(action.actionName); action.actionNameUF = _.upperFirst(action.actionName); this.log( chalk.green( `adding ${action.actionMethod} action '${action.actionName}' for /api/${this.apiPrefix}/${action.actionPath}` ) ); }); this.template( `${SERVER_TEST_SRC_DIR}package/web/rest/ResourceIT.kt.ejs`, `${SERVER_TEST_SRC_DIR}${this.packageFolder}/web/rest/${this.controllerClass}IT.kt` ); this.template( `${SERVER_MAIN_SRC_DIR}package/web/rest/Resource.kt.ejs`, `${SERVER_MAIN_SRC_DIR}${this.packageFolder}/web/rest/${this.controllerClass}.kt` ); }, }; }
JavaScript
function requireCLI(preferLocal) { /* eslint-disable global-require */ if (preferLocal) { try { const localCLI = require.resolve(path.join(process.cwd(), 'node_modules', 'generator-jhipster', 'cli', 'cli.js')); if (__dirname !== path.dirname(localCLI)) { // load local version /* eslint-disable import/no-dynamic-require */ logger.info("Using KHipster version installed locally in current project's node_modules"); require(localCLI); return; } } catch (e) { // Unable to find local version, so global one will be loaded anyway } } // load global version logger.info('Using JHipster version installed globally'); require('generator-jhipster/cli/cli.js'); /* eslint-enable */ }
function requireCLI(preferLocal) { /* eslint-disable global-require */ if (preferLocal) { try { const localCLI = require.resolve(path.join(process.cwd(), 'node_modules', 'generator-jhipster', 'cli', 'cli.js')); if (__dirname !== path.dirname(localCLI)) { // load local version /* eslint-disable import/no-dynamic-require */ logger.info("Using KHipster version installed locally in current project's node_modules"); require(localCLI); return; } } catch (e) { // Unable to find local version, so global one will be loaded anyway } } // load global version logger.info('Using JHipster version installed globally'); require('generator-jhipster/cli/cli.js'); /* eslint-enable */ }