pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/fgallery: keep overview js and css in view subdir



Module Name:	pkgsrc-wip
Committed By:	ast <ast%NetBSD.org@localhost>
Pushed By:	ast
Date:		Sun Oct 30 09:19:43 2016 +0100
Changeset:	b429000daaf364cf4fe7bb1479733cce4d461ec3

Modified Files:
	fgallery/Makefile
	fgallery/PLIST
	fgallery/distinfo
	fgallery/patches/patch-fgallery
	fgallery/patches/patch-view_index.html
	fgallery/patches/patch-view_index.js
Added Files:
	fgallery/files/overview.css
	fgallery/files/overview.html
	fgallery/files/overview.js
	fgallery/files/overview.png

Log Message:
wip/fgallery: keep overview js and css in view subdir

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=b429000daaf364cf4fe7bb1479733cce4d461ec3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 fgallery/Makefile                      |  12 ++++-
 fgallery/PLIST                         |   4 ++
 fgallery/distinfo                      |   6 +--
 fgallery/files/overview.css            |  54 +++++++++++++++++++++
 fgallery/files/overview.html           |  16 +++++++
 fgallery/files/overview.js             |  46 ++++++++++++++++++
 fgallery/files/overview.png            | Bin 0 -> 196 bytes
 fgallery/patches/patch-fgallery        |  12 +++--
 fgallery/patches/patch-view_index.html |   7 ++-
 fgallery/patches/patch-view_index.js   |  83 +++++++++++++++++++++++----------
 10 files changed, 206 insertions(+), 34 deletions(-)

diffs:
diff --git a/fgallery/Makefile b/fgallery/Makefile
index 6a6a84d..69649fe 100644
--- a/fgallery/Makefile
+++ b/fgallery/Makefile
@@ -64,8 +64,18 @@ FG_VIEWFILES=   back.png \
                 noise.png \
                 throbber.gif
 
+OV_FILES=       overview.css \
+                overview.html \
+                overview.js \
+                overview.png
+
 INSTALLATION_DIRS= bin ${FG_DOCSDIR} ${FG_SHAREDIR}
 
+pre-patch:
+.for file in ${OV_FILES}
+	${CP} ${FILESDIR}/${file} ${WRKSRC}/view
+.endfor
+
 do-install:
 	${INSTALL_SCRIPT} ${FG_SRCDIR}/${PKGBASE} ${DESTDIR}${PREFIX}/bin/${PKGBASE}
 
@@ -73,7 +83,7 @@ post-install:
 .for file in ${FG_DOCS}
 	${INSTALL_DATA} ${FG_SRCDIR}/${file} ${DESTDIR}${PREFIX}/${FG_DOCSDIR}
 .endfor
-.for file in ${FG_VIEWFILES}
+.for file in ${FG_VIEWFILES} ${OV_FILES}
 	${INSTALL_DATA} ${FG_VIEWDIR}/${file} ${DESTDIR}${PREFIX}/${FG_SHAREDIR}
 .endfor
 
diff --git a/fgallery/PLIST b/fgallery/PLIST
index 7150709..251dcb6 100644
--- a/fgallery/PLIST
+++ b/fgallery/PLIST
@@ -23,4 +23,8 @@ share/fgallery/view/mootools-idle.js
 share/fgallery/view/mootools-mooswipe.js
 share/fgallery/view/mootools-more-1.4.js
 share/fgallery/view/noise.png
+share/fgallery/view/overview.css
+share/fgallery/view/overview.html
+share/fgallery/view/overview.js
+share/fgallery/view/overview.png
 share/fgallery/view/throbber.gif
diff --git a/fgallery/distinfo b/fgallery/distinfo
index 798b390..5b75779 100644
--- a/fgallery/distinfo
+++ b/fgallery/distinfo
@@ -4,7 +4,7 @@ SHA1 (fgallery-1.8.2.zip) = a4164160f9e7d70fe1b135f11e175e8a470a94f2
 RMD160 (fgallery-1.8.2.zip) = 959854b675a813379e78d8e66022dd2f56e30561
 SHA512 (fgallery-1.8.2.zip) = 1e782b86c74b7cafbb61e46f346b2e42dab9cc3133cf8cedef827f916b5eb29316d86a52020305b56a42fa9d6555423b9d5a175dac4446a0f7f5d538beb9311f
 Size (fgallery-1.8.2.zip) = 158562 bytes
-SHA1 (patch-fgallery) = a1a0563b1103fdbcd17b35da1976889e28b1c1fe
+SHA1 (patch-fgallery) = 58d3b0eacff0c61f3236ff16bc56084719abf1b8
 SHA1 (patch-view_index.css) = e30afdc2f5706b2a44efc325b1777dd3571aa1de
-SHA1 (patch-view_index.html) = 8462f693698af25a4b0782ab010e52d35ba158da
-SHA1 (patch-view_index.js) = 85e2309701717a35ffe22dcf567090c3af67cea8
+SHA1 (patch-view_index.html) = 1e62672675b873d547eb11a1f48bf4af582869c6
+SHA1 (patch-view_index.js) = fb0a55b13d2e9db1170d576dfb28753da7608b5e
diff --git a/fgallery/files/overview.css b/fgallery/files/overview.css
new file mode 100644
index 0000000..77d55e4
--- /dev/null
+++ b/fgallery/files/overview.css
@@ -0,0 +1,54 @@
+/* General reset */
+html, body
+{
+  overflow: hidden; /* IE<9 */
+  padding: 0;
+  margin: 0;
+  border: 0;
+  height: 100.1% /* IOS>7.1 meta viewport minimal-ui to hide menu + bars */
+}
+
+body
+{
+  background-color: #eee;
+}
+
+#overview
+{
+  margin: 1em;
+}
+
+.overview-img-div
+{
+  display: inline-block;
+  margin: 0.5em;
+}
+
+.overview-img, .overview-img-div
+{
+  -webkit-border-radius: 5px;
+     -moz-border-radius: 5px;
+          border-radius: 5px;
+}
+
+.overview-img-div {
+  display: inline-block;
+  background: black;
+  padding: 0;
+  box-shadow: 5px 5px 15px #888;
+}
+
+.overview-img-div img {
+  display: block;
+
+  -webkit-transition: all 0.05s linear;
+     -moz-transition: all 0.05s linear;
+      -ms-transition: all 0.05s linear;
+       -o-transition: all 0.05s linear;
+          transition: all 0.05s linear;
+}
+
+.overview-img-div:hover img {
+  opacity: 0.7;
+}
+
diff --git a/fgallery/files/overview.html b/fgallery/files/overview.html
new file mode 100755
index 0000000..8360df7
--- /dev/null
+++ b/fgallery/files/overview.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui" />
+    <script src="mootools-core-1.4.js" type="text/javascript"></script>
+    <script src="overview.js" type="text/javascript"></script>
+    <link href="overview.css" rel="stylesheet" type="text/css" />
+  </head>
+  <body>
+    <noscript>
+      <h2>Please enable JavaScript</h2>
+    </noscript>
+    <div id="overview"></div>
+  </body>
+</html>
diff --git a/fgallery/files/overview.js b/fgallery/files/overview.js
new file mode 100644
index 0000000..ac55ff3
--- /dev/null
+++ b/fgallery/files/overview.js
@@ -0,0 +1,46 @@
+var datafile = '../data.json';
+
+function initOverview(data)
+{
+  emain = $('overview');
+  data.data.each(function(x, i) {
+    emain.grab(new Element('div', {
+      'class': 'overview-img-div'
+    }).grab(new Element('a', {
+      'href': '../index.html#' + i
+    }).grab(new Element('img', {
+      'class': 'overview-img',
+      'src': '../' + x.thumb[0]
+    }))))
+  });
+};
+
+function initFailure()
+{
+  emain = $('overview');
+  emain.set('html', "<h2>Cannot load gallery data :'(</h2>");
+  emain.setStyles(
+  {
+    'background': 'inherit',
+    'display': 'block'
+  });
+}
+
+window.addEvent("domready", function() {
+  new Request.JSON(
+  {
+    url: datafile,
+    onRequest: function()
+    {
+      if(this.xhr.overrideMimeType)
+        this.xhr.overrideMimeType('application/json');
+    },
+    isSuccess: function()
+    {
+      return (!this.status || (this.status >= 200 && this.status < 300));
+    },
+    onSuccess: initOverview,
+    onFailure: initFailure
+  }).get();
+});
+
diff --git a/fgallery/files/overview.png b/fgallery/files/overview.png
new file mode 100644
index 0000000..a1bd732
Binary files /dev/null and b/fgallery/files/overview.png differ
diff --git a/fgallery/patches/patch-fgallery b/fgallery/patches/patch-fgallery
index ffde831..a6f1b08 100644
--- a/fgallery/patches/patch-fgallery
+++ b/fgallery/patches/patch-fgallery
@@ -125,11 +125,11 @@ Pretty print json for easier customization
 -}
 -if(system("jpegoptim -V >/dev/null 2>&1")) {
 -  $jpegoptim = 0;
-+  cmd_exists('zip') || fatal('Missing 7z or zip command');
- }
+-}
 -if(system("pngcrush -h >/dev/null 2>&1")) {
 -  $pngoptim = 0;
--}
++  cmd_exists('zip') || fatal('Missing 7z or zip command');
+ }
 -if($facedet && system("facedetect -h >/dev/null 2>&1")) {
 -  fatal("cannot run \"facedetect\" (see https://www.thregr.org/~wavexx/software/facedetect/)");
 -}
@@ -181,7 +181,7 @@ Pretty print json for easier customization
    }
  
    # sanitize file name
-@@ -851,7 +841,9 @@ my $fd;
+@@ -851,7 +841,11 @@ my $fd;
  unless(open($fd, ">:raw", "$out/data.json")) {
    fatal("cannot write data file: $!");
  }
@@ -189,6 +189,8 @@ Pretty print json for easier customization
 +print($fd JSON::PP->new->ascii->pretty->canonical->allow_blessed->encode(\%json));
  close($fd);
  
-+chdir($out) && symlink(catfile('view', 'index.html'), 'index.html');
++for ('index.html', 'overview.html') {
++    chdir($out) && symlink(catfile('view', $_), $_);
++}
 +
  print("completed\n");
diff --git a/fgallery/patches/patch-view_index.html b/fgallery/patches/patch-view_index.html
index b7f5ed9..341a0b0 100644
--- a/fgallery/patches/patch-view_index.html
+++ b/fgallery/patches/patch-view_index.html
@@ -5,7 +5,7 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
 
 --- view/index.html.orig	2016-01-06 19:45:03.000000000 +0000
 +++ view/index.html
-@@ -2,13 +2,13 @@
+@@ -2,17 +2,17 @@
  <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -26,3 +26,8 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
    </head>
    <body>
      <noscript>
+-      <h2>Frak! JavaScript required :'(</h2>
++      <h2>Please enable JavaScript</h2>
+     </noscript>
+     <div id="gallery"></div>
+   </body>
diff --git a/fgallery/patches/patch-view_index.js b/fgallery/patches/patch-view_index.js
index e9bf6eb..ff5ad22 100644
--- a/fgallery/patches/patch-view_index.js
+++ b/fgallery/patches/patch-view_index.js
@@ -58,18 +58,44 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
  
    if(imgrt > (contSize.x / contSize.y))
    {
-@@ -425,8 +424,31 @@ function toggleCap()
- 
+@@ -390,11 +389,9 @@ function showCap(nodelay)
+   if(capst == 'never') return;
+   captm = resetTimeout(captm);
+   ecap.get('tween').cancel();
+-
+   if(nodelay) ecap.fade('show');
+   else ecap.tween('opacity', 1);
+   ecap.setStyle('display', 'block');
+-
+   if(capst != 'always')
+   {
+     // calculate a decent reading time
+@@ -408,7 +405,6 @@ function showCap(nodelay)
+ function toggleCap()
+ {
+   if(!imgs.captions) return;
+-
+   // switch mode
+   if(capst == 'normal')
+     capst = 'never';
+@@ -416,53 +412,76 @@ function toggleCap()
+     capst = 'always';
+   else
+     capst = 'normal';
+-
+   // update visual state
+   if(capst == 'never')
+     hideCap(true);
+   else if(ecap.eidx == eidx)
+     showCap(true);
+-
    // update indicator
    var img = document.id('togglecap', ehdr);
 -  img.src = 'cap-' + capst + '.png';
 +  img.src = 'view/cap-' + capst + '.png';
    showHdr();
-+
-+  //resume slideshow (as click stopped it)
-+  toggleSlideshow();
-+}
-+
+ }
+ 
 +function toggleSlideshow()
 +{
 +  if(slideshow == 'on')
@@ -88,36 +114,41 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
 +    slideshow = 'on';
 +  }
 +  resize();
- }
- 
++}
++
  function setupHeader()
-@@ -435,33 +457,33 @@ function setupHeader()
+ {
+   ehdr.empty();
++  var el;
    if(imgs.index)
    {
-     var el = new Element('a', { 'title': 'Back to index', 'href': imgs.index });
+-    var el = new Element('a', { 'title': 'Back to index', 'href': imgs.index });
 -    el.set('html', '<img src=\"back.png\"/>');
++    el = new Element('a', { 'title': 'Back to index', 'href': imgs.index });
 +    el.set('html', '<img src="view/back.png"/>');
      ehdr.adopt(el);
    }
    if(imgs.data[eidx].file)
    {
      var file = imgs.data[eidx].file[0];
-     var el = new Element('a', { 'title': 'Download image', 'href': file });
+-    var el = new Element('a', { 'title': 'Download image', 'href': file });
 -    el.set('html', '<img src=\"eye.png\"/>');
++    el = new Element('a', { 'title': 'Download image', 'href': file });
 +    el.set('html', '<img src="view/eye.png"/>');
      ehdr.adopt(el);
    }
    if(imgs.download)
    {
-     var el = new Element('a', { 'title': 'Download album', 'href': imgs.download });
+-    var el = new Element('a', { 'title': 'Download album', 'href': imgs.download });
 -    el.set('html', '<img src=\"download.png\"/>');
++    el = new Element('a', { 'title': 'Download album', 'href': imgs.download });
 +    el.set('html', '<img src="view/download.png"/>');
      ehdr.adopt(el);
    }
    if(imgs.captions)
    {
 -    var el = new Element('a', { 'title': 'Toggle captions (shortcut: c)' });
-+    var el = new Element('a', { 'title': 'Toggle captions' });
++    el = new Element('a', { 'title': 'Toggle captions' });
      el.setStyle('cursor', 'pointer');
      el.addEvent('click', toggleCap);
 -    var img = new Element('img', { 'id': 'togglecap', 'src': 'cap-' + capst + '.png' });
@@ -128,10 +159,15 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
    if(imgs.data[eidx].date)
 -    ehdr.adopt(new Element('span', { 'html': '<b>Date</b>: ' + imgs.data[eidx].date }));
 +    ehdr.adopt(new Element('span', { 'title': 'EXIF timestamp', 'html': imgs.data[eidx].date }));
++  el = new Element('a', { 'title': 'Overview', 'href': 'view/overview.html' });
++  el.set('html', '<img src="view/overview.png"/>');
++  ehdr.adopt(el);
    ehdr.setStyle('display', (ehdr.children.length? 'block': 'none'));
++  ehdr.removeEvent('click', toggleSlideshow);
  }
  
-@@ -549,7 +571,8 @@ function onMainReady()
+ function onMainReady()
+@@ -549,7 +568,8 @@ function onMainReady()
  
    tthr = resetTimeout(tthr);
    idle.start();
@@ -141,7 +177,7 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
    centerThumb(d);
  
    // prefetch next image
-@@ -563,7 +586,7 @@ function onMainReady()
+@@ -563,7 +583,7 @@ function onMainReady()
  function showThrobber()
  {
    var img = new Element('img', { id: 'throbber' });
@@ -150,7 +186,7 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
    ehdr.empty();
    img.inject(ehdr);
    ehdr.setStyle('display', 'block');
-@@ -574,31 +597,19 @@ function showThrobber()
+@@ -574,31 +594,19 @@ function showThrobber()
  function hideHdr()
  {
    if(idle.started)
@@ -186,7 +222,7 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
  function flash()
  {
    eflash.setStyle('display', 'block');
-@@ -722,16 +733,6 @@ function initGallery(data)
+@@ -722,16 +730,6 @@ function initGallery(data)
    ecap = new Element('div', { id: 'caption' });
    ecap.inject(econt);
  
@@ -203,7 +239,7 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
    ehdr = new Element('div', { id: 'header' });
    ehdr.set('tween', { link: 'ignore' })
    ehdr.inject(econt);
-@@ -771,10 +772,9 @@ function initGallery(data)
+@@ -771,10 +769,9 @@ function initGallery(data)
  
    // events and navigation shortcuts
    elist.addEvent('scroll', onScroll);
@@ -215,7 +251,7 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
  
    window.addEvent('keydown', function(ev)
    {
-@@ -788,10 +788,6 @@ function initGallery(data)
+@@ -788,10 +785,6 @@ function initGallery(data)
        ev.stop();
        next();
      }
@@ -226,7 +262,7 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
    });
  
    econt.addEvent('mousewheel', function(ev)
-@@ -819,8 +815,7 @@ function initGallery(data)
+@@ -819,8 +812,7 @@ function initGallery(data)
      timeout: hidedelay,
      events: ['mousemove', 'mousedown', 'mousewheel']
    }).start();
@@ -236,7 +272,7 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
  
    // general idle callback
    idle = new IdleTimer(window, { timeout: hidedelay }).start();
-@@ -871,12 +866,12 @@ function init()
+@@ -871,12 +863,11 @@ function init()
    }).get();
  
    // preload some resources
@@ -246,8 +282,7 @@ webserver to /usr/pkg/share/fgallery/view in DocumentRoot hierarchies
 -		'cap-normal.png', 'cap-always.png', 'cap-never.png',
 -		'cut-left.png', 'cut-right.png',
 -		'cut-top.png', 'cut-mov.png']);
-+  Asset.images(['view/throbber.gif',
-+		'view/left.png', 'view/right.png',
++  Asset.images(['view/throbber.gif', 'view/overview.png',
 +		'view/eye.png', 'view/download.png', 'view/back.png',
 +		'view/cap-normal.png', 'view/cap-always.png', 'view/cap-never.png',
 +		'view/cut-left.png', 'view/cut-right.png',


Home | Main Index | Thread Index | Old Index