From 72ad0e53f3887b5ad74034a99c6453a88eeb0cbd Mon Sep 17 00:00:00 2001 From: rtz12 Date: Sun, 17 Jan 2016 22:31:12 +0100 Subject: Geiles neues Buildsystem fuer die Assets diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..50d02c1 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +CSS_FILES := $(shell find assets_src/css/ -maxdepth 1 -type f -name '*.css') +CSS_FILES := $(addprefix assets/, $(CSS_FILES:assets_src/%=%)) +LESS_FILES := $(shell find assets_src/css/ -maxdepth 1 -type f -name '*.less') +LESS_FILES := $(addprefix assets/, $(LESS_FILES:assets_src/%=%)) +LESS_FILES := $(LESS_FILES:.less=.css) +JS_FILES := $(shell find assets_src/js/ -maxdepth 1 -type f -name '*.js') +JS_FILES := $(addprefix assets/, $(JS_FILES:assets_src/%=%)) + +all: $(CSS_FILES) $(LESS_FILES) $(JS_FILES) + +assets/css/%.css: assets_src/css/%.css + cp $< $@ + +assets/js/%.css: assets_src/css/%.less + lessc $< > $@ + +assets/js/%.js: assets_src/css/%.js + babel $< -o $@ + +clean: + -rm -- $(CSS_FILES) + -rm -- $(LESS_FILES) + -rm -- $(JS_FILES) + +run: all + go run *.go + +.PHONY: all clear run + diff --git a/assets/css/gril.css b/assets/css/gril.css deleted file mode 100644 index b82e2c7..0000000 --- a/assets/css/gril.css +++ /dev/null @@ -1,31 +0,0 @@ -#gril-title { - margin-bottom: 0rem; -} - -#gril-alias { - margin-top: 0rem; - margin-bottom: 1rem; -} - -.gril-tag { - transition: background-color .2s, color .2s; -} - -.gril-tag:hover { - background-color: #BA68C8; - color: #FFF; -} - -h1 > small { - padding-left: 8px; - font-size: 50%; -} - -.card-title.big { - font-size: 36px !important; -} - -.card-content.center-big { - padding-top: 9px; - padding-bottom: 9px; -} diff --git a/assets/css/list.css b/assets/css/list.css deleted file mode 100644 index 7e6dde9..0000000 --- a/assets/css/list.css +++ /dev/null @@ -1,27 +0,0 @@ -.jap-name { - color: rgb(166, 166, 166); -} - -.list-entry { - height: 80px; - padding: 8px; -} - -.list-img { - width: 64px; - height: 64px; -} - -.list-controls { - position: relative; - top: 8px; - left: -15px; -} - -.gril-img { - background-repeat: no-repeat; - background-position: center center; - background-size: cover; - width: 64px; - height: 64px; -} \ No newline at end of file diff --git a/assets/css/search.css b/assets/css/search.css deleted file mode 100644 index 124a378..0000000 --- a/assets/css/search.css +++ /dev/null @@ -1,20 +0,0 @@ -.collection .collection-item.avatar { - min-height: 64px !important; -} - -.collection-item.avatar > .circle { - top: 12px; -} - -.search-results { - top: -50px; - z-index: 2; -} - -.collection > .collection-item { - transition: background-color .35s; -} - -.collection > .collection-item:hover { - background-color: #e1bee7; -} \ No newline at end of file diff --git a/assets/js/list.js b/assets/js/list.js deleted file mode 100644 index 25ff80d..0000000 --- a/assets/js/list.js +++ /dev/null @@ -1,17 +0,0 @@ -function clickSearchResult(resId) { - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() { - if (xhr.readyState == XMLHttpRequest.DONE) { - if (xhr.status !== 200) { - alert(xhr.status + ": " + xhr.response); - return; - } - - data = xhr.responseText; - document.getElementById("gril-list").innerHTML += data; - } - } - xhr.open('POST', window.location, true); - xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhr.send('id=' + resId); -} \ No newline at end of file diff --git a/assets/js/search.js b/assets/js/search.js deleted file mode 100644 index 0cb33df..0000000 --- a/assets/js/search.js +++ /dev/null @@ -1,40 +0,0 @@ -var strokeTimeout = null; - -function instantSearch() { - if (strokeTimeout) { - clearTimeout(strokeTimeout); - } - strokeTimeout = setTimeout(doSearch, 150); -} - -function doSearch() { - value = document.getElementById("search").value; - - if (value === "") { - strokeTimeout = null; - document.getElementById("search-results").innerHTML = ""; - return; - } - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() { - if (xhr.readyState == XMLHttpRequest.DONE) { - if (xhr.status === 404 || xhr.status === 400 || typeof xhr.response === 'undefined' || xhr.response === '404 not found') { - document.getElementById("search-results").innerHTML = ''; - return - } - if (value === "") { - document.getElementById("search-results").innerHTML = ""; - return; - } - - document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp('{ (.*?)(' + value + ')(.*?) }', 'gi'), "$1$2$3").replace(new RegExp('{ (.*?) }', 'gi'), '$1'); - } - } - xhr.open('GET', '/search/gril_instant/' + value, true); - xhr.send(null); - strokeTimeout = null; -} - -function clickSearchResult(resId) { - -} \ No newline at end of file diff --git a/assets_src/css/gril.css b/assets_src/css/gril.css new file mode 100644 index 0000000..b82e2c7 --- /dev/null +++ b/assets_src/css/gril.css @@ -0,0 +1,31 @@ +#gril-title { + margin-bottom: 0rem; +} + +#gril-alias { + margin-top: 0rem; + margin-bottom: 1rem; +} + +.gril-tag { + transition: background-color .2s, color .2s; +} + +.gril-tag:hover { + background-color: #BA68C8; + color: #FFF; +} + +h1 > small { + padding-left: 8px; + font-size: 50%; +} + +.card-title.big { + font-size: 36px !important; +} + +.card-content.center-big { + padding-top: 9px; + padding-bottom: 9px; +} diff --git a/assets_src/css/list.css b/assets_src/css/list.css new file mode 100644 index 0000000..7e6dde9 --- /dev/null +++ b/assets_src/css/list.css @@ -0,0 +1,27 @@ +.jap-name { + color: rgb(166, 166, 166); +} + +.list-entry { + height: 80px; + padding: 8px; +} + +.list-img { + width: 64px; + height: 64px; +} + +.list-controls { + position: relative; + top: 8px; + left: -15px; +} + +.gril-img { + background-repeat: no-repeat; + background-position: center center; + background-size: cover; + width: 64px; + height: 64px; +} \ No newline at end of file diff --git a/assets_src/css/search.css b/assets_src/css/search.css new file mode 100644 index 0000000..124a378 --- /dev/null +++ b/assets_src/css/search.css @@ -0,0 +1,20 @@ +.collection .collection-item.avatar { + min-height: 64px !important; +} + +.collection-item.avatar > .circle { + top: 12px; +} + +.search-results { + top: -50px; + z-index: 2; +} + +.collection > .collection-item { + transition: background-color .35s; +} + +.collection > .collection-item:hover { + background-color: #e1bee7; +} \ No newline at end of file diff --git a/assets_src/js/list.js b/assets_src/js/list.js new file mode 100644 index 0000000..25ff80d --- /dev/null +++ b/assets_src/js/list.js @@ -0,0 +1,17 @@ +function clickSearchResult(resId) { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState == XMLHttpRequest.DONE) { + if (xhr.status !== 200) { + alert(xhr.status + ": " + xhr.response); + return; + } + + data = xhr.responseText; + document.getElementById("gril-list").innerHTML += data; + } + } + xhr.open('POST', window.location, true); + xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xhr.send('id=' + resId); +} \ No newline at end of file diff --git a/assets_src/js/search.js b/assets_src/js/search.js new file mode 100644 index 0000000..0cb33df --- /dev/null +++ b/assets_src/js/search.js @@ -0,0 +1,40 @@ +var strokeTimeout = null; + +function instantSearch() { + if (strokeTimeout) { + clearTimeout(strokeTimeout); + } + strokeTimeout = setTimeout(doSearch, 150); +} + +function doSearch() { + value = document.getElementById("search").value; + + if (value === "") { + strokeTimeout = null; + document.getElementById("search-results").innerHTML = ""; + return; + } + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState == XMLHttpRequest.DONE) { + if (xhr.status === 404 || xhr.status === 400 || typeof xhr.response === 'undefined' || xhr.response === '404 not found') { + document.getElementById("search-results").innerHTML = ''; + return + } + if (value === "") { + document.getElementById("search-results").innerHTML = ""; + return; + } + + document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp('{ (.*?)(' + value + ')(.*?) }', 'gi'), "$1$2$3").replace(new RegExp('{ (.*?) }', 'gi'), '$1'); + } + } + xhr.open('GET', '/search/gril_instant/' + value, true); + xhr.send(null); + strokeTimeout = null; +} + +function clickSearchResult(resId) { + +} \ No newline at end of file -- cgit v0.10.1