Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
WEBUI: compress and optimize the default js/css files
- create Makefile.webui to kept all in one place - fix various .js errors - don't compress .jpg and .gif files - use rjsmin-1.0.10 as a JS/CSS compressor
- Loading branch information
Showing
16 changed files
with
841 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,221 @@ | ||
| # | ||
| # Tvheadend WEBUI interface | ||
| # Copyright (C) 2015 Jaroslav Kysela | ||
| # | ||
| # This program is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation, either version 3 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| # | ||
|
|
||
| # | ||
| # Configuration | ||
| # | ||
|
|
||
| IAM=$(lastword $(MAKEFILE_LIST)) | ||
| WEBDIR ?= src/webui | ||
| ROOTPATH = static | ||
|
|
||
| ifneq ($(WEBUI),) | ||
|
|
||
| TOPDIR=$(dir $(IAM)) | ||
| include $(TOPDIR)/.config.mk | ||
| EXTJSPATH = $(ROOTPATH)/extjs | ||
| CSS_PY = support/css.py | ||
| RUN_JS = vendor/rjsmin-1.0.10/rjsmin.py | ||
| RUN_CSS = vendor/rjsmin-1.0.10/rjsmin.py | ||
| GZIP = gzip -n | ||
|
|
||
| ifeq ($(WEBUI),std) | ||
| DEBUG = | ||
| else | ||
| DEBUG = -debug | ||
| endif | ||
|
|
||
| JAVASCRIPT = | ||
| JAVASCRIPT2 = | ||
| JAVASCRIPT_TV = | ||
| CSS = | ||
| CSS_TV = | ||
|
|
||
| # | ||
| # base extjs files | ||
| # | ||
|
|
||
| JAVASCRIPT += $(EXTJSPATH)/adapter/ext/ext-base$(DEBUG).js | ||
| JAVASCRIPT += $(EXTJSPATH)/ext-all$(DEBUG).js | ||
|
|
||
| # | ||
| # CSS | ||
| # | ||
|
|
||
| CSS += $(EXTJSPATH)/resources/css/ext-all-notheme.css | ||
| CSS += $(EXTJSPATH)/resources/css/xtheme-blue.css | ||
| CSS += $(ROOTPATH)/livegrid/resources/css/ext-ux-livegrid.css | ||
| CSS += $(EXTJSPATH)/examples/ux/gridfilters/css/GridFilters.css | ||
| CSS += $(EXTJSPATH)/examples/ux/gridfilters/css/RangeMenu.css | ||
| CSS += static/xcheckbox/xcheckbox.css | ||
| CSS += static/app/ext.css | ||
|
|
||
| # | ||
| # extjs extensions | ||
| # | ||
|
|
||
| JAVASCRIPT += $(ROOTPATH)/app/extensions.js | ||
| JAVASCRIPT += $(ROOTPATH)/livegrid/livegrid-all.js | ||
| JAVASCRIPT += $(ROOTPATH)/lovcombo/lovcombo-all.js | ||
| JAVASCRIPT += $(ROOTPATH)/multiselect/multiselect.js | ||
| JAVASCRIPT += $(ROOTPATH)/multiselect/ddview.js | ||
| JAVASCRIPT += $(ROOTPATH)/xcheckbox/xcheckbox.js | ||
| JAVASCRIPT += $(ROOTPATH)/checkcolumn/CheckColumn.js | ||
| JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/GridFilters.js | ||
| JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/Filter.js | ||
| JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/BooleanFilter.js | ||
| JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/DateFilter.js | ||
| JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/ListFilter.js | ||
| JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/NumericFilter.js | ||
| JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/StringFilter.js | ||
| JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/menu/ListMenu.js | ||
| JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/menu/RangeMenu.js | ||
|
|
||
| # | ||
| # app itself | ||
| # | ||
|
|
||
| JAVASCRIPT += $(ROOTPATH)/app/namespace.js | ||
| JAVASCRIPT += $(ROOTPATH)/smoothie.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/comet.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/tableeditor.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/cteditor.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/acleditor.js | ||
|
|
||
| CACLIENT-$(CONFIG_CWC) = yes | ||
| CACLIENT-$(CONFIG_CAPMT) = yes | ||
|
|
||
| ifeq ($(CACLIENT-yes), yes) | ||
| JAVASCRIPT += $(ROOTPATH)/app/caclient.js | ||
| endif | ||
|
|
||
| JAVASCRIPT += $(ROOTPATH)/app/tvadapters.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/idnode.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/esfilter.js | ||
| ifeq ($(CONFIG_MPEGTS), yes) | ||
| JAVASCRIPT += $(ROOTPATH)/app/mpegts.js | ||
| endif | ||
| ifeq ($(CONFIG_TIMESHIFT), yes) | ||
| JAVASCRIPT += $(ROOTPATH)/app/timeshift.js | ||
| endif | ||
| JAVASCRIPT += $(ROOTPATH)/app/chconf.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/epg.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/dvr.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/epggrab.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/config.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/tvhlog.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/status.js | ||
| JAVASCRIPT += $(ROOTPATH)/tv.js | ||
| JAVASCRIPT += $(ROOTPATH)/app/servicemapper.js | ||
|
|
||
| JAVASCRIPT += $(ROOTPATH)/app/tvheadend.js | ||
|
|
||
| # | ||
| # tv | ||
| # | ||
|
|
||
| CSS_TV += $(ROOTPATH)/tv.css | ||
| JAVASCRIPT_TV += $(EXTJSPATH)/adapter/ext/ext-base$(DEBUG).js | ||
| JAVASCRIPT_TV += $(EXTJSPATH)/ext-all$(DEBUG).js | ||
| JAVASCRIPT_TV += $(ROOTPATH)/tv.js | ||
|
|
||
| # | ||
| # real source paths | ||
| # | ||
|
|
||
| JAVASCRIPT_SRC = $(foreach f,$(JAVASCRIPT),$(WEBDIR)/$(f)) | ||
| CSS_SRC = $(foreach f,$(CSS),$(WEBDIR)/$(f)) | ||
| JAVASCRIPT_TV_SRC = $(foreach f,$(JAVASCRIPT_TV),$(WEBDIR)/$(f)) | ||
| CSS_TV_SRC = $(foreach f,$(CSS_TV),$(WEBDIR)/$(f)) | ||
|
|
||
| endif # WEBUI defined | ||
|
|
||
| ifndef V | ||
| VV = @ | ||
| endif | ||
|
|
||
| define GO_JS | ||
| $(VV)cat $^ > $@.tmp | ||
| $(VV)$(RUN_JS) < $@.tmp > $@.tmp2 | ||
| @stat --printf="%-35n %7s\n" $@.tmp $@.tmp2 | ||
| @$(GZIP) -c $@.tmp2 > $@.tmp | ||
| @rm $@.tmp2 | ||
| @mv $@.tmp $@ | ||
| @stat --printf="%-35n %7s\n" $@ | ||
| endef | ||
|
|
||
| define GO_CSS | ||
| $(VV)$(CSS_PY) --in="$^" > $@.tmp | ||
| $(VV)$(RUN_CSS) < $@.tmp > $@.tmp2 | ||
| @stat --printf="%-35n %7s\n" $@.tmp $@.tmp2 | ||
| @$(GZIP) -c $@.tmp2 > $@.tmp | ||
| @rm $@.tmp2 | ||
| @mv $@.tmp $@ | ||
| @stat --printf="%-35n %7s\n" $@ | ||
| endef | ||
|
|
||
| all: | ||
| $(MAKE) -f $(IAM) WEBUI=std compile-std | ||
| $(MAKE) -f $(IAM) WEBUI=debug compile-debug | ||
|
|
||
| $(WEBDIR)/extjs-std.c: $(JAVASCRIPT_SRC) $(CSS_SRC) | ||
| $(VV)echo -e 'extjs_lcss(hq, "static/tvh.css.gz");' > $@ | ||
| $(VV)echo -e 'extjs_load(hq, "static/tvh.js.gz");' >> $@ | ||
|
|
||
| $(WEBDIR)/extjs-debug.c: $(JAVASCRIPT_SRC) $(CSS_SRC) | ||
| $(VV)echo -e '$(foreach f,$(CSS),extjs_lcss(hq, "$(f)");\r\n)' > $@ | ||
| $(VV)echo -e '$(foreach f,$(JAVASCRIPT),extjs_load(hq, "$(f)");\r\n)' >> $@ | ||
|
|
||
| $(WEBDIR)/extjs-tv-std.c: $(JAVASCRIPT_TV_SRC) $(CSS_TV_SRC) | ||
| $(VV)echo -e 'extjs_lcss(hq, "static/tvh-tv.css.gz");' > $@ | ||
| $(VV)echo -e 'extjs_load(hq, "static/tvh-tv.js.gz");' >> $@ | ||
|
|
||
| $(WEBDIR)/extjs-tv-debug.c: $(JAVASCRIPT_TV_SRC) $(CSS_TV_SRC) | ||
| $(VV)echo -e '$(foreach f,$(CSS_TV),extjs_lcss(hq, "$(f)");\r\n)' > $@ | ||
| $(VV)echo -e '$(foreach f,$(JAVASCRIPT_TV),extjs_load(hq, "$(f)");\r\n)' >> $@ | ||
|
|
||
| $(WEBDIR)/$(ROOTPATH)/tvh.js.gz: $(JAVASCRIPT_SRC) | ||
| $(call GO_JS) | ||
|
|
||
| $(WEBDIR)/$(ROOTPATH)/tvh.css.gz: $(CSS_SRC) | ||
| $(call GO_CSS) | ||
|
|
||
| $(WEBDIR)/$(ROOTPATH)/tvh-tv.js.gz: $(JAVASCRIPT_TV_SRC) | ||
| $(call GO_JS) | ||
|
|
||
| $(WEBDIR)/$(ROOTPATH)/tvh-tv.css.gz: $(CSS_TV_SRC) | ||
| $(call GO_CSS) | ||
|
|
||
| .PHONY: compile-std | ||
| compile-std: $(WEBDIR)/$(ROOTPATH)/tvh.js.gz $(WEBDIR)/$(ROOTPATH)/tvh.css.gz \ | ||
| $(WEBDIR)/$(ROOTPATH)/tvh-tv.js.gz $(WEBDIR)/$(ROOTPATH)/tvh-tv.css.gz \ | ||
| $(WEBDIR)/extjs-std.c $(WEBDIR)/extjs-tv-std.c | ||
| @echo "WEBUI std finished" | ||
|
|
||
| .PHONY: compile-debug | ||
| compile-debug: $(WEBDIR)/extjs-debug.c $(WEBDIR)/extjs-tv-debug.c | ||
| @echo "WEBUI debug finished" | ||
|
|
||
| .PHONY: | ||
| clean: | ||
| rm -f $(foreach f,tvh.js tvh.css tvh-tv.js tvh-tv.css,\ | ||
| $(WEBDIR)/$(ROOTPATH)/$(f).gz \ | ||
| $(WEBDIR)/$(ROOTPATH)/$(f).tmp \ | ||
| $(WEBDIR)/$(ROOTPATH)/$(f).tmp2) \ | ||
| $(WEBDIR)/extjs-std.c $(WEBDIR)/extjs-tv-std.c \ | ||
| $(WEBDIR)/extjs-debug.c $(WEBDIR)/extjs-tv-debug.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.