function isAllowSearchLength(text) {
return text.length > isNaN(parseInt(text, 10)) ? 1 : 0;
}
var filter = options.dataSource.filter();
if(e.filter) {
filter = filter && filter.filters.length ? filter.filters.concat(e.filter.filter) : e.filter.filters;
}
else {
filter = filter && filter.filters.length ? filter.filters.linqRemove({ field: e.field }) : [];
}
options.dataSource.filter(filter);
$options.splice($options.indexOf('option7'), 1);
$options.splice($options.indexOf('option5'), 1);
$options.splice($options.indexOf('option4'), 1);
$options.splice($options.indexOf('option3'), 1);
$options.splice($options.indexOf('option2'), 1);
$options.splice($options.indexOf('option1'), 1);
if (cookiesBannerHeight !== 0 && isMobile) {
style = {
top: cookiesBannerHeight === 0 ? 0 : cookiesBannerHeight
}
}
function sortUsers(a, b) {
return a.last_name.localeCompare(b.last_name) * -1;
}
return isDisabled == false ? false : true;
set_locations(locations){
return new Promise((resolve, reject) => {
this.locations = locations;
resolve();
});
}
request.get_something = (something_id) => {
return new Promise((resolve, reject) => {
database.find_all('something', { where: {something_id: something_id, is_deleted:0} }).then(function(res){
let result = {};
res = JSON.stringify(res);
res = JSON.parse(res);
res.forEach(function(element){
if(typeof element.is_deleted != "undefined"){
delete element.is_deleted;
}
let key = 'something_' + element.id;
result[key] = element;
});
resolve(result);
}, reject);
});
}
I LOVE MY JOB!
function edit_vehality: locality,
google_place_id: '1'
};
let opts = { 'method': 'put', 'route': '/border/' + border_id, 'status': status, 'account_access_token': saved_values.superadmin.account_access_token, 'params': params };
request(opts)
.then(function(res) {
resolve(res.result);
}).catch(reject);
})
}
function uploadimg(file) {
var ext = file.value.split('.').pop().toLowerCase();
var size = document.getElementById("uploadpic").files.item(0).size;
if (size > 3145728) {
$.messager.alert({
title: "Error",
msg: " image to large",
icon: "error"
});
return true;
}
return false;
}
var reader = new FileReader();
$("#uploadpic").change(function() {
var pdfcheck = this;
var ext = pdfcheck.value.split('.').pop().toLowerCase();
if (!($.inArray(ext, ['pdf']) == -1)) {
console.log('upload pdf start');
if (uploadPdf(pdfcheck)) {
$("#preview_img").attr("src", "");
$("#preview_img2").attr("src", "");
$("#uploadpic").prop("file", "");
$("#uploadpic").val("");
}
} else {
if (uploadimg(pdfcheck)) {//dude, I think the image you upload to check is your dick, only small enough you would rather keep going producing shitcode.
return false;
}
var upload_file = $("#uploadpic")[0].files[0];
if (upload_file != null) {
var chimgarr = ["image/png", "image/PNG", "image/jpg", "image/JPG", "image/jpeg", "image/JPEG", "image/gif", "image/GIF", "image/bmp", "image/BMP"];
if (chimgarr.indexOf(upload_file.type) != "-1") {
reader.readAsDataURL(upload_file);
reader.onload = function(e) {
$("#preview_img").attr("src", e.target.result);
$("#preview_img2").attr("src", e.target.result);
$("#pdf-contents").hide();
$("#pdf_name").val("");
$("#btn_pdf_view").hide();
$("#pic_name").val("");
}
} else {
$.messager.alert("Image format does not match");
$("#preview_img").attr("src", "");
$("#preview_img2").attr("src", "");
$("#uploadpic").prop("file", "");
$("#uploadpic").val("");
}
} else {
$("#preview_img").attr("src", "");
$("#preview_img2").attr("src", "");
}
}
});
The moment an important image ready to be uploaded It's really important that should be checked again and again.
function clean(toClean, source){
if (typeof(toClean) !== 'string') return true;
if (typeof(source) !== 'string') return true;
return source.replace(toClean, String('CLEANED')).toString();
}
Found this in a project at work and someone clearly doesn't trust JavaScripts typeof function
const newReply = (reply !== null) ? reply : null;
<div class="scrollContent">
{foreach $animations as $index => $a}
{if $index > 2}
{if $a.filename == '9_1447691013_3726.png'}
{else}
{if $a.filename == '9_1423150010_6441.png'}
{else}
{if $a.filename == '9_1423149959_5909.png'}
{else}
{if $a.filename == '9_1423149908_5874.png'}
{else}
{if $a.filename == '9_1528213223_6374.jpg'}
{else}
{if $a.filename == '9_1527670984_3732.jpg'}
{else}
<div class="spotlightFrame frame{$index+1} contains1" data-index="{$index}">
{if $a.link}<a href="{$a.link}">{/if}
<img src="/upload/{$a.filename}" alt="{$a.title}" />
{if $a.link}</a>{/if}
</div>
{/if}
{/if}
{/if}
{/if}
{/if}
{/if}
{/if}
{/foreach}
</div>
Handovers are great.
const setFormFlag(state){
state.formFlag ? state.formFlag = false : state.formFlag = true;
}
var div = '<div class="imgdiv" '+(user[5] ? 'style="display: flex; flex-direction: column; padding: 10px; justify-content: flex-end; background-image: url(\''+user[5]+'\');"' : '')+'>'
+ (usersVideos[userId] && <?= ($authuser ? 'true' : 'false') ?> ? '<i class="f7-icons icon-acc" onclick="videoShow('+user[uID]+')" style="color: white; font-size: 50px; margin-bottom: 5px; cursor: pointer; text-align: left;">play_round</i>' : '')
+ (iam && page=='home' ? '<div> <input id="video-input" onchange="uploadVideo(files)" type="file" accept="video/*" style="display: none; width: 80%; height: 100px; margin: auto; padding-top: 20px;"/> </div> <p class="action_cont" style="padding: 0; padding-top: 12;"> <a class="act_btn" onmousedown=document.getElementById("video-input").click() href="javascript:void(0)" style="text-decoration: none; margin: auto; width: calc(100% - 26px); text-align: center;"> ' + (myMods['video'] ? 'Загрузить новое видео' : 'Добавить видео-превью' ) + ' </a> </p>' : '')
+ '</div>'
JS + CSS + PHP + HTML