From 37ee3824e05f2277ca52256fa7778c476177f1fe Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sun, 24 Aug 2014 07:38:52 +0000 Subject: [PATCH] FHEMWEB: new CssFiles attribute (Forum #26350) fhemweb_slider: no page-reload on changes (Forum #26313) git-svn-id: https://svn.fhem.de/fhem/trunk@6447 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/01_FHEMWEB.pm | 24 +++++++++++++++++++++++- fhem/www/pgm2/fhemweb.js | 13 ++++--------- fhem/www/pgm2/fhemweb_slider.js | 5 ++--- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 943d4063a..16e35542e 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - FHEMWEB: JavaScripts and CssFiles attributes added - change: avoid updating weather information on get (59_Weather.pm) - change: removed noshutdown=0 for HTTP connections made in 57_Calendar.pm and 59_Weather.pm to address issues when FHEM is behind diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index bdc1b4291..65ad174dd 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -127,6 +127,7 @@ FHEMWEB_Initialize($) my @attrList = qw( CORS:0,1 HTTPS:1,0 + CssFiles JavaScripts SVGcache:1,0 addStateEvent @@ -642,7 +643,10 @@ FW_answerCall($) FW_pO "" if($rf); } - FW_pO ""; + my $cssTemplate = ""; + FW_pO sprintf($cssTemplate, "pgm2/style.css"); + my @cssFiles = split(" ", AttrVal($FW_wname, "CssFiles", "")); + map { FW_pO sprintf($cssTemplate, $_); } @cssFiles; ######################## # FW Extensions @@ -3076,6 +3080,15 @@ FW_widgetOverride($$) FHEM-Server, and iPad/iPhone as Web-client.
+ +
  • CssFiles
    + Space separated list of .css files to be included. The filenames + are relative to the www directory. Example: + +

  • +
  • JavaScripts
    Space separated list of JavaScript files to be included. The filenames @@ -3619,6 +3632,15 @@ FW_widgetOverride($$) beheben.

  • + +
  • CssFiles
    + Leerzeichen getrennte Liste von .css Dateien, die geladen werden. + Die Dateinamen sind relativ zum www Verzeichnis anzugeben. Beispiel: + +

  • +
  • JavaScripts
    Leerzeichen getrennte Liste von JavaScript Dateien, die geladen werden. diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js index e52e3e59a..ec301baa3 100644 --- a/fhem/www/pgm2/fhemweb.js +++ b/fhem/www/pgm2/fhemweb.js @@ -17,11 +17,9 @@ log(txt) function addcsrf(arg) { -var oarg=arg; var csrf = document.body.getAttribute('fwcsrf'); if(csrf && arg.indexOf('fwcsrf') < 0) arg += '&fwcsrf='+csrf; -log(oarg+" -> "+arg); return arg; } @@ -88,9 +86,8 @@ FW_doUpdate() if(el.nodeName.toLowerCase() == "select") { // dropdown: set the selected index to the current value for(var j=0;j