# Conflicts: # public/routes/createMessage.js # public/routes/files.jsmaster
},o.isDate=function(n){return H(n)&&"[object Date]"==hn.call(n)},o.isEmpty=function(t){return M(t)&&(Nn(t)||L(t)||U(t.splice)||n(t))?!t.length:!_n(t).length},o.isEqual=function(n,t){return b(n,t)},o.isFinite=function(n){return typeof n=="number"&&gn(n)},o.isFunction=U,o.isNaN=function(n){return K(n)&&n!=+n},o.isNull=function(n){return null===n},o.isNumber=K,o.isObject=V,o.isRegExp=function(n){return H(n)&&"[object RegExp]"==hn.call(n)},o.isString=L,o.isUndefined=function(n){return n===Z},o.last=function(n){ | },o.isDate=function(n){return H(n)&&"[object Date]"==hn.call(n)},o.isEmpty=function(t){return M(t)&&(Nn(t)||L(t)||U(t.splice)||n(t))?!t.length:!_n(t).length},o.isEqual=function(n,t){return b(n,t)},o.isFinite=function(n){return typeof n=="number"&&gn(n)},o.isFunction=U,o.isNaN=function(n){return K(n)&&n!=+n},o.isNull=function(n){return null===n},o.isNumber=K,o.isObject=V,o.isRegExp=function(n){return H(n)&&"[object RegExp]"==hn.call(n)},o.isString=L,o.isUndefined=function(n){return n===Z},o.last=function(n){ | ||||
var t=null==n?0:n.length;return t?n[t-1]:Z},o.max=function(n){return n&&n.length?a(n,X,v):Z},o.min=function(n){return n&&n.length?a(n,X,_):Z},o.noConflict=function(){return on._===this&&(on._=vn),this},o.noop=function(){},o.reduce=C,o.result=function(n,t,r){return t=null==n?Z:n[t],t===Z&&(t=r),U(t)?t.call(n):t},o.size=function(n){return null==n?0:(n=M(n)?n:_n(n),n.length)},o.some=function(n,t,r){return t=r?Z:t,E(n,g(t))},o.uniqueId=function(n){var t=++sn;return Q(n)+t},o.each=z,o.first=q,Y(o,function(){ | var t=null==n?0:n.length;return t?n[t-1]:Z},o.max=function(n){return n&&n.length?a(n,X,v):Z},o.min=function(n){return n&&n.length?a(n,X,_):Z},o.noConflict=function(){return on._===this&&(on._=vn),this},o.noop=function(){},o.reduce=C,o.result=function(n,t,r){return t=null==n?Z:n[t],t===Z&&(t=r),U(t)?t.call(n):t},o.size=function(n){return null==n?0:(n=M(n)?n:_n(n),n.length)},o.some=function(n,t,r){return t=r?Z:t,E(n,g(t))},o.uniqueId=function(n){var t=++sn;return Q(n)+t},o.each=z,o.first=q,Y(o,function(){ | ||||
var n={};return s(o,function(t,r){pn.call(o.prototype,r)||(n[r]=t)}),n}(),{chain:false}),o.VERSION="4.17.15",mn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?String.prototype:an)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);o.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Nn(u)?u:[],n)}return this[r](function(r){return t.apply(Nn(r)?r:[],n); | var n={};return s(o,function(t,r){pn.call(o.prototype,r)||(n[r]=t)}),n}(),{chain:false}),o.VERSION="4.17.15",mn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?String.prototype:an)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);o.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Nn(u)?u:[],n)}return this[r](function(r){return t.apply(Nn(r)?r:[],n); | ||||
})}}),o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=function(){return w(this.__wrapped__,this.__actions__)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?(on._=o, define(function(){return o})):cn?((cn.exports=o)._=o,un._=o):on._=o}).call(this); | |||||
})}}),o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=function(){return w(this.__wrapped__,this.__actions__)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?(on._=o, define(function(){return o})):cn?((cn.exports=o)._=o,un._=o):on._=o}).call(this); |
module.exports = require('./lodash'); | |||||
module.exports = require('./lodash'); |
n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c<a;){var l=o[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=Ci(n,f+s);break;case"takeRight":f=Ui(f,n-s)}}if(n={start:f,end:n},o=n.start,f=n.end,n=f-o,o=u?f:o-1,f=this.__iteratees__,c=f.length,a=0,l=Ci(n,this.__takeCount__),!e||!u&&i==n&&l==n)return wr(t,this.__actions__); | n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c<a;){var l=o[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=Ci(n,f+s);break;case"takeRight":f=Ui(f,n-s)}}if(n={start:f,end:n},o=n.start,f=n.end,n=f-o,o=u?f:o-1,f=this.__iteratees__,c=f.length,a=0,l=Ci(n,this.__takeCount__),!e||!u&&i==n&&l==n)return wr(t,this.__actions__); | ||||
e=[];n:for(;n--&&a<l;){for(o+=r,u=-1,i=t[o];++u<c;){var h=f[u],s=h.type,h=(0,h.iteratee)(i);if(2==s)i=h;else if(!h){if(1==s)continue n;break n}}e[a++]=i}return e},An.prototype.at=To,An.prototype.chain=function(){return Ye(this)},An.prototype.commit=function(){return new On(this.value(),this.__chain__)},An.prototype.next=function(){this.__values__===T&&(this.__values__=mu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){ | e=[];n:for(;n--&&a<l;){for(o+=r,u=-1,i=t[o];++u<c;){var h=f[u],s=h.type,h=(0,h.iteratee)(i);if(2==s)i=h;else if(!h){if(1==s)continue n;break n}}e[a++]=i}return e},An.prototype.at=To,An.prototype.chain=function(){return Ye(this)},An.prototype.commit=function(){return new On(this.value(),this.__chain__)},An.prototype.next=function(){this.__values__===T&&(this.__values__=mu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){ | ||||
for(var t,r=this;r instanceof En;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head, | for(var t,r=this;r instanceof En;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head, | ||||
wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this); | |||||
wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this); |
</div> | </div> | ||||
<script> | <script> | ||||
new Vue({ | new Vue({ | ||||
router, | router, | ||||
el: '#api', | el: '#api', | ||||
// Locally registered variables | // Locally registered variables | ||||
auth: auth, | auth: auth, | ||||
}, | }, | ||||
computed:{ | computed:{ | ||||
// Methods to change data appearance, does cache results | // Methods to change data appearance, does cache results | ||||
}, | }, | ||||
}); | }); | ||||
</script> | </script> | ||||
<!-- NOTE: Call SW registration --> | <!-- NOTE: Call SW registration --> | ||||
<script src="registerSW.js"></script> | <script src="registerSW.js"></script> | ||||
var tagArray = []; | var tagArray = []; | ||||
const data=[ | |||||
'th', | |||||
'efi', | |||||
'wichtig', | |||||
]; | |||||
const CreateMsgRouter = { | const CreateMsgRouter = { | ||||
template: ` | template: ` | ||||
<div class="content"> | <div class="content"> | ||||
<b-taginput | <b-taginput | ||||
id="tag" | id="tag" | ||||
v-model="selected" | v-model="selected" | ||||
:data=taglist | |||||
:data="filteredDataArray" | |||||
autocomplete | autocomplete | ||||
allow-new:false | allow-new:false | ||||
icon="label" | icon="label" | ||||
placeholder="#" | placeholder="#" | ||||
@typing="getFilteredTags" | |||||
@input="saveTagsToArray"> | @input="saveTagsToArray"> | ||||
</b-taginput> | </b-taginput> | ||||
</b-field> | </b-field> | ||||
auth: auth, | auth: auth, | ||||
isDisabled: false, | isDisabled: false, | ||||
selected: [], | selected: [], | ||||
searchtext : "", | |||||
taglist: data, | taglist: data, | ||||
}; | }; | ||||
}, | }, | ||||
computed:{ | |||||
filteredDataArray() { | |||||
return this.taglist.filter((option) => { | |||||
return option | |||||
.toString() | |||||
.toLowerCase() | |||||
.indexOf(this.searchtext.toLowerCase()) >= 0 | |||||
}) | |||||
} | |||||
}, | |||||
methods: { | methods: { | ||||
saveTagsToArray: function() { | saveTagsToArray: function() { | ||||
tagArray = this.selected; | tagArray = this.selected; | ||||
$.ajax({url: "api/tag/ids",method: "GET"}) | $.ajax({url: "api/tag/ids",method: "GET"}) | ||||
.done(jd => { | .done(jd => { | ||||
// NICHT SO wg. Vue: _messagelist = jd; | // NICHT SO wg. Vue: _messagelist = jd; | ||||
_taglist.splice(0, _taglist.length); | |||||
_taglist.push.apply(_taglist, jd); | |||||
console.log("tag: jd: " + jd); | |||||
for (var e in jd) { | |||||
if (!_tags[jd[e]]) { | |||||
get_insert_tag(jd[e]); | |||||
console.log("DATA: "+data); | |||||
if(data == ""){ | |||||
_taglist.splice(0, _taglist.length); | |||||
_taglist.push.apply(_taglist, jd); | |||||
console.log("tag: jd: " + jd); | |||||
for (var e in jd) { | |||||
if (!_tags[jd[e]]) { | |||||
get_insert_tag(jd[e]); | |||||
} | |||||
} | } | ||||
} | } | ||||
}).fail(function (e, f, g) { | }).fail(function (e, f, g) { | ||||
userField.prop('disabled',false); | userField.prop('disabled',false); | ||||
} | } | ||||
this.list_tags(); | |||||
//this.list_tags(); | |||||
if ($(this).bootstrapMaterialDesign) | if ($(this).bootstrapMaterialDesign) | ||||
$(this).bootstrapMaterialDesign(); | $(this).bootstrapMaterialDesign(); | ||||
}, | }, | ||||
}; | }; | ||||
function get_insert_tag(id){ | |||||
$.ajax({ url: "api/tag/id/"+id, method: "GET" }).done(function (tag) { | |||||
data.push("#" + tag.name); | |||||
console.log("Array:"+this.data); | |||||
}).fail(function (e, f, g) { | |||||
console.log("cannot load " + id + ".json: " + e + f + g); | |||||
}) | |||||
} |
const FileRouter = { | const FileRouter = { | ||||
template: ` | template: ` | ||||
<div class="content"> | <div class="content"> | ||||
<div class="column is-four-fifths-desktop pull-right-sm"> | <div class="column is-four-fifths-desktop pull-right-sm"> | ||||
<h4>Erweiterte Suche</h4> | <h4>Erweiterte Suche</h4> | ||||
<b-field label="Suche nach"> | <b-field label="Suche nach"> | ||||
</b-field> | </b-field> | ||||
<b-field v-if="selectedOptions=='tags'"> | <b-field v-if="selectedOptions=='tags'"> | ||||
<b-autocomplete rounded v-model="searchtext" | |||||
<b-autocomplete v-model="searchtext" | |||||
:data="filteredDataArray" | :data="filteredDataArray" | ||||
placeholder="suche..." icon="magnify" | |||||
placeholder="#" icon="label" | |||||
@select="option => selected = option"> | @select="option => selected = option"> | ||||
</b-autocomplete> | </b-autocomplete> | ||||
</b-field> | </b-field> | ||||
<b-button type="is-primary" @click="search">SUCHE</b-button> | <b-button type="is-primary" @click="search">SUCHE</b-button> | ||||
<div id="om-msg-cards"> | |||||
<div id="om-msg-cards" v-if="isExtendedSearch==true"> | |||||
<MsgCard | <MsgCard | ||||
v-for="id in messagelist.slice().reverse()" | v-for="id in messagelist.slice().reverse()" | ||||
:key="id" | :key="id" | ||||
></MsgCard> | ></MsgCard> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
`, | `, | ||||
data: function () { | data: function () { | ||||
taglist: data, | taglist: data, | ||||
messagelist: _messagelist, | messagelist: _messagelist, | ||||
messages: _messages, | messages: _messages, | ||||
isExtendedSearch: false, | |||||
} | } | ||||
}, | }, | ||||
computed: { | computed: { | ||||
list_messages: function () { | list_messages: function () { | ||||
messages(); | messages(); | ||||
}, | }, | ||||
saveTagsToArray: function () { | |||||
tagArray = this.selected; | |||||
console.info(tagArray); | |||||
}, | |||||
getFilteredTags(text) { | getFilteredTags(text) { | ||||
this.taglist = data.filter((option) => { | this.taglist = data.filter((option) => { | ||||
return option | return option | ||||
.toLowerCase() | .toLowerCase() | ||||
.indexOf(text.toLowerCase()) >= 0 | .indexOf(text.toLowerCase()) >= 0 | ||||
}) | }) | ||||
this.search(); | |||||
}, | }, | ||||
list_tags: function () { | list_tags: function () { | ||||
$.ajax({ | $.ajax({ | ||||
}) | }) | ||||
.done(jd => { | .done(jd => { | ||||
// NICHT SO wg. Vue: _messagelist = jd; | // NICHT SO wg. Vue: _messagelist = jd; | ||||
if(data == ""){ | |||||
_taglist.splice(0, _taglist.length); | _taglist.splice(0, _taglist.length); | ||||
_taglist.push.apply(_taglist, jd); | _taglist.push.apply(_taglist, jd); | ||||
console.log("tag: jd: " + jd); | console.log("tag: jd: " + jd); | ||||
get_insert_tag(jd[e]); | get_insert_tag(jd[e]); | ||||
} | } | ||||
} | } | ||||
} | |||||
}).fail(function (e, f, g) { | }).fail(function (e, f, g) { | ||||
console.log("err: " + e + f + g); | console.log("err: " + e + f + g); | ||||
}); | }); | ||||
}, | }, | ||||
search: function () { | search: function () { | ||||
searching(this.searchtext); | searching(this.searchtext); | ||||
this.isExtendedSearch=true; | |||||
}, | }, | ||||
list_messages: function () { | list_messages: function () { | ||||
messages(); | messages(); | ||||
}, | }, | ||||
mounted: function () { | mounted: function () { | ||||
//this.search(); | //this.search(); | ||||
this.list_tags(); | |||||
//this.list_tags(); | |||||
//this.list_messages(); | //this.list_messages(); | ||||
}, | }, | ||||
}; | }; |
var isSearchActive = false, | var isSearchActive = false, | ||||
tagArray = ["lorem"]; | tagArray = ["lorem"]; | ||||
const dat=[ | |||||
'th', | |||||
'efi', | |||||
'wichtig', | |||||
], | |||||
const data=[], | |||||
search_data = []; | search_data = []; | ||||
Vue.component('search',{ | Vue.component('search',{ | ||||
return{ | return{ | ||||
searchtext: "", | searchtext: "", | ||||
selected: [], | selected: [], | ||||
taglist: dat, | |||||
taglist: data, | |||||
}; | }; | ||||
}, | }, | ||||
computed:{ | computed:{ | ||||
}, | }, | ||||
methods: { | methods: { | ||||
getFilteredTags(text) { | getFilteredTags(text) { | ||||
this.taglist = dat.filter((option) => { | |||||
this.taglist = data.filter((option) => { | |||||
return option | return option | ||||
.toString() | .toString() | ||||
.toLowerCase() | .toLowerCase() | ||||
$.ajax({url: "api/tag/ids", method: "GET"}) | $.ajax({url: "api/tag/ids", method: "GET"}) | ||||
.done(jd => { | .done(jd => { | ||||
// NICHT SO wg. Vue: _messagelist = jd; | // NICHT SO wg. Vue: _messagelist = jd; | ||||
if(data == ""){ | |||||
_taglist.splice(0, _taglist.length); | _taglist.splice(0, _taglist.length); | ||||
_taglist.push.apply(_taglist, jd); | _taglist.push.apply(_taglist, jd); | ||||
// console.log("tag: jd: " + jd); | // console.log("tag: jd: " + jd); | ||||
get_insert_tag(jd[e]); | get_insert_tag(jd[e]); | ||||
} | } | ||||
} | } | ||||
} | |||||
}).fail(function (e, f, g) { | }).fail(function (e, f, g) { | ||||
console.log("err: " + e + f + g); | console.log("err: " + e + f + g); | ||||
}); | }); | ||||
url: "api/tag/id/" + id, | url: "api/tag/id/" + id, | ||||
method: "GET" | method: "GET" | ||||
}).done(function(tag) { | }).done(function(tag) { | ||||
dat.push("#" + tag.name); | |||||
data.push("#" + tag.name); | |||||
}).fail(function(e, f, g) { | }).fail(function(e, f, g) { | ||||
console.log("cannot load " + id + ".json: " + e + f + g); | console.log("cannot load " + id + ".json: " + e + f + g); | ||||
}) | }) |
get: function(req, res) { | get: function(req, res) { | ||||
model.Messages.find( | model.Messages.find( | ||||
{$text: {$search: req.params.phrase}}) | {$text: {$search: req.params.phrase}}) | ||||
.sort({tag:1, user:1, message:1, subject:1}) | |||||
.sort({tag:-1}) | |||||
.exec().then(results => { | .exec().then(results => { | ||||
//selects id from message: | //selects id from message: | ||||
var parsed = []; | var parsed = []; |