mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-31 20:00:38 -05:00
added persistent search settings and tweaked view
This commit is contained in:
21
node_modules/vue-cookies/LICENSE
generated
vendored
Normal file
21
node_modules/vue-cookies/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
223
node_modules/vue-cookies/README.md
generated
vendored
Normal file
223
node_modules/vue-cookies/README.md
generated
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
# vue-cookies
|
||||
|
||||
A simple Vue.js plugin for handling browser cookies
|
||||
|
||||
## Installation
|
||||
|
||||
### Browser
|
||||
```
|
||||
<script src="https://unpkg.com/vue/dist/vue.js"></script>
|
||||
<script src="https://unpkg.com/vue-cookies@1.7.4/vue-cookies.js"></script>
|
||||
```
|
||||
### Package Managers
|
||||
```
|
||||
npm install vue-cookies --save
|
||||
|
||||
// require
|
||||
var Vue = require('vue')
|
||||
Vue.use(require('vue-cookies'))
|
||||
|
||||
// es2015 module
|
||||
import Vue from 'vue'
|
||||
import VueCookies from 'vue-cookies'
|
||||
Vue.use(VueCookies)
|
||||
|
||||
// set default config
|
||||
Vue.$cookies.config('7d')
|
||||
|
||||
// set global cookie
|
||||
Vue.$cookies.set('theme','default');
|
||||
Vue.$cookies.set('hover-time','1s');
|
||||
```
|
||||
|
||||
## Api
|
||||
|
||||
syntax format: **[this | Vue].$cookies.[method]**
|
||||
|
||||
* Set global config
|
||||
```
|
||||
$cookies.config(expireTimes[,path[, domain[, secure[, sameSite]]]) // default: expireTimes = 1d, path = '/', domain = '', secure = '', sameSite = 'Lax'
|
||||
```
|
||||
|
||||
* Set a cookie
|
||||
```
|
||||
$cookies.set(keyName, value[, expireTimes[, path[, domain[, secure[, sameSite]]]]]) //return this
|
||||
```
|
||||
* Get a cookie
|
||||
```
|
||||
$cookies.get(keyName) // return value
|
||||
```
|
||||
* Remove a cookie
|
||||
```
|
||||
$cookies.remove(keyName [, path [, domain]]) // return this
|
||||
```
|
||||
* Exist a `cookie name`
|
||||
```
|
||||
$cookies.isKey(keyName) // return false or true
|
||||
```
|
||||
* Get All `cookie name`
|
||||
```
|
||||
$cookies.keys() // return a array
|
||||
```
|
||||
|
||||
## Example Usage
|
||||
|
||||
#### set global config
|
||||
```
|
||||
// 30 day after, expire
|
||||
Vue.$cookies.config('30d')
|
||||
|
||||
// set secure, only https works
|
||||
Vue.$cookies.config('7d','','',true)
|
||||
|
||||
// 2019-03-13 expire
|
||||
this.$cookies.config(new Date(2019,03,13).toUTCString())
|
||||
|
||||
// 30 day after, expire, '' current path , browser default
|
||||
this.$cookies.config(60 * 60 * 24 * 30,'');
|
||||
|
||||
```
|
||||
|
||||
#### support json object
|
||||
```
|
||||
var user = { id:1, name:'Journal',session:'25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX' };
|
||||
this.$cookies.set('user',user);
|
||||
// print user name
|
||||
console.log(this.$cookies.get('user').name)
|
||||
```
|
||||
|
||||
#### set expire times
|
||||
**Suppose the current time is : Sat, 11 Mar 2017 12:25:57 GMT**
|
||||
|
||||
**Following equivalence: 1 day after, expire**
|
||||
|
||||
**Support chaining sets together**
|
||||
``` javascript
|
||||
// default expire time: 1 day
|
||||
this.$cookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX")
|
||||
// number + d , ignore case
|
||||
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX","1d")
|
||||
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX","1D")
|
||||
// Base of second
|
||||
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX",60 * 60 * 24)
|
||||
// input a Date, + 1day
|
||||
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX", new Date(2017, 03, 12))
|
||||
// input a date string, + 1day
|
||||
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX", "Sat, 13 Mar 2017 12:25:57 GMT")
|
||||
```
|
||||
#### set expire times, input number type
|
||||
|
||||
```
|
||||
this.$cookies.set("default_unit_second","input_value",1); // 1 second after, expire
|
||||
this.$cookies.set("default_unit_second","input_value",60 + 30); // 1 minute 30 second after, expire
|
||||
this.$cookies.set("default_unit_second","input_value",60 * 60 * 12); // 12 hour after, expire
|
||||
this.$cookies.set("default_unit_second","input_value",60 * 60 * 24 * 30); // 1 month after, expire
|
||||
```
|
||||
|
||||
#### set expire times - end of browser session
|
||||
|
||||
```
|
||||
this.$cookies.set("default_unit_second","input_value",0); // end of session - use 0 or "0"!
|
||||
```
|
||||
|
||||
|
||||
#### set expire times , input string type
|
||||
|
||||
| Unit | full name |
|
||||
| ----------- | ----------- |
|
||||
| y | year |
|
||||
| m | month |
|
||||
| d | day |
|
||||
| h | hour |
|
||||
| min | minute |
|
||||
| s | second |
|
||||
|
||||
**Unit Names Ignore Case**
|
||||
|
||||
**not support the combination**
|
||||
|
||||
**not support the double value**
|
||||
|
||||
```javascript
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313","60s"); // 60 second after, expire
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313","30MIN"); // 30 minute after, expire, ignore case
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313","24d"); // 24 day after, expire
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313","4m"); // 4 month after, expire
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313","16h"); // 16 hour after, expire
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313","3y"); // 3 year after, expire
|
||||
|
||||
// input date string
|
||||
this.$cookies.set('token',"GH1.1.1689020474.1484362313", new Date(2017,3,13).toUTCString());
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313", "Sat, 13 Mar 2017 12:25:57 GMT ");
|
||||
```
|
||||
|
||||
#### set expire support date
|
||||
```
|
||||
var date = new Date;
|
||||
date.setDate(date.getDate() + 1);
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313", date);
|
||||
```
|
||||
|
||||
#### set never expire
|
||||
```
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313", Infinity); // never expire
|
||||
// never expire , only -1,Other negative Numbers are invalid
|
||||
this.$cookies.set("token","GH1.1.1689020474.1484362313", -1);
|
||||
```
|
||||
|
||||
#### remove cookie
|
||||
```
|
||||
this.$cookies.set("token",value); // domain.com and *.doamin.com are readable
|
||||
this.$cookies.remove("token"); // remove token of domain.com and *.doamin.com
|
||||
|
||||
this.$cookies.set("token", value, null, null, "domain.com"); // only domain.com are readable
|
||||
this.$cookies.remove("token", null, "domain.com"); // remove token of domain.com
|
||||
```
|
||||
|
||||
#### set other arguments
|
||||
```
|
||||
// set path
|
||||
this.$cookies.set("use_path_argument","value","1d","/app");
|
||||
|
||||
// set domain
|
||||
this.$cookies.set("use_path_argument","value",null, null, "domain.com"); // default 1 day after,expire
|
||||
|
||||
// set secure
|
||||
this.$cookies.set("use_path_argument","value",null, null, null,true);
|
||||
|
||||
// set sameSite - should be one of `None`, `Strict` or `Lax`. Read more https://web.dev/samesite-cookies-explained/
|
||||
this.$cookies.set("use_path_argument","value",null, null, null, null, "Lax");
|
||||
```
|
||||
|
||||
#### other operation
|
||||
```
|
||||
// check a cookie exist
|
||||
this.$cookies.isKey("token")
|
||||
|
||||
// get a cookie
|
||||
this.$cookies.get("token");
|
||||
|
||||
// remove a cookie
|
||||
this.$cookies.remove("token");
|
||||
|
||||
// get all cookie key names, line shows
|
||||
this.$cookies.keys().join("\n");
|
||||
|
||||
// remove all cookie
|
||||
this.$cookies.keys().forEach(cookie => this.$cookies.remove(cookie))
|
||||
|
||||
// vue-cookies global
|
||||
[this | Vue].$cookies.[method]
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Warning
|
||||
|
||||
**$cookies key names Cannot be set to ['expires','max-age','path','domain','secure','SameSite']**
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT](http://opensource.org/licenses/MIT)
|
||||
Copyright (c) 2016-present, cmp-cc
|
||||
29
node_modules/vue-cookies/package.json
generated
vendored
Normal file
29
node_modules/vue-cookies/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "vue-cookies",
|
||||
"version": "1.7.4",
|
||||
"description": "A simple Vue.js plugin for handling browser cookies",
|
||||
"main": "vue-cookies.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cmp-cc/vue-cookies.git"
|
||||
},
|
||||
"keywords":[
|
||||
"javascript",
|
||||
"vue",
|
||||
"cookie",
|
||||
"cookies",
|
||||
"vue-cookies",
|
||||
"browser",
|
||||
"session"
|
||||
],
|
||||
"author": "cmp-cc",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cmp-cc/vue-cookies/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cmp-cc/vue-cookies#readme",
|
||||
"typings": "types/index.d.ts"
|
||||
}
|
||||
51
node_modules/vue-cookies/sample/welcome.html
generated
vendored
Normal file
51
node_modules/vue-cookies/sample/welcome.html
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script src="https://unpkg.com/vue/dist/vue.js"></script>
|
||||
<script src="../vue-cookies.js"></script>
|
||||
<title>Welcome Username</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="v-main">
|
||||
|
||||
<p v-if="!welcomeValue">
|
||||
Please enter your name : <input type="text" @keyup.enter="username">
|
||||
</p>
|
||||
<p v-else>
|
||||
Welcome again : {{ welcomeValue }}
|
||||
<button @click="deleteUser">{{deleteUserText}}</button>
|
||||
{{deleteUserState}}
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
|
||||
new Vue({
|
||||
el:'#v-main',
|
||||
data: function() {
|
||||
return {
|
||||
welcomeValue: this.$cookies.get('username'),
|
||||
deleteUserText : 'Delete Cookie',
|
||||
deleteUserState:''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
username : function(event){
|
||||
this.welcomeValue = event.target.value;
|
||||
this.$cookies.set('username', this.welcomeValue)
|
||||
},
|
||||
deleteUser: function(){
|
||||
this.$cookies.remove('username');
|
||||
this.deleteUserState = '√'
|
||||
|
||||
setTimeout(function(){
|
||||
location.reload()
|
||||
}, 0.5 * 1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
</html>
|
||||
44
node_modules/vue-cookies/types/index.d.ts
generated
vendored
Normal file
44
node_modules/vue-cookies/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import _Vue from 'vue';
|
||||
import './vue';
|
||||
|
||||
export declare function install(Vue: typeof _Vue): void;
|
||||
|
||||
export interface VueCookies {
|
||||
/**
|
||||
* Set global config
|
||||
*/
|
||||
config(expireTimes: string | number | Date, path?: string, domain?: string, secure?: boolean, sameSite?: string): void;
|
||||
|
||||
/**
|
||||
* Set a cookie
|
||||
*/
|
||||
set(keyName: string, value: any, expireTimes?: string | number | Date,
|
||||
path?: string, domain?: string, secure?: boolean, sameSite?: string): this;
|
||||
|
||||
/**
|
||||
* Get a cookie
|
||||
*/
|
||||
get(keyName: string): any;
|
||||
|
||||
/**
|
||||
* Remove a cookie
|
||||
*/
|
||||
remove(keyName: string, path?: string, domain?: string): this;
|
||||
|
||||
/**
|
||||
* Exist a cookie name
|
||||
*/
|
||||
isKey(keyName: string): boolean;
|
||||
|
||||
/**
|
||||
* Get All cookie name
|
||||
*/
|
||||
keys(): string[];
|
||||
}
|
||||
|
||||
declare const _default : {
|
||||
VueCookies: VueCookies;
|
||||
install: typeof install;
|
||||
};
|
||||
|
||||
export default _default;
|
||||
11
node_modules/vue-cookies/types/vue.d.ts
generated
vendored
Normal file
11
node_modules/vue-cookies/types/vue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { VueCookies } from "./index";
|
||||
|
||||
declare module "vue/types/vue" {
|
||||
interface Vue {
|
||||
$cookies: VueCookies;
|
||||
}
|
||||
|
||||
interface VueConstructor {
|
||||
$cookies: VueCookies;
|
||||
}
|
||||
}
|
||||
146
node_modules/vue-cookies/vue-cookies.js
generated
vendored
Normal file
146
node_modules/vue-cookies/vue-cookies.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* Vue Cookies v1.7.4
|
||||
* https://github.com/cmp-cc/vue-cookies
|
||||
*
|
||||
* Copyright 2016, cmp-cc
|
||||
* Released under the MIT license
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
var defaultConfig = {
|
||||
expires: '1d',
|
||||
path: '; path=/',
|
||||
domain: '',
|
||||
secure: '',
|
||||
sameSite: '; SameSite=Lax'
|
||||
};
|
||||
|
||||
var VueCookies = {
|
||||
// install of Vue
|
||||
install: function (Vue) {
|
||||
Vue.prototype.$cookies = this;
|
||||
Vue.$cookies = this;
|
||||
},
|
||||
config: function (expireTimes, path, domain, secure, sameSite) {
|
||||
defaultConfig.expires = expireTimes ? expireTimes : '1d';
|
||||
defaultConfig.path = path ? '; path=' + path : '; path=/';
|
||||
defaultConfig.domain = domain ? '; domain=' + domain : '';
|
||||
defaultConfig.secure = secure ? '; Secure' : '';
|
||||
defaultConfig.sameSite = sameSite ? '; SameSite=' + sameSite : '; SameSite=Lax';
|
||||
},
|
||||
get: function (key) {
|
||||
var value = decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + encodeURIComponent(key).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1')) || null;
|
||||
|
||||
if (value && value.substring(0, 1) === '{' && value.substring(value.length - 1, value.length) === '}') {
|
||||
try {
|
||||
value = JSON.parse(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
},
|
||||
set: function (key, value, expireTimes, path, domain, secure, sameSite) {
|
||||
if (!key) {
|
||||
throw new Error('Cookie name is not find in first argument.');
|
||||
} else if (/^(?:expires|max\-age|path|domain|secure|SameSite)$/i.test(key)) {
|
||||
throw new Error('Cookie key name illegality, Cannot be set to ["expires","max-age","path","domain","secure","SameSite"]\t current key name: ' + key);
|
||||
}
|
||||
// support json object
|
||||
if (value && value.constructor === Object) {
|
||||
value = JSON.stringify(value);
|
||||
}
|
||||
var _expires = '';
|
||||
expireTimes = expireTimes == undefined ? defaultConfig.expires : expireTimes;
|
||||
if (expireTimes && expireTimes != 0) {
|
||||
switch (expireTimes.constructor) {
|
||||
case Number:
|
||||
if (expireTimes === Infinity || expireTimes === -1) _expires = '; expires=Fri, 31 Dec 9999 23:59:59 GMT';
|
||||
else _expires = '; max-age=' + expireTimes;
|
||||
break;
|
||||
case String:
|
||||
if (/^(?:\d+(y|m|d|h|min|s))$/i.test(expireTimes)) {
|
||||
// get capture number group
|
||||
var _expireTime = expireTimes.replace(/^(\d+)(?:y|m|d|h|min|s)$/i, '$1');
|
||||
// get capture type group , to lower case
|
||||
switch (expireTimes.replace(/^(?:\d+)(y|m|d|h|min|s)$/i, '$1').toLowerCase()) {
|
||||
// Frequency sorting
|
||||
case 'm':
|
||||
_expires = '; max-age=' + +_expireTime * 2592000;
|
||||
break; // 60 * 60 * 24 * 30
|
||||
case 'd':
|
||||
_expires = '; max-age=' + +_expireTime * 86400;
|
||||
break; // 60 * 60 * 24
|
||||
case 'h':
|
||||
_expires = '; max-age=' + +_expireTime * 3600;
|
||||
break; // 60 * 60
|
||||
case 'min':
|
||||
_expires = '; max-age=' + +_expireTime * 60;
|
||||
break; // 60
|
||||
case 's':
|
||||
_expires = '; max-age=' + _expireTime;
|
||||
break;
|
||||
case 'y':
|
||||
_expires = '; max-age=' + +_expireTime * 31104000;
|
||||
break; // 60 * 60 * 24 * 30 * 12
|
||||
default:
|
||||
new Error('unknown exception of "set operation"');
|
||||
}
|
||||
} else {
|
||||
_expires = '; expires=' + expireTimes;
|
||||
}
|
||||
break;
|
||||
case Date:
|
||||
_expires = '; expires=' + expireTimes.toUTCString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
document.cookie =
|
||||
encodeURIComponent(key) + '=' + encodeURIComponent(value) +
|
||||
_expires +
|
||||
(domain ? '; domain=' + domain : defaultConfig.domain) +
|
||||
(path ? '; path=' + path : defaultConfig.path) +
|
||||
(secure == undefined ? defaultConfig.secure : secure ? '; Secure' : '') +
|
||||
(sameSite == undefined ? defaultConfig.sameSite : (sameSite ? '; SameSite=' + sameSite : ''));
|
||||
return this;
|
||||
},
|
||||
remove: function (key, path, domain) {
|
||||
if (!key || !this.isKey(key)) {
|
||||
return false;
|
||||
}
|
||||
document.cookie = encodeURIComponent(key) +
|
||||
'=; expires=Thu, 01 Jan 1970 00:00:00 GMT' +
|
||||
(domain ? '; domain=' + domain : defaultConfig.domain) +
|
||||
(path ? '; path=' + path : defaultConfig.path) +
|
||||
'; SameSite=Lax';
|
||||
return this;
|
||||
},
|
||||
isKey: function (key) {
|
||||
return (new RegExp('(?:^|;\\s*)' + encodeURIComponent(key).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=')).test(document.cookie);
|
||||
},
|
||||
keys: function () {
|
||||
if (!document.cookie) return [];
|
||||
var _keys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, '').split(/\s*(?:\=[^;]*)?;\s*/);
|
||||
for (var _index = 0; _index < _keys.length; _index++) {
|
||||
_keys[_index] = decodeURIComponent(_keys[_index]);
|
||||
}
|
||||
return _keys;
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof exports == 'object') {
|
||||
module.exports = VueCookies;
|
||||
} else if (typeof define == 'function' && define.amd) {
|
||||
define([], function () {
|
||||
return VueCookies;
|
||||
});
|
||||
} else if (window.Vue) {
|
||||
Vue.use(VueCookies);
|
||||
}
|
||||
// vue-cookies can exist independently,no dependencies library
|
||||
if (typeof window !== 'undefined') {
|
||||
window.$cookies = VueCookies;
|
||||
}
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user