Browse Source

Outsource global variables into 'initGlobals.js'

master
Erik Römmelt 5 years ago
parent
commit
783938821c

+ 1
- 2
public/index.html View File

<script src="lib/jquery-3.3.1.min.js"></script> <script src="lib/jquery-3.3.1.min.js"></script>


<!-- NOTE: Include .js Routes --> <!-- NOTE: Include .js Routes -->
<script src="routes/initGlobals.js"></script>
<script src="routes/auth.js"></script><!-- Must load before profile.js --> <script src="routes/auth.js"></script><!-- Must load before profile.js -->
<script src="routes/home.js"></script> <script src="routes/home.js"></script>
<script src="routes/files.js"></script> <script src="routes/files.js"></script>
<script src="routes/bookmark.js"></script> <script src="routes/bookmark.js"></script>
<script src="routes/profil.js"></script> <script src="routes/profil.js"></script>
<script src="routes/msgCard.js"></script> <script src="routes/msgCard.js"></script>
<script src="routes/messageData.js"></script>
<script src="routes/tagData.js"></script>
<script src="routes/majorData.js"></script> <script src="routes/majorData.js"></script>
<script src="routes/profilCard.js"></script> <script src="routes/profilCard.js"></script>
<script src="routes/navRoutes.js"></script> <script src="routes/navRoutes.js"></script>

+ 0
- 2
public/routes/auth.js View File

var auth = {};

function clearAuthState() { function clearAuthState() {
auth.user = ''; // Login name auth.user = ''; // Login name
auth.name = ''; // Full name auth.name = ''; // Full name

+ 2
- 4
public/routes/createMessage.js View File

var tagArray = [];
const CreateMsgRouter = { const CreateMsgRouter = {
template: ` template: `
<div class="content"> <div class="content">


data: function () { data: function () {
return { return {
auth: auth,
isDisabled: false, isDisabled: false,
selected: [], selected: [],
searchtext : "", searchtext : "",
}, },
methods: { methods: {
saveTagsToArray: function() { saveTagsToArray: function() {
tagArray = this.selected;
tagArray = this.selected;
console.info(tagArray); console.info(tagArray);
}, },
createMsg: function () { createMsg: function () {
var _subject = $("#subject").val(); var _subject = $("#subject").val();
var _message = $("#message").val(); var _message = $("#message").val();
var _tag = tagArray; var _tag = tagArray;
var _user = auth.name ? auth.name : $("#user").val();
var _user = auth.name != '' ? auth.name : $("#user").val();
//console.log("Message Created: " + _tag + " " + _message + " " + _user); //console.log("Message Created: " + _tag + " " + _message + " " + _user);
$.ajax({ $.ajax({
url: "api/msg", url: "api/msg",

+ 0
- 2
public/routes/files.js View File

var tagArray = [];

const FileRouter = { const FileRouter = {
template: ` template: `
<div class="content"> <div class="content">

+ 0
- 63
public/routes/home.js View File

}; };
}, },
methods: { methods: {
/*refresh_messages: function () {
_messages.push({ //////// alt
id: 42,
subject: "xxx",
message: "warum habt ihr auch so viel",
user: "nobody",
tags: "foo"
});
},*/
list_messages: function() { list_messages: function() {
messages(); messages();
} }
/*list_messages: function () {
$.ajax({url: "api/msg/ids", method: "GET"})
.done(jd => {
// NICHT SO wg. Vue: _messagelist = jd;
_messagelist.splice(0, _messagelist.length);
_messagelist.push.apply(_messagelist, jd);
//console.log("jd: "+jd);
for (var e in jd) {
if (!_messages[jd[e]]) {
get_insert_message(jd[e]);
}
}
if(!($".om-searchbar" = "")){
for (var e in jd) {
if (!_messages[jd[e]]) {
get_insert_message(jd[e]);
}
}
}else{
for (var e in jd) {
if (!_messages[jd[e]]) {
get_search_message(jd[e]);
}
}
}
}).fail(function (e, f, g) {
console.log("list_msg: err: " + e + f + g);
});
}*/
}, },


mounted: function () { mounted: function () {
console.log("cannot load " + id + ".json: " + e + f + g); console.log("cannot load " + id + ".json: " + e + f + g);
}) })
} }

/*function get_search_message(phrase) {
$.ajax({ url: "api/msg/search/"+phrase, method: "GET" }).done(function (msg) {
Vue.set(_messages, id, msg);
}).fail(function (e, f, g) {
console.log("cannot load " + id + ".json: " + e + f + g);
})
}
$(document).ready(function () {
console.log("egal");
$.get('list.json').done(function (jd) {
// _messagelist = jd;
_messagelist.splice(0, _messagelist.length);
_messagelist.push.apply(_messagelist, jd);
console.log("egal2");
//$('#xxx').text(jd[0]);
for (var e in jd) {
if (!_messages[jd[e]]) {
get_insert_message(jd[e]);
}
}
}).fail(function (e, f, g) {
console.log("egal3: " + e + f + g);
});
});*/

+ 18
- 0
public/routes/initGlobals.js View File

// Global Variables
// User
var auth = {},
majorList = [],

// Message
_messagelist = [],
_messages = {},

// Tag
_taglist = [],
_tags = [],
tagArray = [],

// Search
isSearchActive = false,
data = [],
search_data = [];

+ 1
- 1
public/routes/majorData.js View File

var majorList = [
majorList = [
{id:'B-AC',name:'Bachelor Angewandte Chemie'}, {id:'B-AC',name:'Bachelor Angewandte Chemie'},
{id:'B-AMP',name:'Bachelor Angewandte Mathematik und Physik'}, {id:'B-AMP',name:'Bachelor Angewandte Mathematik und Physik'},
{id:'B-TJ',name:'Bachelor Technikjournalismus/Technik-PR'}, {id:'B-TJ',name:'Bachelor Technikjournalismus/Technik-PR'},

+ 0
- 2
public/routes/messageData.js View File

_messagelist = [];
_messages = {};

+ 0
- 2
public/routes/tagData.js View File

_taglist = [];
_tags = [];

+ 0
- 6
public/search.js View File

var isSearchActive = false,
tagArray = ["lorem"];

const data=[],
search_data = [];

Vue.component('search',{ Vue.component('search',{
template: ` template: `
<form class="om-searchbar" @submit.prevent="search()"> <form class="om-searchbar" @submit.prevent="search()">

Loading…
Cancel
Save