1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Added eslint and fixed all recommended issues.

This commit is contained in:
Uncled1023 2019-01-21 20:29:27 -08:00
parent d3ac671618
commit a7abc80ac7
32 changed files with 2020 additions and 716 deletions

View File

@ -26,7 +26,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MailService", "MailService\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitService", "GitService\GitService.csproj", "{014879B1-DDD5-4F8C-9597-6D7960912CF0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceWorker", "ServiceWorker\ServiceWorker.csproj", "{0B712243-994C-4AC3-893C-B86B59F63F53}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceWorker", "ServiceWorker\ServiceWorker.csproj", "{0B712243-994C-4AC3-893C-B86B59F63F53}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

50
Teknik/Scripts/.eslintrc Normal file
View File

@ -0,0 +1,50 @@
{
"env": {
"browser": true,
"es6": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "script"
},
"extends": "eslint:recommended",
"globals": {
// Libraries
"jQuery": false,
"$": false,
"_": false,
"bootbox": false,
"marked": false,
"sanitizeHtml": false,
"Highcharts": false,
"saveAs": false,
"importScripts": false,
"CryptoJS": false,
"Uint8Array": false,
// Common.js Functions
"disableButton": false,
"enableButton": false,
"removeAmp": false,
"clearInputs": false,
"randomString": false,
"getFileExtension": false,
"SelectAll": false,
"getAnchor": false,
"GenerateBlobURL": false,
"AddAntiForgeryToken": true,
"copyTextToClipboard": false,
"getReadableBandwidthString": false,
"getReadableFileSizeString": false,
"moveUp": false,
"moveDown": false,
"addParamsToUrl": false,
"sleep": false,
"parseErrorMessage": false,
"isValidURL": false,
"pageloadTimerCount": false,
"pageloadDoTimer": false,
"pageloadStopTimer": false
}
}

View File

@ -1,3 +1,4 @@
/* globals createInviteCode, username */
$(function () {
$('#createInviteCode').click(function () {
$.ajax({

View File

@ -1,6 +1,7 @@
/* globals searchResultsURL, generateDeleteKeyURL */
$(document).ready(function () {
$('#Query').on('input', function (e) {
query = $(this).val();
$('#Query').on('input', function () {
var query = $(this).val();
// Try to strip out the ID from the url
var pattern = '(?:(?:.+)\\/)?([^\\?]+)(?:\\?(?:.*))?';

View File

@ -1,3 +1,4 @@
/* globals editAccountType, editAccountStatus, createInviteCode, deleteUserURL, homeUrl, username */
$(function () {
$('.userAccountType').on('change', function () {

View File

@ -1,6 +1,7 @@
/* globals userSearchResultsURL */
$(document).ready(function () {
$('#search').click(function () {
query = $('#query').val();
var query = $('#query').val();
$.ajax({
type: "POST",
url: userSearchResultsURL,

View File

@ -1,3 +1,4 @@
/* globals addCommentURL, getCommentArticleURL, editCommentURL, getPostsURL, getCommentsURL, publishPostURL, deletePostURL, deleteCommentURL, posts, start_post:true */
$(document).ready(function () {
// Initial Load
var oldVal = $('textarea.mdd_editor').val();
@ -16,8 +17,8 @@ $(document).ready(function () {
$("#comment_submit").click(function () {
$('#newComment').modal('hide');
postID = $("#post_id").val();
post = $("#comment_post").val();
var postID = $("#post_id").val();
var post = $("#comment_post").val();
$.ajax({
type: "POST",
url: addCommentURL,
@ -37,7 +38,7 @@ $(document).ready(function () {
$('#editComment').on('show.bs.modal', function (e) {
$("#edit_comment_post").val("");
commentID = $(e.relatedTarget).attr("id");
var commentID = $(e.relatedTarget).attr("id");
$("#edit_comment_postid").val(commentID);
$.ajax({
type: "POST",
@ -53,8 +54,8 @@ $(document).ready(function () {
$("#edit_comment_submit").click(function () {
$('#editComment').modal('hide');
postID = $("#edit_comment_postid").val();
post = $("#edit_comment_post").val();
var postID = $("#edit_comment_postid").val();
var post = $("#edit_comment_post").val();
$.ajax({
type: "POST",
url: editCommentURL,
@ -74,7 +75,7 @@ $(document).ready(function () {
});
function loadMorePosts(start, count) {
blog_id = $(".blog-main").attr("id");
var blog_id = $(".blog-main").attr("id");
$.ajax({
type: "POST",
url: getPostsURL,
@ -92,7 +93,7 @@ function loadMorePosts(start, count) {
}
function loadMoreComments(start, count) {
post_id = $(".post-comments").attr("id");
var post_id = $(".post-comments").attr("id");
$.ajax({
type: "POST",
url: getCommentsURL,
@ -126,7 +127,7 @@ function bindScrollComments() {
function linkPostUnpublish(selector) {
$(selector).click(function () {
var object = $(this);
post_id = object.attr("id");
var post_id = object.attr("id");
$.ajax({
type: "POST",
url: publishPostURL,
@ -147,7 +148,7 @@ function linkPostUnpublish(selector) {
function linkPostPublish(selector) {
$(selector).click(function () {
var object = $(this);
post_id = object.attr("id");
var post_id = object.attr("id");
$.ajax({
type: "POST",
url: publishPostURL,
@ -168,7 +169,7 @@ function linkPostPublish(selector) {
function linkPostDelete(selector) {
$(selector).click(function () {
var object = $(this);
post_id = object.attr("id");
var post_id = object.attr("id");
bootbox.confirm("Are you sure you want to delete your post?", function (result) {
if (result) {
$.ajax({
@ -193,7 +194,7 @@ function linkPostDelete(selector) {
function linkCommentDelete(selector) {
$(selector).click(function () {
var object = $(this);
post_id = object.attr("id");
var post_id = object.attr("id");
bootbox.confirm("Are you sure you want to delete your comment?", function (result) {
if (result) {
$.ajax({

View File

@ -1,3 +1,4 @@
/* globals submitErrorReportURL */
$(document).ready(function () {
$('#submitErrorReport').click(function() {
bootbox.prompt({
@ -5,7 +6,7 @@ $(document).ready(function () {
inputType: 'textarea',
callback: function(result) {
if (result) {
errorMsg = $("#errorMsg").html();
var errorMsg = $("#errorMsg").html();
$.ajax({
type: "POST",
url: submitErrorReportURL,
@ -43,7 +44,7 @@ $(document).ready(function () {
link.text("Hide Details");
} else {
link.text("Show Details");
};
}
}
);
});

View File

@ -1,4 +1,5 @@
$(document).ready(function () {
/* globals createVaultURL */
$(document).ready(function () {
linkCreateVault($('#create-vault'));
$('#add-to-vault-menu').find('.add-to-vault').each(function () {

View File

@ -1,16 +1,19 @@
/* globals addPodcastURL, getPodcastEpisodeURL, getPodcastTitleURL, getPodcastDescriptionURL, getPodcastFilesURL, editPodcastURL, addCommentURL, getCommentArticleURL, editCommentURL, getPodcastsURL, getCommentsURL, publishPodcastURL, deletePodcastURL, deleteCommentURL
startPodcast:true, podcasts, startComment:true, comments
*/
$(document).ready(function () {
$("#podcast_submit").click(function () {
$.blockUI({ message: '<div class="text-center"><h3>Saving...</h3></div>' });
$('#newPodcast').modal('hide');
var fd = new FormData();
var fileInput = document.getElementById('podcast_files');
for (i = 0; i < fileInput.files.length; i++) {
for (var i = 0; i < fileInput.files.length; i++) {
//Appending each file to FormData object
fd.append(fileInput.files[i].name, fileInput.files[i]);
}
episode = $("#podcast_episode").val();
title = $("#podcast_title").val();
description = $("#podcast_description").val();
var episode = $("#podcast_episode").val();
var title = $("#podcast_title").val();
var description = $("#podcast_description").val();
fd.append("episode", episode);
fd.append("title", title);
@ -21,7 +24,7 @@ $(document).ready(function () {
xhr.send(fd);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
obj = JSON.parse(xhr.responseText);
var obj = JSON.parse(xhr.responseText);
$.unblockUI();
if (obj.result) {
window.location.reload();
@ -41,7 +44,7 @@ $(document).ready(function () {
$("#edit_podcast_description").val("");
$("#edit_podcast_cur_file_list").val("");
$("#edit_podcast_cur_files").html('');
podcastId = $(e.relatedTarget).attr("id");
var podcastId = $(e.relatedTarget).attr("id");
$("#edit_podcast_podcastId").val(podcastId);
$.ajax({
type: "POST",
@ -104,16 +107,16 @@ $(document).ready(function () {
$('#editPodcast').modal('hide');
var fd = new FormData();
var fileInput = document.getElementById('edit_podcast_files');
for (i = 0; i < fileInput.files.length; i++) {
for (var i = 0; i < fileInput.files.length; i++) {
//Appending each file to FormData object
fd.append(fileInput.files[i].name, fileInput.files[i]);
}
podcastId = $("#edit_podcast_podcastId").val();
episode = $("#edit_podcast_episode").val();
title = $("#edit_podcast_title").val();
description = $("#edit_podcast_description").val();
allFiles = $("#edit_podcast_cur_file_list").val();
var podcastId = $("#edit_podcast_podcastId").val();
var episode = $("#edit_podcast_episode").val();
var title = $("#edit_podcast_title").val();
var description = $("#edit_podcast_description").val();
var allFiles = $("#edit_podcast_cur_file_list").val();
fd.append("podcastId", podcastId);
fd.append("episode", episode);
@ -126,7 +129,7 @@ $(document).ready(function () {
xhr.send(fd);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
obj = JSON.parse(xhr.responseText);
var obj = JSON.parse(xhr.responseText);
$.unblockUI();
if (obj.result) {
window.location.reload();
@ -142,12 +145,12 @@ $(document).ready(function () {
$("#comment_submit").click(function () {
$('#newComment').modal('hide');
podcastId = $("#podcastId").val();
post = $("#comment_post").val();
var podcastId = $("#podcastId").val();
var post = $("#comment_post").val();
$.ajax({
type: "POST",
url: addCommentURL,
data: { podcastId: postID, article: post },
data: { podcastId: podcastId, article: post },
success: function (response) {
if (response.result) {
window.location.reload();
@ -163,7 +166,7 @@ $(document).ready(function () {
$('#editComment').on('show.bs.modal', function (e) {
$("#edit_comment_post").val("");
commentID = $(e.relatedTarget).attr("id");
var commentID = $(e.relatedTarget).attr("id");
$("#edit_comment_id").val(commentID);
$.ajax({
type: "POST",
@ -179,8 +182,8 @@ $(document).ready(function () {
$("#edit_comment_submit").click(function () {
$('#editComment').modal('hide');
postID = $("#edit_comment_id").val();
post = $("#edit_comment_post").val();
var postID = $("#edit_comment_id").val();
var post = $("#edit_comment_post").val();
$.ajax({
type: "POST",
url: editCommentURL,
@ -200,7 +203,7 @@ $(document).ready(function () {
});
function loadMorePodcasts(start, count) {
podcastId = $(".podcast-main").attr("id");
var podcastId = $(".podcast-main").attr("id");
$.ajax({
type: "POST",
url: getPodcastsURL,
@ -218,7 +221,7 @@ function loadMorePodcasts(start, count) {
}
function loadMoreComments(start, count) {
post_id = $(".podcast-comments").attr("id");
var post_id = $(".podcast-comments").attr("id");
$.ajax({
type: "POST",
url: getCommentsURL,
@ -252,7 +255,7 @@ function bindScrollComments() {
function linkPodcastUnpublish(selector) {
$(selector).click(function () {
var object = $(this);
podcastId = object.attr("id");
var podcastId = object.attr("id");
$.ajax({
type: "POST",
url: publishPodcastURL,
@ -273,7 +276,7 @@ function linkPodcastUnpublish(selector) {
function linkPodcastPublish(selector) {
$(selector).click(function () {
var object = $(this);
podcastId = object.attr("id");
var podcastId = object.attr("id");
$.ajax({
type: "POST",
url: publishPodcastURL,
@ -294,7 +297,7 @@ function linkPodcastPublish(selector) {
function linkPodcastDelete(selector) {
$(selector).click(function () {
var object = $(this);
podcastId = object.attr("id");
var podcastId = object.attr("id");
bootbox.confirm("Are you sure you want to delete the podcast?", function (result) {
if (result) {
$.ajax({
@ -319,8 +322,8 @@ function linkPodcastDelete(selector) {
function linkEditFileDelete(selector) {
$(selector).click(function () {
var object = $(this);
podFile = object.attr('id');
allFiles = $("#edit_podcast_cur_file_list").val();
var podFile = object.attr('id');
var allFiles = $("#edit_podcast_cur_file_list").val();
var fileList = allFiles.split(',');
var index = fileList.indexOf(podFile);
if (index != -1) {
@ -335,7 +338,7 @@ function linkEditFileDelete(selector) {
function linkCommentDelete(selector) {
$(selector).click(function () {
var object = $(this);
post_id = object.attr("id");
var post_id = object.attr("id");
bootbox.confirm("Are you sure you want to delete your comment?", function (result) {
if (result) {
$.ajax({

View File

@ -4,7 +4,7 @@ $(document).ready(function () {
$("#shortenSubmit").click(function () {
$("#top_msg").css('display', 'none', 'important');
$("#top_msg").html('');
url = $("#url").val();
var url = $("#url").val();
$.ajax({
type: "POST",
url: $("#shortenerForm").attr('action'),
@ -24,7 +24,7 @@ $(document).ready(function () {
return false;
});
$('#url').on('input', function (e) {
$('#url').on('input', function () {
$("#top_msg").css('display', 'none', 'important');
$("#top_msg").html('');
});

View File

@ -1,6 +1,8 @@
var cpuUsageChart;
var memUsageChart;
var networkUsageChart;
/* globals showVisitorStats, getVisitorDataURL */
//var cpuUsageChart;
//var memUsageChart;
//var networkUsageChart;
var visitChart;
$(document).ready(function () {
$('#bills-section').collapse('hide');
@ -314,7 +316,7 @@ $(document).ready(function () {
// Resize the chart when viewing the tab (initial width is wrong due to chart being hidden)
$('a[href="#site-stats"]').on('shown.bs.tab',
function (e) {
function () {
if (showVisitorStats) {
visitChart.setSize($('#visitor-chart').width(), $('#visitor-chart').height());
}

View File

@ -1,3 +1,4 @@
/* globals encScriptSrc, aesScriptSrc, downloadDataUrl, fileName, fileType:true, iv, decrypt, chunkSize */
$(document).ready(downloadFile);
function downloadFile() {
@ -28,7 +29,7 @@ function processDownload(key, iv, decrypt) {
xhr.open('POST', downloadDataUrl, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
xhr.onload = function() {
if (this.status === 200) {
decryptDownload(this.response, key, iv, decrypt);
}
@ -53,11 +54,11 @@ function processDownload(key, iv, decrypt) {
}
}
xhr.onerror = function(e) {
xhr.onerror = function() {
setProgress(100, 'progress-bar-danger', '', 'Download Failed');
};
xhr.onabort = function(e) {
xhr.onabort = function() {
setProgress(100, 'progress-bar-warning', '', 'Download Aborted');
};
@ -110,7 +111,7 @@ function decryptDownload(fileData, key, iv, decrypt) {
}
});
worker.onerror = function (err) {
worker.onerror = function () {
// An error occured
setProgress(100, 'progress-bar-danger', '', 'Error Occured');
}

View File

@ -67,15 +67,16 @@ self.addEventListener('message', function (e) {
prog = Uint8Concat(prog, _base64ToArray(finalStr));
// Now package it into a mesage to send home
var objData =
var finalData =
{
cmd: 'finish',
buffer: prog.buffer
};
self.postMessage(objData, [objData.buffer]);
self.postMessage(finalData, [finalData.buffer]);
}, false);
/* eslint-disable-next-line */
function _arrayToArrayBuffer(array) {
var len = array.length;
var bytes = new Uint8Array(len);

View File

@ -1,3 +1,4 @@
/* globals shortenURL, createVaultURL, uploadFileURL, maxUploadSize, keySize, blockSize, encScriptSrc, aesScriptSrc, chunkSize */
$(document).ready(function () {
$("#upload-links").css('display', 'none', 'important');
$("#upload-links").html('');
@ -20,7 +21,7 @@ $(document).ready(function () {
linkAddToVault($(this));
});
$('#uploadSettings').on('shown.bs.modal', function (e) {
$('#uploadSettings').on('shown.bs.modal', function () {
// Initialize the widths
setExpireWidth($('#uploadSettings').find("#expireunit").val());
@ -29,16 +30,20 @@ $(document).ready(function () {
document.onpaste = function (event) {
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
for (index in items) {
for (var index in items) {
if (!_.isUndefined(index) && !_.isNull(index)) {
var item = items[index];
if (item.kind === 'file') {
if (!_.isUndefined(item) && !_.isNull(item) && item.kind === 'file') {
// Convert file to blob
var file = item.getAsFile();
if (!_.isUndefined(file) && !_.isNull(file)) {
// Upload the file
upload(file);
}
}
}
}
}
});
function linkExpireSelect(element) {
@ -63,7 +68,7 @@ function linkUploadDelete(element, deleteUrl) {
});
}
function linkShortenUrl(element, fileID, url) {
function linkShortenUrl(element, fileID) {
element.click(function () {
var url = $('#upload-panel-' + fileID).find('#upload-link').text();
$.ajax({
@ -101,13 +106,6 @@ function linkRemove(element, fileID, token) {
});
}
function linkCancel(element, fileID) {
element.click(function () {
$('#upload-panel-' + fileID).remove();
return false;
});
}
function linkCopyAll(element) {
element.click(function () {
var allUploads = [];
@ -187,7 +185,7 @@ function setExpireWidth(unit) {
}
}
var dropZone = new Dropzone(document.body, {
$(document.body).dropzone({
url: uploadFileURL,
maxFilesize: maxUploadSize, // MB
addRemoveLinks: true,
@ -469,7 +467,7 @@ function uploadComplete(fileID, key, options, token, evt) {
// Setup the buttons
linkUploadDelete(itemDiv.find('#delete-link'), deleteUrl);
linkShortenUrl(itemDiv.find('#shortenUrl'), fileID, fullName);
linkShortenUrl(itemDiv.find('#shortenUrl'), fileID);
// Hide the progress bar
itemDiv.find('#upload-progress-panel').hide();
@ -502,7 +500,7 @@ function uploadFailed(fileID, token, evt) {
$('#upload-panel-' + fileID).find('.panel').addClass('panel-danger');
}
function uploadCanceled(fileID, token, evt) {
function uploadCanceled(fileID, token) {
// Cancel out cancel token
token.callback = null;

View File

@ -1,11 +1,12 @@
$(document).ready(function () {
/* globals changePasswordUrl, deleteUserURL, homeUrl */
$(document).ready(function () {
$("#change_password_submit").click(function () {
// Start Updating Animation
disableButton('#change_password_submit', 'Saving...');
current_password = $("#update_password_current").val();
password = $("#update_password").val();
password_confirm = $("#update_password_confirm").val();
var current_password = $("#update_password_current").val();
var password = $("#update_password").val();
var password_confirm = $("#update_password_confirm").val();
$.ajax({
type: "POST",
url: changePasswordUrl,
@ -58,7 +59,7 @@
}
}).always(function () {
enableButton('#delete_account', 'Delete Account');
});;
});
} else {
enableButton('#delete_account', 'Delete Account');
}

View File

@ -1,10 +1,11 @@
/* globals editURL */
$(document).ready(function () {
$("#update_submit").click(function () {
// Start Updating Animation
disableButton('#update_submit', 'Saving...');
blog_title = $("#update_blog_title").val();
blog_desc = $("#update_blog_description").val();
var blog_title = $("#update_blog_title").val();
var blog_desc = $("#update_blog_description").val();
$.ajax({
type: "POST",
url: editURL,

View File

@ -1,3 +1,4 @@
/* globals confirmAuthCodeURL */
$(document).ready(function () {
$("#authCheckStatus").css('display', 'none', 'important');
$('#Code').focus();
@ -9,10 +10,10 @@ $(document).ready(function () {
});
$("#verifyCodeSubmit").click(function () {
setCode = $("#Code").val();
returnUrl = $("#ReturnUrl").val();
rememberMe = ($("#RememberMe").val() == 'True');
rememberDevice = $("#RememberDevice").is(":checked");
var setCode = $("#Code").val();
var returnUrl = $("#ReturnUrl").val();
var rememberMe = ($("#RememberMe").val() == 'True');
var rememberDevice = $("#RememberDevice").is(":checked");
$.ajax({
type: "POST",
url: confirmAuthCodeURL,

View File

@ -1,13 +1,14 @@
$(document).ready(function () {
/* globals createClientURL, getClientURL, editClientURL, deleteClientURL */
$(document).ready(function () {
$('#clientModal').on('shown.bs.modal', function (e) {
$('#clientModal').on('shown.bs.modal', function () {
$("#clientStatus").css('display', 'none', 'important');
$("#clientStatus").html('');
$('#clientName').focus();
});
$('#clientModal').on('hide.bs.modal', function (e) {
$('#clientModal').on('hide.bs.modal', function () {
$("#clientStatus").css('display', 'none', 'important');
$("#clientStatus").html('');
@ -54,7 +55,7 @@ function createClient() {
$('#noClients').remove();
}
var item = $(html);
var item = $(response);
processClientItem(item);
@ -154,7 +155,7 @@ function deleteClient(clientId) {
}
function saveClientInfo(url, submitText, submitActionText, callback) {
var name, homepageUrl, logoUrl, callbackUrl;
var clientId, name, homepageUrl, logoUrl, callbackUrl;
disableButton('.clientSubmit', submitActionText);
clientId = $('#clientModal').find('#clientId').val();

View File

@ -1,3 +1,4 @@
/* globals createExternalLinkURL */
$(document).ready(function () {
$('[data-toggle="popover"]').popover();

View File

@ -1,11 +1,12 @@
/* globals editURL */
$(document).ready(function () {
$("#update_submit").click(function () {
// Start Updating Animation
disableButton('#update_submit', 'Saving...');
website = $("#update_website").val();
quote = $("#update_quote").val();
about = $("#update_about").val();
var website = $("#update_website").val();
var quote = $("#update_quote").val();
var about = $("#update_about").val();
$.ajax({
type: "POST",
url: editURL,

View File

@ -2,7 +2,7 @@ $(document).ready(function () {
$("#reset_pass_send_submit").click(function () {
disableButton('#reset_pass_send_submit', 'Generating Link...');
var form = $('#reset_pass_send');
username = $("#reset_username").val();
var username = $("#reset_username").val();
$.ajax({
type: "POST",
url: form.attr('action'),
@ -32,8 +32,8 @@ $(document).ready(function () {
$("#setNewPass_submit").click(function () {
disableButton('#setNewPass_submit', 'Resetting...');
var form = $('#setNewPass');
password = $("#setNewPass_Password").val();
confirmPassword = $("#setNewPass_ConfirmPassword").val();
var password = $("#setNewPass_Password").val();
var confirmPassword = $("#setNewPass_ConfirmPassword").val();
$.ajax({
type: "POST",
url: form.attr('action'),

View File

@ -1,3 +1,4 @@
/* globals resendVerifyURL, generate2FAURL, disable2FAURL, resetRecoveryCodesURL, confirmAuthSetupURL, editURL */
$(document).ready(function () {
$('#ResendVerification').click(function () {
$.ajax({
@ -103,7 +104,7 @@ $(document).ready(function () {
data: AddAntiForgeryToken({}),
success: function (response) {
if (response.result) {
var dialog = bootbox.dialog({
bootbox.dialog({
closeButton: false,
buttons: {
close: {
@ -131,11 +132,11 @@ $(document).ready(function () {
});
});
$('#authenticatorSetup').on('shown.bs.modal', function (e) {
$('#authenticatorSetup').on('shown.bs.modal', function () {
$('#auth_setup_code').focus();
});
$('#authenticatorSetup').on('hide.bs.modal', function (e) {
$('#authenticatorSetup').on('hide.bs.modal', function () {
$("#authSetupStatus").css('display', 'none', 'important');
$("#authSetupStatus").html('');
$('#authQRCode').attr('src', '');
@ -145,7 +146,7 @@ $(document).ready(function () {
$('#auth_setup_verify').click(function () {
disableButton('#auth_setup_verify', 'Verifying...');
setCode = $("#auth_setup_code").val();
var setCode = $("#auth_setup_code").val();
$.ajax({
type: "POST",
url: confirmAuthSetupURL,
@ -155,7 +156,7 @@ $(document).ready(function () {
success: function (response) {
if (response.result) {
$('#authenticatorSetup').modal('hide');
var dialog = bootbox.dialog({
bootbox.dialog({
closeButton: false,
buttons: {
close: {
@ -189,8 +190,8 @@ $(document).ready(function () {
// Start Updating Animation
disableButton('#update_submit', 'Saving...');
update_pgp_public_key = $("#update_pgp_public_key").val();
recovery = $("#update_recovery_email").val();
var update_pgp_public_key = $("#update_pgp_public_key").val();
var recovery = $("#update_recovery_email").val();
$.ajax({
type: "POST",
url: editURL,

View File

@ -1,3 +1,4 @@
/* globals editURL */
$(document).ready(function () {
$("[name='update_upload_encrypt']").bootstrapSwitch();
@ -9,9 +10,9 @@ $(document).ready(function () {
// Start Updating Animation
disableButton('#update_submit', 'Saving...');
upload_encrypt = $("#update_upload_encrypt").is(":checked");
upload_expireLength = $("#expirelength").val();
upload_expireUnit = $("#expireunit").val();
var upload_encrypt = $("#update_upload_encrypt").is(":checked");
var upload_expireLength = $("#expirelength").val();
var upload_expireUnit = $("#expireunit").val();
$.ajax({
type: "POST",
url: editURL,

View File

@ -1,3 +1,4 @@
/* globals deleteUploadURL, deletePasteURL, deleteShortenURL, deleteVaultURL */
$(document).ready(function () {
$('.delete-upload-button').click(function () {
var id = $(this).data('upload-id');

View File

@ -1,3 +1,4 @@
/* globals validateItemURL, modifyVaultURL, deleteVaultURL, itemCount:true */
$(document).ready(function () {
// Initial Load
var oldVal = $('textarea.mdd_editor').val();
@ -22,7 +23,7 @@ $(document).ready(function () {
}
})
$('#newItem').on('show.bs.modal', function (e) {
$('#newItem').on('show.bs.modal', function () {
var newDiv = $('#newItem');
newDiv.find("#item_title").val("");
newDiv.find("#item_description").val("");
@ -237,7 +238,6 @@ function linkShowMore(element) {
var link = $(this);
var contentDiv = link.parent().prev("div.paste-content");
var id = contentDiv.attr('id');
var btnTop = $('#show-more-top-' + id);
var btnBottom = $('#show-more-bottom-' + id);
var linkText = link.text().toUpperCase();
@ -253,6 +253,6 @@ function linkShowMore(element) {
contentDiv.addClass('hideContent');
btnBottom.show();
btnBottom.find('.show-more-button').text(linkText);
};
}
});
}

View File

@ -1,3 +1,6 @@
/* exported disableButton, enableButton, removeAmp, clearInputs, randomString, getFileExtension, SelectAll, getAnchor, GenerateBlobURL, AddAntiForgeryToken,
copyTextToClipboard, getReadableBandwidthString, getReadableFileSizeString, moveUp, moveDown, addParamsToUrl, sleep, parseErrorMessage, isValidURL,
pageloadTimerCount, pageloadDoTimer, pageloadStopTimer */
$(document).ready(function () {
$("#top_msg").css('display', 'none', 'important');
@ -6,7 +9,7 @@ $(document).ready(function () {
$('#registerButton').removeClass('hide');
$('#registerModal').on('shown.bs.modal', function (e) {
$('#registerModal').on('shown.bs.modal', function () {
$("#registerStatus").css('display', 'none', 'important');
$("#registerStatus").html('');
$('#registerUsername').focus();
@ -65,7 +68,7 @@ $(function () {
});
// for bootstrap 3 use 'shown.bs.tab', for bootstrap 2 use 'shown' in the next line
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('a[data-toggle="tab"]').on('shown.bs.tab', function () {
// save the latest tab; use cookies if you like 'em better:
localStorage.setItem('lastTab', $(this).attr('href'));
});
@ -238,7 +241,7 @@ function getReadableFileSizeString(fileSizeInBytes) {
} while (fileSizeInBytes > 1024);
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
};
}
function moveUp(item) {
var prev = item.prev();

View File

@ -25,6 +25,10 @@
<None Remove="Areas\Home\Data\**" />
</ItemGroup>
<ItemGroup>
<None Remove=".eslintrc" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="IdentityServer4" Version="2.3.1" />

View File

@ -297,6 +297,7 @@
"./wwwroot/lib/jquery/js/jquery.validate.js",
"./wwwroot/lib/bootstrap/js/bootstrap.js",
"./wwwroot/lib/bootstrap/js/bootstrap-select.js",
"./wwwroot/lib/underscore/js/underscore.js",
"./wwwroot/js/app/common.js"
]
},

View File

@ -15,6 +15,8 @@ var uglifyes = require('uglify-es');
var composer = require('gulp-uglify/composer');
var uglify = composer(uglifyes, console);
var eslint = require('gulp-eslint');
var bundleconfig = require("./bundleconfig.json");
var regex = {
@ -39,6 +41,7 @@ var assets = [
{ './node_modules/jquery-validation/dist/jquery.validate.js': 'lib/jquery/js' },
{ './node_modules/marked/lib/marked.js': 'lib/marked/js' },
{ './node_modules/sanitize-html/dist/sanitize-html.js': 'lib/sanitize-html/js' },
{ './node_modules/underscore/underscore.js': 'lib/underscore/js' },
// App JS Files
{ './Scripts/**/*': 'js/app' },
@ -68,6 +71,12 @@ var assets = [
{ './Images/logo-blue.svg': 'images' }
];
gulp.task("eslint", function () {
return gulp.src(['./Scripts/**/*.js', '!Scripts/lib/**'])
.pipe(eslint())
.pipe(eslint.formatEach('compact', process.stderr));
});
gulp.task("clean", function (cb) {
return rimraf("./wwwroot/*", cb);
});

2408
Teknik/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,19 +16,27 @@
"jquery": "^3.3.1",
"jquery-validation": "^1.17.0",
"marked": "^0.4.0",
"sanitize-html": "^1.18.2"
"sanitize-html": "^1.18.2",
"underscore": "^1.9.1"
},
"description": "Teknik Services",
"devDependencies": {
"babel-eslint": "^10.0.1",
"del": "^3.0.0",
"eslint": "^5.12.1",
"eslint-config-defaults": "^9.0.0",
"eslint-plugin-react": "^7.12.4",
"fancy-log": "^1.3.3",
"git-rev-sync": "^1.12.0",
"gulp": "3.9.1",
"gulp-concat": "^2.6.1",
"gulp-cssmin": "^0.2.0",
"gulp-eslint": "^5.0.0",
"gulp-rename": "^1.3.0",
"gulp-replace": "^1.0.0",
"gulp-uglify": "^3.0.0",
"merge-stream": "^1.0.1",
"plugin-error": "^1.0.1",
"pump": "^3.0.0",
"rimraf": "^2.6.2",
"uglify-es": "^3.3.9"
@ -40,7 +48,7 @@
"Media"
],
"license": "BSD-3-Clause",
"main": "webpack.config.js",
"main": "gulpfile.js",
"name": "teknik",
"repository": {
"type": "git",