From 0d10a1802aa68b85534526b41845c4203a491bd4 Mon Sep 17 00:00:00 2001 From: Jesse-Ma <24167796@qq.com> Date: Fri, 27 May 2022 14:29:30 +0800 Subject: [PATCH] tag1 --- .gitignore | 23 ++ README.md | 25 +- babel.config.js | 5 + jsconfig.json | 19 ++ package.json | 55 +++++ public/favicon.ico | Bin 0 -> 4286 bytes public/favicon.png | Bin 0 -> 1612 bytes public/favicon.png.bak | Bin 0 -> 1125 bytes public/favicon.png.bak2 | Bin 0 -> 1262 bytes public/index.html | 44 ++++ src/App.vue | 39 +++ src/api/lock.js | 40 +++ src/api/note.js | 79 ++++++ src/assets/logo.png | Bin 0 -> 6849 bytes src/libs/noteStorage.js | 44 ++++ src/libs/secret.js | 57 +++++ src/libs/storage.js | 46 ++++ src/main.js | 41 ++++ src/plugins/iview.js | 6 + src/plugins/tln/LICENSE | 201 +++++++++++++++ src/plugins/tln/README.md | 25 ++ src/plugins/tln/demo.html | 36 +++ src/plugins/tln/tln.css | 48 ++++ src/plugins/tln/tln.js | 138 +++++++++++ src/plugins/tln/tln.min.css | 1 + src/plugins/tln/tln.min.js | 1 + src/router/index.js | 80 ++++++ src/views/EditNote.vue | 478 ++++++++++++++++++++++++++++++++++++ src/views/ErrorView.vue | 17 ++ src/views/HomeView.vue | 19 ++ src/views/ViewNote.vue | 327 ++++++++++++++++++++++++ vue.config.js | 16 ++ 32 files changed, 1909 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 babel.config.js create mode 100644 jsconfig.json create mode 100644 package.json create mode 100644 public/favicon.ico create mode 100644 public/favicon.png create mode 100644 public/favicon.png.bak create mode 100644 public/favicon.png.bak2 create mode 100644 public/index.html create mode 100644 src/App.vue create mode 100644 src/api/lock.js create mode 100644 src/api/note.js create mode 100644 src/assets/logo.png create mode 100644 src/libs/noteStorage.js create mode 100644 src/libs/secret.js create mode 100644 src/libs/storage.js create mode 100644 src/main.js create mode 100644 src/plugins/iview.js create mode 100644 src/plugins/tln/LICENSE create mode 100644 src/plugins/tln/README.md create mode 100644 src/plugins/tln/demo.html create mode 100644 src/plugins/tln/tln.css create mode 100644 src/plugins/tln/tln.js create mode 100644 src/plugins/tln/tln.min.css create mode 100644 src/plugins/tln/tln.min.js create mode 100644 src/router/index.js create mode 100644 src/views/EditNote.vue create mode 100644 src/views/ErrorView.vue create mode 100644 src/views/HomeView.vue create mode 100644 src/views/ViewNote.vue create mode 100644 vue.config.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..403adbc --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +.DS_Store +node_modules +/dist + + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/README.md b/README.md index 7b28567..4d37ec8 100644 --- a/README.md +++ b/README.md @@ -1 +1,24 @@ -# flagnote-web \ No newline at end of file +# flagnote-web + +## Project setup +``` +yarn install +``` + +### Compiles and hot-reloads for development +``` +yarn serve +``` + +### Compiles and minifies for production +``` +yarn build +``` + +### Lints and fixes files +``` +yarn lint +``` + +### Customize configuration +See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..e955840 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset' + ] +} diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..4aafc5f --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "esnext", + "baseUrl": "./", + "moduleResolution": "node", + "paths": { + "@/*": [ + "src/*" + ] + }, + "lib": [ + "esnext", + "dom", + "dom.iterable", + "scripthost" + ] + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..7457ea5 --- /dev/null +++ b/package.json @@ -0,0 +1,55 @@ +{ + "name": "flagnote-web", + "version": "0.1.0", + "private": true, + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build", + "lint": "vue-cli-service lint" + }, + "dependencies": { + "axios": "^0.26.0", + "core-js": "^3.8.3", + "crypto-js": "^4.1.1", + "escape-html": "^1.0.3", + "html2canvas": "^1.4.1", + "jquery": "^3.6.0", + "nprogress": "^0.2.0", + "pako": "^2.0.4", + "view-design": "^4.0.0", + "vue": "^2.6.14", + "vue-axios": "^3.4.1", + "vue-router": "^3.5.1" + }, + "devDependencies": { + "@babel/core": "^7.12.16", + "@babel/eslint-parser": "^7.12.16", + "@vue/cli-plugin-babel": "~5.0.0", + "@vue/cli-plugin-eslint": "~5.0.0", + "@vue/cli-plugin-router": "~5.0.0", + "@vue/cli-service": "~5.0.0", + "eslint": "^7.32.0", + "eslint-plugin-vue": "^8.0.3", + "vue-cli-plugin-iview": "^2.0.0", + "vue-template-compiler": "^2.6.14" + }, + "eslintConfig": { + "root": true, + "env": { + "node": true + }, + "extends": [ + "plugin:vue/essential", + "eslint:recommended" + ], + "parserOptions": { + "parser": "@babel/eslint-parser" + }, + "rules": {} + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not dead" + ] +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..df36fcfb72584e00488330b560ebcf34a41c64c2 GIT binary patch literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S literal 0 HcmV?d00001 diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..0ef42a7e48017590ecea75e843b1c4dc34be1535 GIT binary patch literal 1612 zcmeAS@N?(olHy`uVBq!ia0y~yU^E7@PjIjS$(AZM10cm%9OUlAu643tF8D;+}0C%ck88$atu` zTjNZ|O!xTHeUs0Qy=@+nh$K zHu`-$f7X44=JyO72HDTA8GX9B&1h5N@6PLeMNgk+&zc;}cP{>d&0M4E^XoR{Uo=j= zHA(tZD!-22bp731|5Say^i1THN}A{^pHSuaH#U;%{0{WJy%GGZ?!Q}c)wYXC*WMo3 zyZTh>_d7L@wyyArt_rr?QsG(5R4TCfl+WILSIb>L+l#J#yFRP@T)vK>_2ql7r%(6J z-}x-%hE?P2vgb{oPG4B`Oyt+(8KKW=6s68qBwx$D-|Ig;vz+Iz@y=4G@(;IK&uV^Q zH(c$bpL8wvfA0BtF|PjpdGBt&U{4C0S=SM1{yp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`S$FaYE!2i?S%W> zd>hxY{f-OmSj)AvcD+U3=D)W0bUT&`MmPME-8oZv?z1h={s`~rSQ|EH%F^%eHF{&d z`?_n*{>VSM^M*@MFYmOMcVl<`yd!W|VRFljS4U(wzFYCP`m<`{edTQvJPz%1&q)-y zT-$#`NkQ+o+(y@ckngrh-Hj{WR38yDSG@PVL-*OCE$;=R4_zq+YG?_5SAC?7HTCzr z-x4bSB)GZLp65LKy5#SU-xq$zPgsBv^3FLE6wOWuphpO)!ux#A`(;a6WWL-R{Wn~| zBJe?J&K+Gbj7Jym7ks>i@zk#5VqIpL{>z=HRv2*I{*Hr zUjKHT^2c+&d-iz#PurU%5Y2k${M_7KSMqhguaBzxv+ethlBZLa?zTP?bn+KS{)@$sJbW%Tm}{m44$rjF6*2UngFia{%-&P literal 0 HcmV?d00001 diff --git a/public/favicon.png.bak2 b/public/favicon.png.bak2 new file mode 100644 index 0000000000000000000000000000000000000000..158e15ef00539fa09dfb68b80525a0eed9bb5cdf GIT binary patch literal 1262 zcmeAS@N?(olHy`uVBq!ia0vp^vq6}H4M>(IzU%=~jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sDEfH31!Z9ZwBnr2TI$B>G+w|CBGUoMw9{;~YhvaM2E?Sn*D z@*P`ZWxh1P^$uUMmA+irjO6yl_C|}cz%P%E9(MVlAo|td1OErJvRjTK2c7x7xSN&A z6y9u--O`&m=kLsGDW1O~F9h7aQuq1P_v4=#RqsEU99%K!yY)hqFbyLIg?D+4yOhmN z2uP=N@ERRqlT2#n+32V?;r`~Q^V4(R{p)zjHvh(-3&GyJygP({L@Fd{`<#t>ckpph z%+7;>uV+w|`1 z=XVpO)(G65eN2t(+Me{|Nfk>O_}`jkr^FV;rc6D8Yh&e$ zvlC}q?796&*0a1xC~5WNjpCKr_jYeKD)N@MN?OZVF6Dbf&FJ5%lR|&xL+}0cQjDsZ zslUp(?3#FA*=&Btp?&T-b|Tkm`)@EQ==_%3$Qlsv-8PB4alxDF zBVtB%_r7=NKKZldy zKC81!UBBvpGW936ex4hnt++K;DTOVKjAff#IZpYd_iJke%W(!yJ$0TJhSkW7k^tn@`2S~0o z=!;3>?l1tdxfd(|u^ShF*oyl>Y)gBf%I+C%Kz8?zr*7-6ckqf{Rlc4LOUD$47$`H) z-jI*6IXCacNzeD&QOzNI|LC>4-*Za)?`*mA)!3}^(Tvn>UvJ!SIXGA8L{h6#`P=B$ zm64}yD{^)oR6n{Okp&BW`S0$&wb$lG`t16j7w + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + + + + +
+ + + diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..5422ed5 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/src/api/lock.js b/src/api/lock.js new file mode 100644 index 0000000..d9bb425 --- /dev/null +++ b/src/api/lock.js @@ -0,0 +1,40 @@ +// import Jquery from "jquery"; +import {aesEncrypt, md5} from "@/libs/secret"; + +// export function getSecretKey(key, password) { +// console.log("getSecretKey"); +// let secretKey = ''; +// Jquery.ajax({ +// method: 'POST', +// url: '/note/' + key + "/secretKey", +// async: false, +// contentType: 'application/json', +// dataTeyp: 'json', +// data: JSON.stringify({'password': password}), +// success: function (data) { +// secretKey = data; +// }, +// error: function () { +// alert('服务器链接异常 '); +// }, +// }); +// return secretKey; +// } + +export function getStoreKey(key) { + return md5(aesEncrypt(key, key)); +} + +export function getSecretKey(cipher, password) { + if(!password){ + password = ''; + } + return md5(cipher + password); +} + + + + + + + diff --git a/src/api/note.js b/src/api/note.js new file mode 100644 index 0000000..84bcfc1 --- /dev/null +++ b/src/api/note.js @@ -0,0 +1,79 @@ +import axios from "axios"; +import Jquery from "jquery"; +import {getStoreKey} from "@/api/lock"; +import storage from "@/libs/storage"; + +export function saveNote(noteForm) { + + let storeKey = getStoreKey(noteForm.key); + let storeText = storage.local.getText(storeKey + '.text'); + let note = { + "lock": storeText.substring(0, 1), + "text": storeText.substring(35) + } + + console.log("n"+ storeText) + + + return axios({ + url: '/note/' + noteForm.key, + method: 'post', + data: note + } + ) +} + +// export function getSecretKey(key, password) { +// console.log("getSecretKey"); +// let secretKey = ''; +// Jquery.ajax({ +// method: 'POST', +// url: '/note/' + key + "/secretKey", +// async: false, +// contentType: 'application/json', +// dataTeyp: 'json', +// data: JSON.stringify({'password': password}), +// success: function (data) { +// secretKey = data; +// }, +// error: function () { +// alert('服务器链接异常 '); +// }, +// }); +// return secretKey; +// } + + +export function getNoteMeta(key) { + console.log("getNoteMeta"); + let noteMeta = {}; + Jquery.ajax({ + method: 'GET', + url: '/note/' + key + "/noteMeta", + async: false, + success: function (data) { + noteMeta = eval(data); //eval("(" + data + ")"); + }, + error: function () { + noteMeta = null; + }, + }); + return noteMeta; +} + +export function getKeyMeta() { + console.log("getKeyMeta"); + let keyMeta = {}; + Jquery.ajax({ + method: 'GET', + url: '/note/keyMeta', + async: false, + success: function (data) { + keyMeta = eval(data); //eval("(" + data + ")"); + }, + error: function () { + keyMeta = null; + }, + }); + return keyMeta; +} diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..f3d2503fc2a44b5053b0837ebea6e87a2d339a43 GIT binary patch literal 6849 zcmaKRcUV(fvo}bjDT-7nLI_nlK}sT_69H+`qzVWDA|yaU?}j417wLi^B1KB1SLsC& zL0ag7$U(XW5YR7p&Ux?sP$d4lvMt8C^+TcQu4F zQqv!UF!I+kw)c0jhd6+g6oCr9P?7)?!qX1ui*iL{p}sKCAGuJ{{W)0z1pLF|=>h}& zt(2Lr0Z`2ig8<5i%Zk}cO5Fm=LByqGWaS`oqChZdEFmc`0hSb#gg|Aap^{+WKOYcj zHjINK)KDG%&s?Mt4CL(T=?;~U@bU2x_mLKN!#GJuK_CzbNw5SMEJorG!}_5;?R>@1 zSl)jns3WlU7^J%=(hUtfmuUCU&C3%8B5C^f5>W2Cy8jW3#{Od{lF1}|?c61##3dzA zsPlFG;l_FzBK}8>|H_Ru_H#!_7$UH4UK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L99RtQ>m(%#nQ#wrRC8Y%yxkH;d!MdY+Tw@r zjpSnK`;C-U{ATcgaxoEpP0Gf+tx);buOMlK=01D|J+ROu37qc*rD(w`#O=3*O*w9?biwNoq3WN1`&Wp8TvKj3C z3HR9ssH7a&Vr<6waJrU zdLg!ieYz%U^bmpn%;(V%%ugMk92&?_XX1K@mwnVSE6!&%P%Wdi7_h`CpScvspMx?N zQUR>oadnG17#hNc$pkTp+9lW+MBKHRZ~74XWUryd)4yd zj98$%XmIL4(9OnoeO5Fnyn&fpQ9b0h4e6EHHw*l68j;>(ya`g^S&y2{O8U>1*>4zR zq*WSI_2o$CHQ?x0!wl9bpx|Cm2+kFMR)oMud1%n2=qn5nE&t@Fgr#=Zv2?}wtEz^T z9rrj=?IH*qI5{G@Rn&}^Z{+TW}mQeb9=8b<_a`&Cm#n%n~ zU47MvCBsdXFB1+adOO)03+nczfWa#vwk#r{o{dF)QWya9v2nv43Zp3%Ps}($lA02*_g25t;|T{A5snSY?3A zrRQ~(Ygh_ebltHo1VCbJb*eOAr;4cnlXLvI>*$-#AVsGg6B1r7@;g^L zFlJ_th0vxO7;-opU@WAFe;<}?!2q?RBrFK5U{*ai@NLKZ^};Ul}beukveh?TQn;$%9=R+DX07m82gP$=}Uo_%&ngV`}Hyv8g{u z3SWzTGV|cwQuFIs7ZDOqO_fGf8Q`8MwL}eUp>q?4eqCmOTcwQuXtQckPy|4F1on8l zP*h>d+cH#XQf|+6c|S{7SF(Lg>bR~l(0uY?O{OEVlaxa5@e%T&xju=o1`=OD#qc16 zSvyH*my(dcp6~VqR;o(#@m44Lug@~_qw+HA=mS#Z^4reBy8iV?H~I;{LQWk3aKK8$bLRyt$g?-"); + textEscape = textEscape.replaceAll("\r", "
"); + textEscape = textEscape.replaceAll("\n", "
"); + textEscape = textEscape.replaceAll("\t", "    "); + + return textEscape; +} diff --git a/src/libs/secret.js b/src/libs/secret.js new file mode 100644 index 0000000..474c7ac --- /dev/null +++ b/src/libs/secret.js @@ -0,0 +1,57 @@ +import CryptoJS from 'crypto-js' +import pako from 'pako' + +/** + * @word 要加密的内容 + * @keyWord String 服务器随机返回的关键字 + * */ + +//加密 +export function md5(word, keyWord = 'F1agn0te') { + let srcWords = CryptoJS.enc.Utf8.parse(word + '_' + keyWord); + let encrypted = CryptoJS.MD5(srcWords); + return encrypted.toString(); +} + +//加密 +export function aesEncrypt(word, keyWord = 'F1agn0te') { + let key = CryptoJS.enc.Utf8.parse(keyWord); + let srcWords = CryptoJS.enc.Utf8.parse(word); + let encrypted = CryptoJS.AES.encrypt(srcWords, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}); + return encrypted.toString(); +} + +//解密 +export function aesDecrypt(word, keyWord = 'F1agn0te') { + let key = CryptoJS.enc.Utf8.parse(keyWord); + let decrypt = CryptoJS.AES.decrypt(word, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}); + return CryptoJS.enc.Utf8.stringify(decrypt).toString() +} + +export function encode(text) { + return btoa(encodeURIComponent(text)) +} + +export function decode(text) { + return decodeURIComponent(atob(text)) +} + +export function unzip(text) { + let charData = text.split(',').map(function (x) { + return parseInt(x) + }); + let binData = new Uint8Array(charData); + let data = pako.ungzip(binData); + //text = String.fromCharCode.apply(null, new Uint8Array(data)); + text = new Uint8Array(data).reduce(function (data, byte) { + return data + String.fromCharCode(byte); + }, ''); + return text; +} + +export function zip(text) { + text = pako.gzip(text, {to: 'string'}); + return text; +} + + diff --git a/src/libs/storage.js b/src/libs/storage.js new file mode 100644 index 0000000..dfed3df --- /dev/null +++ b/src/libs/storage.js @@ -0,0 +1,46 @@ +class Storage { + constructor() { + this.session = new Session(); + this.local = new Local(); + } +} + +class Session { + + setObject(key, value) { + sessionStorage.setItem(key, JSON.stringify(value)); + } + + getObject(key) { + return JSON.parse(sessionStorage.getItem(key)); + } + + setText(key, value) { + sessionStorage.setItem(key, value); + } + + getText(key) { + return sessionStorage.getItem(key); + } +} + +class Local { + setObject(key, value) { + localStorage.setItem(key, JSON.stringify(value)); + } + + getObject(key) { + return JSON.parse(localStorage.getItem(key)); + } + + setText(key, value) { + localStorage.setItem(key, value); + } + + getText(key) { + return localStorage.getItem(key); + } +} + +const storage = new Storage(); +export default storage; diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..6d93198 --- /dev/null +++ b/src/main.js @@ -0,0 +1,41 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import axios from 'axios' +import VueAxios from 'vue-axios' +import './plugins/iview.js' + +//import NProgress from 'nprogress'; +//import 'nprogress/nprogress.css'; + +//顶部页面加载条 + +// NProgress.configure({ +// easing: 'ease', +// speed: 500, +// showSpinner: false, +// trickleSpeed: 200, +// minimum: 0.3 +// }) + +// //路由监听 +// router.beforeEach((to, from, next) => { +// NProgress.start(); +// next(); +// }); + +// //路由跳转结束 +// router.afterEach(() => { +// NProgress.done() +// }) + +Vue.use(VueAxios, axios) + +Vue.config.productionTip = false + +new Vue({ + router, + render: h => h(App) +}).$mount('#app') + + diff --git a/src/plugins/iview.js b/src/plugins/iview.js new file mode 100644 index 0000000..288007a --- /dev/null +++ b/src/plugins/iview.js @@ -0,0 +1,6 @@ +import Vue from 'vue' +import ViewUI from 'view-design' + +Vue.use(ViewUI) + +import 'view-design/dist/styles/iview.css' diff --git a/src/plugins/tln/LICENSE b/src/plugins/tln/LICENSE new file mode 100644 index 0000000..6c77ec9 --- /dev/null +++ b/src/plugins/tln/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 Matheus Avellar + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/src/plugins/tln/README.md b/src/plugins/tln/README.md new file mode 100644 index 0000000..268ae8f --- /dev/null +++ b/src/plugins/tln/README.md @@ -0,0 +1,25 @@ +# Textarea with Line Numbers + +

I'm definitely not very good at naming projects

+ +--- + +This is a simple script to add dynamic line numbers to a textarea. By adding +`tln.js` and `tln.css` (or their corresponding minified versions) to an HTML +file and then calling the `TLN.append_line_numbers( id )` function, the +` + + + + + \ No newline at end of file diff --git a/src/plugins/tln/tln.css b/src/plugins/tln/tln.css new file mode 100644 index 0000000..108b82d --- /dev/null +++ b/src/plugins/tln/tln.css @@ -0,0 +1,48 @@ +.tln-active, .tln-wrapper, .tln-line { + margin: 0; + border: 0; + padding: 0; + outline: 0; + box-sizing: border-box; + vertical-align: middle; + list-style: none; +} +.tln-active { + display: inline-block; + padding: 0.625em; + width: calc(100% - 3em); + height: 100%; + font-size: 1em; + line-height: 1.5; + font-family: "Roboto Mono", monospace; + word-break: break-all; + border: 1px solid #aeaeae; + background-color: #fff; + resize: none; + overflow-wrap: normal; + overflow-x: auto; + white-space: pre; +} +.tln-wrapper { + width: 3em; + padding: 0.6875em 0.3125em 2.1875em; + height: 100%; + word-break: break-all; + overflow: hidden; + display: inline-block; + counter-reset: line; +} +.tln-line { + width: 100%; + display: block; + text-align: right; + line-height: 1.5; + font-size: 1em; + color: #aeaeae; +} +.tln-line::before { + counter-increment: line; + content: counter(line); + font-size: 1em; + user-select: none; +} \ No newline at end of file diff --git a/src/plugins/tln/tln.js b/src/plugins/tln/tln.js new file mode 100644 index 0000000..0f2a87d --- /dev/null +++ b/src/plugins/tln/tln.js @@ -0,0 +1,138 @@ +const TLN = { + eventList: {}, + update_line_numbers: function(ta, el) { + // Let's check if there are more or less lines than before + const line_count = ta.value.split("\n").length; + const child_count = el.children.length; + let difference = line_count - child_count; + // If there is any positive difference, we need to add more line numbers + if(difference > 0) { + // Create a fragment to work with so we only have to update DOM once + const frag = document.createDocumentFragment(); + // For each new line we need to add, + while(difference > 0) { + // Create a , add TLN class name, append to fragment and + // update difference + const line_number = document.createElement("span"); + line_number.className = "tln-line"; + frag.appendChild(line_number); + difference--; + } + // Append fragment (with children) to our wrapper element + el.appendChild(frag); + } + // If, however, there's negative difference, we need to remove line numbers + while(difference < 0) { + // Simple stuff, remove last child and update difference + el.removeChild(el.lastChild); + difference++; + } + }, + append_line_numbers: function(id) { + // Get reference to desired