Skip to content

Commit

Permalink
Fix autotimer close #581 and #589
Browse files Browse the repository at this point in the history
  • Loading branch information
jbleyel committed May 8, 2017
1 parent c1ea05b commit e6e6f5e
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 36 deletions.
2 changes: 1 addition & 1 deletion plugin/controllers/views/ajax/at.tmpl
Expand Up @@ -298,7 +298,7 @@ input#to,input#from,.text.number {width:60px;}
<div>

<script type="text/javascript" src="/js/chosen.jquery.min.js"></script>
<script type="text/javascript" src="/js/at-2.3.min.js"></script>
<script type="text/javascript" src="/js/at-2.4.min.js"></script>
<script type="text/javascript">
#raw
$(function() { InitPage();});
Expand Down
2 changes: 1 addition & 1 deletion plugin/controllers/views/ajax/epgpop.tmpl
Expand Up @@ -32,7 +32,7 @@
#end if
<link type="text/css" href="../css/style.min.css" rel="stylesheet"/>
<link type="text/css" href="../web/css" rel="stylesheet"/>
<script type="text/javascript" src="../js/openwebif-1.2.2.min.js"></script>
<script type="text/javascript" src="../js/openwebif-1.2.3.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-timepicker-addon.min.js"></script>
<script type="text/javascript">initJsTranslation($dumps($tstrings))</script>
<style>
Expand Down
2 changes: 1 addition & 1 deletion plugin/controllers/views/main.tmpl
Expand Up @@ -19,7 +19,7 @@
#end if
<link type="text/css" href="css/style.min.css" rel="stylesheet"/>
<link type="text/css" href="web/css" rel="stylesheet"/>
<script type="text/javascript" src="js/openwebif-1.2.2.min.js"></script>
<script type="text/javascript" src="js/openwebif-1.2.3.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.min.js"></script>
<script type="text/javascript">initJsTranslation($dumps($tstrings))</script>
<title>Open Webif</title>
Expand Down
12 changes: 0 additions & 12 deletions plugin/public/js/at-2.3.min.js

This file was deleted.

12 changes: 12 additions & 0 deletions plugin/public/js/at-2.4.min.js

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions plugin/public/js/openwebif-1.2.2.min.js

This file was deleted.

11 changes: 11 additions & 0 deletions plugin/public/js/openwebif-1.2.3.min.js

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions sourcefiles/js/at.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions sourcefiles/js/openwebif.js
@@ -1,8 +1,8 @@
//******************************************************************************
//* openwebif.js: openwebif base module
//* Version 1.2.2
//* Version 1.2.3
//******************************************************************************
//* Copyright (C) 2011-2016 E2OpenPlugins
//* Copyright (C) 2011-2017 E2OpenPlugins
//*
//* V 1.0 - Initial Version
//* V 1.1 - add movie move and rename
Expand All @@ -17,6 +17,7 @@
//* V 1.1.1 - epg fixes / change version numbering to match OWIF versioning
//* V 1.2.1 - fix multiepg
//* V 1.2.2 - improve epgsearch
//* V 1.2.3 - fix add at from multiepg
//*
//* Authors: skaman <sandro # skanetwork.com>
//* meo
Expand Down Expand Up @@ -566,9 +567,14 @@ function addEditTimerEvent(sRef, eventId) {
});
}

function htmlEscape(str) {
return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}

function addAutoTimerEvent(sRef, sname, title ,begin, end) {
at2add = {
"name" : title,

at2add = {
"name" : htmlEscape(title),
"from" : begin,
"to" : end,
"sref" : sRef,
Expand Down

15 comments on commit e6e6f5e

@ims21
Copy link
Contributor

@ims21 ims21 commented on e6e6f5e May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems, from this patche is not working grab, imho ... could you confirm it, pls ?

Control with RC is grabed once, but this is all. Refresh button works not too.

@ims21
Copy link
Contributor

@ims21 ims21 commented on e6e6f5e May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems, problem is in openwebif-1.2.3.min.js
Replaced with renamed old then works

@jbleyel
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found the root cause ->

1b697fc

Please ask Mike Looijmans.

@ims21
Copy link
Contributor

@ims21 ims21 commented on e6e6f5e May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, why are both changed .js (2.4, 1.2.3) in this "readable" format ?

@jbleyel
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faster Loading .. Lower Size. 53KB -> 36KB

@ims21
Copy link
Contributor

@ims21 ims21 commented on e6e6f5e May 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm ... very easy comparing changes in then ...

@Schimmelreiter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm, has grab been fixed now or not yet?

@WanWizard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbleyel I have debugged this issue. It is NOT caused by the change made by MiLo. JS debugging shows that both the auto-refresh and the refresh button no longer issue a GET request for a new image, so it is definitely a client-side issue.

@WanWizard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a solution, commit is on the way.

@WanWizard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbleyel Fix doesn't work with browsers that utilize a separate image cache, like Firefox. When it sees the src isn't changed, it doesn't even bother to check the HTTP cache, and therefore HTTP headers to control caching is useless.

Since we don't have the original js source, but only the minified version, could you revert the change, and put the timestamp back in the URL for the refresh of the grab? But instead of using a GET variable, use the timestamp as an anchor (so "/grab#20170512180712" instead of something like "/grab?ts=20170512180712")?

The image cache seems to be indexed on the full URL, so this will invalidate the image in the image cache, while not interfering with the HTTP cache, for which the anchor value is ignored.

@jbleyel
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it so. Back to old school. Should i also revert grab.py?

@athoik
Copy link
Contributor

@athoik athoik commented on e6e6f5e May 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I send an PR #599 , with anchor just like @WanWizard suggested.

@jbleyel
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @athoik : could you please fix the mobile/screenshot.tmpl too. Please test it before pull.
I will make the openwebif.min.js.

@WanWizard
Copy link
Contributor

@WanWizard WanWizard commented on e6e6f5e May 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, do NOT revert.

The old code used a GET variable for the timestamp, which, as MiLo wrote, polutes the browser cache with all the one-time images. Instead of using a GET variable, use an anchor.

So not:
http://192.168.1.2/grab?format=jpg&mode=all&ts=20170512205510
but
http://192.168.1.2/grab?format=jpg&mode=all#20170512205510

grab.py is 100% ok.

@athoik thanks, exactly as I intended. ;-)

@athoik
Copy link
Contributor

@athoik athoik commented on e6e6f5e May 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second part for mobiles is ready too: #600

Please sign in to comment.