This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new f20bbe5 retrieve body text
f20bbe5 is described below
commit f20bbe5ecf91920acf9b6213f8ff094dfb8167e8
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Mon Aug 1 22:35:04 2016 -0400
retrieve body text
---
www/board/agenda/views/models/pagecache.js.rb | 41 ++++++++++++++-------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/www/board/agenda/views/models/pagecache.js.rb b/www/board/agenda/views/models/pagecache.js.rb
index c94afcb..ad4f98d 100644
--- a/www/board/agenda/views/models/pagecache.js.rb
+++ b/www/board/agenda/views/models/pagecache.js.rb
@@ -54,28 +54,31 @@ class PageCache
cache.put(request, response.clone())
end
- urls = []
+ # update browser cache with latest scripts and stylesheets.
+ response.text().then do |text|
+ urls = []
- # search body text for scripts
- script = Regexp.new(/<script.*?>/, 'g')
- matches = text.match(script)
- matches.each do |match|
- src = match.match(/src="(.*?)"/)
- urls << URL.new(src[1], base) if src
- end
+ # search body text for scripts
+ script = Regexp.new(/<script.*?>/, 'g')
+ matches = text.match(script)
+ matches.each do |match|
+ src = match.match(/src="(.*?)"/)
+ urls << URL.new(src[1], base) if src
+ end
- # search body text for links to stylesheets
- links = Regexp.new(/<link.*?>/, 'g')
- matches = text.match(links)
- matches.each do |match|
- href = match.match(/href="(.*?)"/)
- urls << URL.new(href[1], base) if href
- end
+ # search body text for links to stylesheets
+ links = Regexp.new(/<link.*?>/, 'g')
+ matches = text.match(links)
+ matches.each do |match|
+ href = match.match(/href="(.*?)"/)
+ urls << URL.new(href[1], base) if href
+ end
- # update browser cache with latest scripts and stylesheets. Note: no
- # network requests will be made if these pages are up to date
- urls.each do |url|
- fetch(Request.new(url, credentials: 'include'))
+ # Fetch each URL. Note: no network requests will be made if these
+ # pages are up to date
+ urls.each do |url|
+ fetch(Request.new(url, credentials: 'include'))
+ end
end
end
end
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].
|