From 56c86b656788aa48f88fca54c2a9dc1c86558db4 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Mon, 21 Mar 2016 06:33:02 -0400 Subject: [PATCH 1/9] Override navbar help button to open contextual help panel. Contextual help for mail written. --- doc/context/admin/security/help.html | 3 ++ doc/context/mail/combined/help.html | 10 ++++++ doc/context/mail/help.html | 10 ++++++ doc/context/mail/inbox/help.html | 10 ++++++ doc/context/mail/new/help.html | 10 ++++++ doc/context/mail/outbox/help.html | 10 ++++++ include/nav.php | 11 +++++-- view/tpl/nav.tpl | 49 ++++++++++++++++++++++++++-- 8 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 doc/context/admin/security/help.html create mode 100644 doc/context/mail/combined/help.html create mode 100644 doc/context/mail/help.html create mode 100644 doc/context/mail/inbox/help.html create mode 100644 doc/context/mail/new/help.html create mode 100644 doc/context/mail/outbox/help.html diff --git a/doc/context/admin/security/help.html b/doc/context/admin/security/help.html new file mode 100644 index 000000000..e9a741a5e --- /dev/null +++ b/doc/context/admin/security/help.html @@ -0,0 +1,3 @@ +

Security Settings

+

This page contains various administrator settings related to security.

+

To save any changes you make to these settings, you must press the Submit button.

\ No newline at end of file diff --git a/doc/context/mail/combined/help.html b/doc/context/mail/combined/help.html new file mode 100644 index 000000000..a2361a135 --- /dev/null +++ b/doc/context/mail/combined/help.html @@ -0,0 +1,10 @@ +
+
General
+
The messages displayed in private mail are visible only to you and the single recipient.
+
Combined View
+
Complete conversations can be viewed in a continuous thread by selecting Combined View. Available conversations are displayed beneath the menu in the side panel.
+
Inbox/Outbox
+
Individual sent messages are viewed by selecting Outbox, and incoming messages are viewed using the Inbox filter.
+
New Message
+
Individual messages have delivery reports that can be viewed using the drop-down menu. Messages can also be recalled from the same menu, which can prevent the recipient from viewing the message if they have not already read it.
+
\ No newline at end of file diff --git a/doc/context/mail/help.html b/doc/context/mail/help.html new file mode 100644 index 000000000..a2361a135 --- /dev/null +++ b/doc/context/mail/help.html @@ -0,0 +1,10 @@ +
+
General
+
The messages displayed in private mail are visible only to you and the single recipient.
+
Combined View
+
Complete conversations can be viewed in a continuous thread by selecting Combined View. Available conversations are displayed beneath the menu in the side panel.
+
Inbox/Outbox
+
Individual sent messages are viewed by selecting Outbox, and incoming messages are viewed using the Inbox filter.
+
New Message
+
Individual messages have delivery reports that can be viewed using the drop-down menu. Messages can also be recalled from the same menu, which can prevent the recipient from viewing the message if they have not already read it.
+
\ No newline at end of file diff --git a/doc/context/mail/inbox/help.html b/doc/context/mail/inbox/help.html new file mode 100644 index 000000000..a2361a135 --- /dev/null +++ b/doc/context/mail/inbox/help.html @@ -0,0 +1,10 @@ +
+
General
+
The messages displayed in private mail are visible only to you and the single recipient.
+
Combined View
+
Complete conversations can be viewed in a continuous thread by selecting Combined View. Available conversations are displayed beneath the menu in the side panel.
+
Inbox/Outbox
+
Individual sent messages are viewed by selecting Outbox, and incoming messages are viewed using the Inbox filter.
+
New Message
+
Individual messages have delivery reports that can be viewed using the drop-down menu. Messages can also be recalled from the same menu, which can prevent the recipient from viewing the message if they have not already read it.
+
\ No newline at end of file diff --git a/doc/context/mail/new/help.html b/doc/context/mail/new/help.html new file mode 100644 index 000000000..a2361a135 --- /dev/null +++ b/doc/context/mail/new/help.html @@ -0,0 +1,10 @@ +
+
General
+
The messages displayed in private mail are visible only to you and the single recipient.
+
Combined View
+
Complete conversations can be viewed in a continuous thread by selecting Combined View. Available conversations are displayed beneath the menu in the side panel.
+
Inbox/Outbox
+
Individual sent messages are viewed by selecting Outbox, and incoming messages are viewed using the Inbox filter.
+
New Message
+
Individual messages have delivery reports that can be viewed using the drop-down menu. Messages can also be recalled from the same menu, which can prevent the recipient from viewing the message if they have not already read it.
+
\ No newline at end of file diff --git a/doc/context/mail/outbox/help.html b/doc/context/mail/outbox/help.html new file mode 100644 index 000000000..a2361a135 --- /dev/null +++ b/doc/context/mail/outbox/help.html @@ -0,0 +1,10 @@ +
+
General
+
The messages displayed in private mail are visible only to you and the single recipient.
+
Combined View
+
Complete conversations can be viewed in a continuous thread by selecting Combined View. Available conversations are displayed beneath the menu in the side panel.
+
Inbox/Outbox
+
Individual sent messages are viewed by selecting Outbox, and incoming messages are viewed using the Inbox filter.
+
New Message
+
Individual messages have delivery reports that can be viewed using the drop-down menu. Messages can also be recalled from the same menu, which can prevent the recipient from viewing the message if they have not already read it.
+
\ No newline at end of file diff --git a/include/nav.php b/include/nav.php index 5f630745c..c7483deef 100644 --- a/include/nav.php +++ b/include/nav.php @@ -151,9 +151,14 @@ EOT; $help_url = z_root() . '/help?f=&cmd=' . $a->cmd; - if(! get_config('system','hide_help')) - $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'),'help_nav_btn'); - + if(! get_config('system','hide_help')) { + require_once('mod/help.php'); + $context_help = load_doc_file('doc/context/' . $a->cmd . '/help.html'); + if (! $context_help) { + $context_help = ''; + } + $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'),'help_nav_btn',$context_help); + } if(! UNO) $nav['apps'] = array('apps', t('Apps'), "", t('Applications, utilities, links, games'),'apps_nav_btn'); diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index 3d6809c22..dc5dd27f3 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -1,4 +1,44 @@ -
+ + + +
From 61bef7d4b083c9c794469137798176b62c2f21cb Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Wed, 23 Mar 2016 21:16:21 -0400 Subject: [PATCH 2/9] Network page help with auto-scroll and element highlighting --- doc/context/network/help.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 doc/context/network/help.html diff --git a/doc/context/network/help.html b/doc/context/network/help.html new file mode 100644 index 000000000..9d9031af8 --- /dev/null +++ b/doc/context/network/help.html @@ -0,0 +1,26 @@ + +
+
General
+
The network page displays a stream of posts and conversations, typically ordered by the most recently updated. This page is highly customizable.
+
Create a Post
+
At the top of the page there is a text box that says "Share". Clicking this box opens a new post editor. The post editor is customizable, but the basic editor provides fields for a post body and an optional post Title. Buttons below the text area to the left provide shortcuts to text formatting and inserting links, images, and other data into the post. The buttons to the right provide a post preview, the post permissions setting, and a Submit button to send the post.
+
Privacy Groups
+
The privacy groups you have created are displayed in the side panel. Selecting them filters posts to those created by channels in the chosen group.
+
Post Permissions
+
+
\ No newline at end of file From 661b0084f3d819532c4c97c840a189d7e0c7a93d Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sat, 26 Mar 2016 14:17:53 -0400 Subject: [PATCH 3/9] Added help for post permissions --- doc/context/network/help.html | 4 ++-- view/tpl/nav.tpl | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/context/network/help.html b/doc/context/network/help.html index 9d9031af8..956af7380 100644 --- a/doc/context/network/help.html +++ b/doc/context/network/help.html @@ -21,6 +21,6 @@
At the top of the page there is a text box that says "Share". Clicking this box opens a new post editor. The post editor is customizable, but the basic editor provides fields for a post body and an optional post Title. Buttons below the text area to the left provide shortcuts to text formatting and inserting links, images, and other data into the post. The buttons to the right provide a post preview, the post permissions setting, and a Submit button to send the post.
Privacy Groups
The privacy groups you have created are displayed in the side panel. Selecting them filters posts to those created by channels in the chosen group.
-
Post Permissions
-
+
Post Permissions
+
The access control list (ACL) is what you use to set who can see your new post. Pressing the ACL button beside the Submit button will display a dialog in which you can select what channels and/or privacy groups can see the post. You can also select who is explicitly denied access. For example, say you are planning a surprise party for a friend. You can send an invitation post to everyone in your Friends group except the friend you are surprising. In this case you "show" the Friends group but "don't show" that one person.
\ No newline at end of file diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index dc5dd27f3..886f73947 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -19,11 +19,12 @@ top: 50px; left: -80%; width: 80%; + height: 60%; padding: 20px; transition: left 300ms cubic-bezier(0.17, 0.04, 0.03, 0.94); - overflow: hidden; box-sizing: border-box; border: #CCC thin solid; + overflow: auto; } .help-content-open { From c25ef1d9a86193eb5b96484d9bfaae0bd4166653 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sat, 26 Mar 2016 14:31:41 -0400 Subject: [PATCH 4/9] Search docs/context/ hierarchically for help.html files to reduce redundancy --- doc/context/channel/help.html | 20 ++++++++++++++++++++ doc/context/mail/combined/help.html | 10 ---------- doc/context/mail/inbox/help.html | 10 ---------- doc/context/mail/new/help.html | 10 ---------- doc/context/mail/outbox/help.html | 10 ---------- include/nav.php | 9 +++++++-- 6 files changed, 27 insertions(+), 42 deletions(-) create mode 100644 doc/context/channel/help.html delete mode 100644 doc/context/mail/combined/help.html delete mode 100644 doc/context/mail/inbox/help.html delete mode 100644 doc/context/mail/new/help.html delete mode 100644 doc/context/mail/outbox/help.html diff --git a/doc/context/channel/help.html b/doc/context/channel/help.html new file mode 100644 index 000000000..8c3d1e422 --- /dev/null +++ b/doc/context/channel/help.html @@ -0,0 +1,20 @@ + +
+
General
+
This is the home page of a channel. It is similar to someone's "wall" in a social network context.
+
\ No newline at end of file diff --git a/doc/context/mail/combined/help.html b/doc/context/mail/combined/help.html deleted file mode 100644 index a2361a135..000000000 --- a/doc/context/mail/combined/help.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
General
-
The messages displayed in private mail are visible only to you and the single recipient.
-
Combined View
-
Complete conversations can be viewed in a continuous thread by selecting Combined View. Available conversations are displayed beneath the menu in the side panel.
-
Inbox/Outbox
-
Individual sent messages are viewed by selecting Outbox, and incoming messages are viewed using the Inbox filter.
-
New Message
-
Individual messages have delivery reports that can be viewed using the drop-down menu. Messages can also be recalled from the same menu, which can prevent the recipient from viewing the message if they have not already read it.
-
\ No newline at end of file diff --git a/doc/context/mail/inbox/help.html b/doc/context/mail/inbox/help.html deleted file mode 100644 index a2361a135..000000000 --- a/doc/context/mail/inbox/help.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
General
-
The messages displayed in private mail are visible only to you and the single recipient.
-
Combined View
-
Complete conversations can be viewed in a continuous thread by selecting Combined View. Available conversations are displayed beneath the menu in the side panel.
-
Inbox/Outbox
-
Individual sent messages are viewed by selecting Outbox, and incoming messages are viewed using the Inbox filter.
-
New Message
-
Individual messages have delivery reports that can be viewed using the drop-down menu. Messages can also be recalled from the same menu, which can prevent the recipient from viewing the message if they have not already read it.
-
\ No newline at end of file diff --git a/doc/context/mail/new/help.html b/doc/context/mail/new/help.html deleted file mode 100644 index a2361a135..000000000 --- a/doc/context/mail/new/help.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
General
-
The messages displayed in private mail are visible only to you and the single recipient.
-
Combined View
-
Complete conversations can be viewed in a continuous thread by selecting Combined View. Available conversations are displayed beneath the menu in the side panel.
-
Inbox/Outbox
-
Individual sent messages are viewed by selecting Outbox, and incoming messages are viewed using the Inbox filter.
-
New Message
-
Individual messages have delivery reports that can be viewed using the drop-down menu. Messages can also be recalled from the same menu, which can prevent the recipient from viewing the message if they have not already read it.
-
\ No newline at end of file diff --git a/doc/context/mail/outbox/help.html b/doc/context/mail/outbox/help.html deleted file mode 100644 index a2361a135..000000000 --- a/doc/context/mail/outbox/help.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
General
-
The messages displayed in private mail are visible only to you and the single recipient.
-
Combined View
-
Complete conversations can be viewed in a continuous thread by selecting Combined View. Available conversations are displayed beneath the menu in the side panel.
-
Inbox/Outbox
-
Individual sent messages are viewed by selecting Outbox, and incoming messages are viewed using the Inbox filter.
-
New Message
-
Individual messages have delivery reports that can be viewed using the drop-down menu. Messages can also be recalled from the same menu, which can prevent the recipient from viewing the message if they have not already read it.
-
\ No newline at end of file diff --git a/include/nav.php b/include/nav.php index c7483deef..d449718b8 100644 --- a/include/nav.php +++ b/include/nav.php @@ -154,8 +154,13 @@ EOT; if(! get_config('system','hide_help')) { require_once('mod/help.php'); $context_help = load_doc_file('doc/context/' . $a->cmd . '/help.html'); - if (! $context_help) { - $context_help = ''; + $parentdir = dirname($a->cmd); + while (! $context_help && $parentdir !== '.') { + $context_help = load_doc_file('doc/context/' . $parentdir . '/help.html'); + $parentdir = dirname($parentdir); + } + if (! $context_help ) { + $context_help = ''; } $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'),'help_nav_btn',$context_help); } From 99d9456b3addc651a68874ddd391d25684252c4d Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sat, 26 Mar 2016 14:55:16 -0400 Subject: [PATCH 5/9] More help content for channel pages. Channel, photos, files, about. --- doc/context/channel/help.html | 6 +++++- doc/context/cloud/help.html | 22 ++++++++++++++++++++++ doc/context/photos/help.html | 22 ++++++++++++++++++++++ doc/context/profile/help.html | 22 ++++++++++++++++++++++ 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 doc/context/cloud/help.html create mode 100644 doc/context/photos/help.html create mode 100644 doc/context/profile/help.html diff --git a/doc/context/channel/help.html b/doc/context/channel/help.html index 8c3d1e422..810913ff3 100644 --- a/doc/context/channel/help.html +++ b/doc/context/channel/help.html @@ -16,5 +16,9 @@
General
-
This is the home page of a channel. It is similar to someone's "wall" in a social network context.
+
This is the home page of a channel. It is similar to someone's profile "wall" in a social network context. Posts created by the channel are displayed according to the observer's viewing permissions.
+
Create a Post
+
If you have permission to create posts on the channel page, then you will see the post editor at the top.
+
Channel Content Tabs
+
The channel content tabs are links to other content published by the channel. The About tab links to the channel profile. The Photos tab links to the channel photo galleries. The Files tab links to the general shared files published by the channel.
\ No newline at end of file diff --git a/doc/context/cloud/help.html b/doc/context/cloud/help.html new file mode 100644 index 000000000..105947517 --- /dev/null +++ b/doc/context/cloud/help.html @@ -0,0 +1,22 @@ + +
+
General
+
This page displays a channel's "cloud" files. The files visible to the observer depend on the individual file permissions set by the channel owner. If you have permission to create/upload files you will see control buttons above the file list.
+
Channel Content Tabs
+
The channel content tabs are links to other content published by the channel. The About tab links to the channel profile. The Photos tab links to the channel photo galleries. The Files tab links to the general shared files published by the channel.
+
\ No newline at end of file diff --git a/doc/context/photos/help.html b/doc/context/photos/help.html new file mode 100644 index 000000000..f41611f8d --- /dev/null +++ b/doc/context/photos/help.html @@ -0,0 +1,22 @@ + +
+
General
+
This page displays a channel's photo albums. The images visible to the observer depend on the individual image permissions.
+
Channel Content Tabs
+
The channel content tabs are links to other content published by the channel. The About tab links to the channel profile. The Photos tab links to the channel photo galleries. The Files tab links to the general shared files published by the channel.
+
\ No newline at end of file diff --git a/doc/context/profile/help.html b/doc/context/profile/help.html new file mode 100644 index 000000000..0d4abb8cb --- /dev/null +++ b/doc/context/profile/help.html @@ -0,0 +1,22 @@ + +
+
General
+
This is the profile page of a channel. It typically displays information describing the channel. If the channel represents a person in a social network, for example, then the profile might provide contact information and other personal details about the person. Channels can have multiple profiles, where the displayed profile depends on the observer.
+
Channel Content Tabs
+
The channel content tabs are links to other content published by the channel. The About tab links to the channel profile. The Photos tab links to the channel photo galleries. The Files tab links to the general shared files published by the channel.
+
\ No newline at end of file From 0012030826030af1065d59b50aca16412be96caa Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 5 Apr 2016 15:24:05 +0200 Subject: [PATCH 6/9] update upstream lib jusutifiedGallery --- .../jquery.justifiedGallery.js | 162 +++++++++++------- .../jquery.justifiedGallery.min.js | 4 +- library/justifiedGallery/justifiedGallery.css | 2 +- .../justifiedGallery/justifiedGallery.min.css | 2 +- view/php/theme_init.php | 2 +- 5 files changed, 102 insertions(+), 70 deletions(-) diff --git a/library/justifiedGallery/jquery.justifiedGallery.js b/library/justifiedGallery/jquery.justifiedGallery.js index 7c63149a3..d3259fe44 100644 --- a/library/justifiedGallery/jquery.justifiedGallery.js +++ b/library/justifiedGallery/jquery.justifiedGallery.js @@ -1,5 +1,5 @@ /*! - * Justified Gallery - v3.6.0 + * Justified Gallery - v3.6.1 * http://miromannino.github.io/Justified-Gallery/ * Copyright (c) 2015 Miro Mannino * Licensed under the MIT license. @@ -23,6 +23,7 @@ this.buildingRow = { entriesBuff : [], width : 0, + height : 0, aspectRatio : 0 }; this.lastAnalyzedIndex = -1; @@ -97,11 +98,18 @@ * @returns {String} the suffix to use */ JustifiedGallery.prototype.newSrc = function (imageSrc, imgWidth, imgHeight) { - var matchRes = imageSrc.match(this.settings.extension); - var ext = (matchRes != null) ? matchRes[0] : ''; - var newImageSrc = imageSrc.replace(this.settings.extension, ''); - newImageSrc = this.removeSuffix(newImageSrc, this.getUsedSuffix(newImageSrc)); - newImageSrc += this.getSuffix(imgWidth, imgHeight) + ext; + var newImageSrc; + + if (this.settings.thumbnailPath) { + newImageSrc = this.settings.thumbnailPath(imageSrc, imgWidth, imgHeight); + } else { + var matchRes = imageSrc.match(this.settings.extension); + var ext = (matchRes !== null) ? matchRes[0] : ''; + newImageSrc = imageSrc.replace(this.settings.extension, ''); + newImageSrc = this.removeSuffix(newImageSrc, this.getUsedSuffix(newImageSrc)); + newImageSrc += this.getSuffix(imgWidth, imgHeight) + ext; + } + return newImageSrc; }; @@ -211,10 +219,10 @@ var $imgCaption = this.captionFromEntry($entry); // Create it if it doesn't exists - if ($imgCaption == null) { + if ($imgCaption === null) { var caption = $image.attr('alt'); - if (typeof caption === 'undefined') caption = $entry.attr('title'); - if (typeof caption !== 'undefined') { // Create only we found something + if (!this.isValidCaption(caption)) caption = $entry.attr('title'); + if (this.isValidCaption(caption)) { // Create only we found something $imgCaption = $('
' + caption + '
'); $entry.append($imgCaption); $entry.data('jg.createdCaption', true); @@ -231,6 +239,16 @@ } }; + /** + * Validates the caption + * + * @param caption The caption that should be validated + * @return {boolean} Validation result + */ + JustifiedGallery.prototype.isValidCaption = function (caption) { + return (typeof caption !== 'undefined' && caption.length > 0); + }; + /** * The callback for the event 'mouseenter'. It assumes that the event currentTarget is an entry. * It shows the caption using jQuery (or using CSS if it is configured so) @@ -299,7 +317,7 @@ * Justify the building row, preparing it to * * @param isLastRow - * @returns {*} + * @returns a boolean to know if the row has been justified or not */ JustifiedGallery.prototype.prepareBuildingRow = function (isLastRow) { var i, $entry, imgAspectRatio, newImgW, newImgH, justify = true; @@ -322,7 +340,7 @@ } // With lastRow = nojustify, justify if is justificable (the images will not become too big) - if (isLastRow && !justifiable && this.settings.lastRow === 'nojustify') justify = false; + if (isLastRow && !justifiable && this.settings.lastRow !== 'justify' && this.settings.lastRow !== 'hide') justify = false; for (i = 0; i < this.buildingRow.entriesBuff.length; i++) { $entry = this.buildingRow.entriesBuff[i]; @@ -355,7 +373,8 @@ if (this.settings.fixedHeight && minHeight > this.settings.rowHeight) minHeight = this.settings.rowHeight; - return {minHeight: minHeight, justify: justify}; + this.buildingRow.height = minHeight; + return justify; }; /** @@ -374,33 +393,53 @@ */ JustifiedGallery.prototype.flushRow = function (isLastRow) { var settings = this.settings; - var $entry, minHeight, buildingRowRes, offX = this.border; + var $entry, buildingRowRes, offX = this.border, i; buildingRowRes = this.prepareBuildingRow(isLastRow); - minHeight = buildingRowRes.minHeight; - if (isLastRow && settings.lastRow === 'hide' && minHeight === -1) { + if (isLastRow && settings.lastRow === 'hide' && this.buildingRow.height === -1) { this.clearBuildingRow(); return; } - if (this.maxRowHeight.percentage) { - if (this.maxRowHeight.value * settings.rowHeight < minHeight) minHeight = this.maxRowHeight.value * settings.rowHeight; + if (this.maxRowHeight.isPercentage) { + if (this.maxRowHeight.value * settings.rowHeight < this.buildingRow.height) { + this.buildingRow.height = this.maxRowHeight.value * settings.rowHeight; + } } else { - if (this.maxRowHeight.value > 0 && this.maxRowHeight.value < minHeight) minHeight = this.maxRowHeight.value; + if (this.maxRowHeight.value > 0 && this.maxRowHeight.value < this.buildingRow.height) { + this.buildingRow.height = this.maxRowHeight.value; + } } - for (var i = 0; i < this.buildingRow.entriesBuff.length; i++) { + //Align last (unjustified) row + if (settings.lastRow === 'center' || settings.lastRow === 'right') { + var availableWidth = this.galleryWidth - 2 * this.border - (this.buildingRow.entriesBuff.length - 1) * settings.margins; + + for (i = 0; i < this.buildingRow.entriesBuff.length; i++) { + $entry = this.buildingRow.entriesBuff[i]; + availableWidth -= $entry.data('jg.jwidth'); + } + + if (settings.lastRow === 'center') + offX += availableWidth / 2; + else if (settings.lastRow === 'right') + offX += availableWidth; + } + + + for (i = 0; i < this.buildingRow.entriesBuff.length; i++) { $entry = this.buildingRow.entriesBuff[i]; - this.displayEntry($entry, offX, this.offY, $entry.data('jg.jwidth'), $entry.data('jg.jheight'), minHeight); + this.displayEntry($entry, offX, this.offY, $entry.data('jg.jwidth'), $entry.data('jg.jheight'), this.buildingRow.height); offX += $entry.data('jg.jwidth') + settings.margins; } //Gallery Height - this.$gallery.height(this.offY + minHeight + this.border + (this.isSpinnerActive() ? this.getSpinnerHeight() : 0)); + this.$gallery.height(this.offY + this.buildingRow.height + + this.border + (this.isSpinnerActive() ? this.getSpinnerHeight() : 0)); - if (!isLastRow || (minHeight <= this.settings.rowHeight && buildingRowRes.justify)) { + if (!isLastRow || (this.buildingRow.height <= settings.rowHeight && buildingRowRes)) { //Ready for a new row - this.offY += minHeight + this.settings.margins; + this.offY += this.buildingRow.height + settings.margins; this.clearBuildingRow(); this.$gallery.trigger('jg.rowflush'); } @@ -411,8 +450,8 @@ */ JustifiedGallery.prototype.checkWidth = function () { this.checkWidthIntervalId = setInterval($.proxy(function () { - var galleryWidth = parseInt(this.$gallery.width(), 10); - if (this.galleryWidth !== galleryWidth) { + var galleryWidth = parseFloat(this.$gallery.width()); + if (Math.abs(galleryWidth - this.galleryWidth) > this.settings.refreshSensitivity) { this.galleryWidth = galleryWidth; this.rewind(); @@ -426,7 +465,7 @@ * @returns {boolean} a boolean saying if the spinner is active or not */ JustifiedGallery.prototype.isSpinnerActive = function () { - return this.spinner.intervalId != null; + return this.spinner.intervalId !== null; }; /** @@ -454,7 +493,7 @@ var $spinnerPoints = spinnerContext.$el.find('span'); clearInterval(spinnerContext.intervalId); this.$gallery.append(spinnerContext.$el); - this.$gallery.height(this.offY + this.getSpinnerHeight()); + this.$gallery.height(this.offY + this.buildingRow.height + this.getSpinnerHeight()); spinnerContext.intervalId = setInterval(function () { if (spinnerContext.phase < $spinnerPoints.length) { $spinnerPoints.eq(spinnerContext.phase).fadeTo(spinnerContext.timeSlot, 1); @@ -474,20 +513,6 @@ this.clearBuildingRow(); }; - /** - * Hide the image of the buildingRow to prevent strange effects when the row will be - * re-justified again - */ - JustifiedGallery.prototype.hideBuildingRowImages = function () { - for (var i = 0; i < this.buildingRow.entriesBuff.length; i++) { - if (this.settings.cssAnimation) { - this.buildingRow.entriesBuff[i].removeClass('entry-visible'); - } else { - this.buildingRow.entriesBuff[i].stop().fadeTo(0, 0); - } - } - }; - /** * Update the entries searching it from the justified gallery HTML element * @@ -645,9 +670,9 @@ if ($entry.data('jg.createdCaption')) { // remove also the caption element (if created by jg) $entry.data('jg.createdCaption', undefined); - if ($caption != null) $caption.remove(); + if ($caption !== null) $caption.remove(); } else { - if ($caption != null) $caption.fadeTo(0, 1); + if ($caption !== null) $caption.fadeTo(0, 1); } }, this)); @@ -782,8 +807,8 @@ /* If we have the height and the width, we don't wait that the image is loaded, but we start directly * with the justification */ if (that.settings.waitThumbnailsLoad === false) { - var width = parseInt($image.attr('width'), 10); - var height = parseInt($image.attr('height'), 10); + var width = parseFloat($image.attr('width')); + var height = parseFloat($image.attr('height')); if (!isNaN(width) && !isNaN(height)) { $entry.data('jg.width', width); $entry.data('jg.height', height); @@ -798,9 +823,7 @@ imagesToLoad = true; // Spinner start - if (!that.isSpinnerActive()) { - that.startLoadingSpinnerAnimation(); - } + if (!that.isSpinnerActive()) that.startLoadingSpinnerAnimation(); that.onImageEvent(imageSrc, function (loadImg) { // image loaded $entry.data('jg.width', loadImg.width); @@ -814,8 +837,8 @@ } else { $entry.data('jg.loaded', true); - $entry.data('jg.width', $entry.width() | $entry.css('width') | 1); - $entry.data('jg.height', $entry.height() | $entry.css('height') | 1); + $entry.data('jg.width', $entry.width() | parseFloat($entry.css('width')) | 1); + $entry.data('jg.height', $entry.height() | parseFloat($entry.css('height')) | 1); } } @@ -883,15 +906,15 @@ if ($.type(this.settings.maxRowHeight) === 'string') { if (this.settings.maxRowHeight.match(/^[0-9]+%$/)) { - newMaxRowHeight.value = parseFloat(this.settings.maxRowHeight.match(/^([0-9])+%$/)[1]) / 100; - newMaxRowHeight.percentage = false; + newMaxRowHeight.value = parseFloat(this.settings.maxRowHeight.match(/^([0-9]+)%$/)[1]) / 100; + newMaxRowHeight.isPercentage = false; } else { newMaxRowHeight.value = parseFloat(this.settings.maxRowHeight); - newMaxRowHeight.percentage = true; + newMaxRowHeight.isPercentage = true; } } else if ($.type(this.settings.maxRowHeight) === 'number') { newMaxRowHeight.value = this.settings.maxRowHeight; - newMaxRowHeight.percentage = false; + newMaxRowHeight.isPercentage = false; } else { throw 'maxRowHeight must be a number or a percentage'; } @@ -900,7 +923,7 @@ if (isNaN(newMaxRowHeight.value)) throw 'invalid number for maxRowHeight'; // check values - if (newMaxRowHeight.percentage) { + if (newMaxRowHeight.isPercentage) { if (newMaxRowHeight.value < 100) newMaxRowHeight.value = 100; } else { if (newMaxRowHeight.value > 0 && newMaxRowHeight.value < this.settings.rowHeight) { @@ -922,10 +945,12 @@ this.checkOrConvertNumber(this.settings, 'margins'); this.checkOrConvertNumber(this.settings, 'border'); - if (this.settings.lastRow !== 'nojustify' && - this.settings.lastRow !== 'justify' && + if (this.settings.lastRow !== 'justify' && + this.settings.lastRow !== 'nojustify' && this.settings.lastRow !== 'left' && + this.settings.lastRow !== 'center' && + this.settings.lastRow !== 'right' && this.settings.lastRow !== 'hide') { - throw 'lastRow must be "nojustify", "justify" or "hide"'; + throw 'lastRow must be "justify", "nojustify", "left", "center", "right" or "hide"'; } this.checkOrConvertNumber(this.settings, 'justifyThreshold'); @@ -954,6 +979,7 @@ if ($.type(this.settings.fixedHeight) !== 'boolean') throw 'fixedHeight must be a boolean'; this.checkOrConvertNumber(this.settings, 'imagesAnimationDuration'); this.checkOrConvertNumber(this.settings, 'refreshTime'); + this.checkOrConvertNumber(this.settings, 'refreshSensitivity'); if ($.type(this.settings.randomize) !== 'boolean') throw 'randomize must be a boolean'; if ($.type(this.settings.selector) !== 'string') throw 'selector must be a string'; @@ -961,7 +987,7 @@ throw 'sort must be false or a comparison function'; } - if (this.settings.filter !== false && !$.isFunction(this.settings.sort) && + if (this.settings.filter !== false && !$.isFunction(this.settings.filter) && $.type(this.settings.filter) !== 'string') { throw 'filter must be false, a string or a filter function'; } @@ -1018,13 +1044,14 @@ if (typeof controller === 'undefined') { // Create controller and assign it to the object data if (typeof arg !== 'undefined' && arg !== null && $.type(arg) !== 'object') { + if (arg === 'destroy') return; // Just a call to an unexisting object throw 'The argument must be an object'; } controller = new JustifiedGallery($gallery, $.extend({}, $.fn.justifiedGallery.defaults, arg)); $gallery.data('jg.controller', controller); } else if (arg === 'norewind') { // In this case we don't rewind: we analyze only the latest images (e.g. to complete the last unfinished row - controller.hideBuildingRowImages(); + // ... left to be more readable } else if (arg === 'destroy') { controller.destroy(); return; @@ -1055,14 +1082,18 @@ 1024: '_b' // used as else case because it is the last } */ + thumbnailPath: undefined, /* If defined, sizeRangeSuffixes is not used, and this function is used to determine the + path relative to a specific thumbnail size. The function should accept respectively three arguments: + current path, width and height */ rowHeight: 120, - maxRowHeight: '200%', // negative value = no limits, number to express the value in pixels, - // '[0-9]+%' to express in percentage (e.g. 200% means that the row height - // can't exceed 2 * rowHeight) + maxRowHeight: -1, // negative value = no limits, number to express the value in pixels, + // '[0-9]+%' to express in percentage (e.g. 300% means that the row height + // can't exceed 3 * rowHeight) margins: 1, border: -1, // negative value = same as margins, 0 = disabled, any other value to set the border - lastRow: 'nojustify', // or can be 'justify' or 'hide' + lastRow: 'nojustify', // … which is the same as 'left', or can be 'justify', 'center', 'right' or 'hide' + justifyThreshold: 0.75, /* if row width / available space > 0.75 it will be always justified * (i.e. lastRow setting is not considered) */ fixedHeight: false, @@ -1078,7 +1109,8 @@ rel: null, // rewrite the rel of each analyzed links target: null, // rewrite the target of all links extension: /\.[^.\\/]+$/, // regexp to capture the extension of an image - refreshTime: 100, // time interval (in ms) to check if the page changes its width + refreshTime: 200, // time interval (in ms) to check if the page changes its width + refreshSensitivity: 0, // change in width allowed (in px) without re-building the gallery randomize: false, sort: false, /* - false: to do not sort diff --git a/library/justifiedGallery/jquery.justifiedGallery.min.js b/library/justifiedGallery/jquery.justifiedGallery.min.js index 74f333208..030636ccc 100644 --- a/library/justifiedGallery/jquery.justifiedGallery.min.js +++ b/library/justifiedGallery/jquery.justifiedGallery.min.js @@ -1,7 +1,7 @@ /*! - * Justified Gallery - v3.6.0 + * Justified Gallery - v3.6.1 * http://miromannino.github.io/Justified-Gallery/ * Copyright (c) 2015 Miro Mannino * Licensed under the MIT license. */ -!function(a){var b=function(b,c){this.settings=c,this.checkSettings(),this.imgAnalyzerTimeout=null,this.entries=null,this.buildingRow={entriesBuff:[],width:0,aspectRatio:0},this.lastAnalyzedIndex=-1,this.yield={every:2,flushed:0},this.border=c.border>=0?c.border:c.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges(),this.offY=this.border,this.spinner={phase:0,timeSlot:150,$el:a('
'),intervalId:null},this.checkWidthIntervalId=null,this.galleryWidth=b.width(),this.$gallery=b};b.prototype.getSuffix=function(a,b){var c,d;for(c=a>b?a:b,d=0;d img");return 0===b.length&&(b=a.find("> a > img")),0===b.length?null:b},b.prototype.captionFromEntry=function(a){var b=a.find("> .caption");return 0===b.length?null:b},b.prototype.displayEntry=function(b,c,d,e,f,g){b.width(e),b.height(g),b.css("top",d),b.css("left",c);var h=this.imgFromEntry(b);if(null!==h){h.css("width",e),h.css("height",f),h.css("margin-left",-e/2),h.css("margin-top",-f/2);var i=h.attr("src"),j=this.newSrc(i,e,f);h.one("error",function(){h.attr("src",h.data("jg.originalSrc"))});var k=function(){i!==j&&h.attr("src",j)};"skipped"===b.data("jg.loaded")?this.onImageEvent(i,a.proxy(function(){this.showImg(b,k),b.data("jg.loaded",!0)},this)):this.showImg(b,k)}else this.showImg(b);this.displayEntryCaption(b)},b.prototype.displayEntryCaption=function(b){var c=this.imgFromEntry(b);if(null!==c&&this.settings.captions){var d=this.captionFromEntry(b);if(null==d){var e=c.attr("alt");"undefined"==typeof e&&(e=b.attr("title")),"undefined"!=typeof e&&(d=a('
'+e+"
"),b.append(d),b.data("jg.createdCaption",!0))}null!==d&&(this.settings.cssAnimation||d.stop().fadeTo(0,this.settings.captionSettings.nonVisibleOpacity),this.addCaptionEventsHandlers(b))}else this.removeCaptionEventsHandlers(b)},b.prototype.onEntryMouseEnterForCaption=function(b){var c=this.captionFromEntry(a(b.currentTarget));this.settings.cssAnimation?c.addClass("caption-visible").removeClass("caption-hidden"):c.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.visibleOpacity)},b.prototype.onEntryMouseLeaveForCaption=function(b){var c=this.captionFromEntry(a(b.currentTarget));this.settings.cssAnimation?c.removeClass("caption-visible").removeClass("caption-hidden"):c.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.nonVisibleOpacity)},b.prototype.addCaptionEventsHandlers=function(b){var c=b.data("jg.captionMouseEvents");"undefined"==typeof c&&(c={mouseenter:a.proxy(this.onEntryMouseEnterForCaption,this),mouseleave:a.proxy(this.onEntryMouseLeaveForCaption,this)},b.on("mouseenter",void 0,void 0,c.mouseenter),b.on("mouseleave",void 0,void 0,c.mouseleave),b.data("jg.captionMouseEvents",c))},b.prototype.removeCaptionEventsHandlers=function(a){var b=a.data("jg.captionMouseEvents");"undefined"!=typeof b&&(a.off("mouseenter",void 0,b.mouseenter),a.off("mouseleave",void 0,b.mouseleave),a.removeData("jg.captionMouseEvents"))},b.prototype.prepareBuildingRow=function(a){var b,c,d,e,f,g=!0,h=0,i=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,j=i/this.buildingRow.aspectRatio,k=this.buildingRow.width/i>this.settings.justifyThreshold;if(a&&"hide"===this.settings.lastRow&&!k){for(b=0;bf)&&(h=f);return this.settings.fixedHeight&&h>this.settings.rowHeight&&(h=this.settings.rowHeight),{minHeight:h,justify:g}},b.prototype.clearBuildingRow=function(){this.buildingRow.entriesBuff=[],this.buildingRow.aspectRatio=0,this.buildingRow.width=0},b.prototype.flushRow=function(a){var b,c,d,e=this.settings,f=this.border;if(d=this.prepareBuildingRow(a),c=d.minHeight,a&&"hide"===e.lastRow&&-1===c)return void this.clearBuildingRow();this.maxRowHeight.percentage?this.maxRowHeight.value*e.rowHeight0&&this.maxRowHeight.value0;b--)c=Math.floor(Math.random()*(b+1)),d=a[b],a[b]=a[c],a[c]=d;return this.insertToGallery(a),a},b.prototype.sortArray=function(a){return a.sort(this.settings.sort),this.insertToGallery(a),a},b.prototype.resetFilters=function(b){for(var c=0;c=this.yield.every))return void this.startImgAnalyzer(b);this.buildingRow.entriesBuff.push(d),this.buildingRow.aspectRatio+=f,this.buildingRow.width+=f*this.settings.rowHeight,this.lastAnalyzedIndex=c}else if("error"!==d.data("jg.loaded"))return}this.buildingRow.entriesBuff.length>0&&this.flushRow(!0),this.isSpinnerActive()&&this.stopLoadingSpinnerAnimation(),this.stopImgAnalyzerStarter(),this.$gallery.trigger(b?"jg.resize":"jg.complete")},b.prototype.stopImgAnalyzerStarter=function(){this.yield.flushed=0,null!==this.imgAnalyzerTimeout&&clearTimeout(this.imgAnalyzerTimeout)},b.prototype.startImgAnalyzer=function(a){var b=this;this.stopImgAnalyzerStarter(),this.imgAnalyzerTimeout=setTimeout(function(){b.analyzeImages(a)},.001)},b.prototype.onImageEvent=function(b,c,d){if(c||d){var e=new Image,f=a(e);c&&f.one("load",function(){f.off("load error"),c(e)}),d&&f.one("error",function(){f.off("load error"),d(e)}),e.src=b}},b.prototype.init=function(){var b=!1,c=!1,d=this;a.each(this.entries,function(e,f){var g=a(f),h=d.imgFromEntry(g);if(g.addClass("jg-entry"),g.data("jg.loaded")!==!0&&"skipped"!==g.data("jg.loaded"))if(null!==d.settings.rel&&g.attr("rel",d.settings.rel),null!==d.settings.target&&g.attr("target",d.settings.target),null!==h){var i=d.extractImgSrcFromImage(h);if(h.attr("src",i),d.settings.waitThumbnailsLoad===!1){var j=parseInt(h.attr("width"),10),k=parseInt(h.attr("height"),10);if(!isNaN(j)&&!isNaN(k))return g.data("jg.width",j),g.data("jg.height",k),g.data("jg.loaded","skipped"),c=!0,d.startImgAnalyzer(!1),!0}g.data("jg.loaded",!1),b=!0,d.isSpinnerActive()||d.startLoadingSpinnerAnimation(),d.onImageEvent(i,function(a){g.data("jg.width",a.width),g.data("jg.height",a.height),g.data("jg.loaded",!0),d.startImgAnalyzer(!1)},function(){g.data("jg.loaded","error"),d.startImgAnalyzer(!1)})}else g.data("jg.loaded",!0),g.data("jg.width",g.width()|g.css("width")|1),g.data("jg.height",g.height()|g.css("height")|1)}),b||c||this.startImgAnalyzer(!1),this.checkWidth()},b.prototype.checkOrConvertNumber=function(b,c){if("string"===a.type(b[c])&&(b[c]=parseFloat(b[c])),"number"!==a.type(b[c]))throw c+" must be a number";if(isNaN(b[c]))throw"invalid number for "+c},b.prototype.checkSizeRangesSuffixes=function(){if("object"!==a.type(this.settings.sizeRangeSuffixes))throw"sizeRangeSuffixes must be defined and must be an object";var b=[];for(var c in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(c)&&b.push(c);for(var d={0:""},e=0;e0&&b.value1)throw"justifyThreshold must be in the interval [0,1]";if("boolean"!==a.type(this.settings.cssAnimation))throw"cssAnimation must be a boolean";if("boolean"!==a.type(this.settings.captions))throw"captions must be a boolean";if(this.checkOrConvertNumber(this.settings.captionSettings,"animationDuration"),this.checkOrConvertNumber(this.settings.captionSettings,"visibleOpacity"),this.settings.captionSettings.visibleOpacity<0||this.settings.captionSettings.visibleOpacity>1)throw"captionSettings.visibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings.captionSettings,"nonVisibleOpacity"),this.settings.captionSettings.nonVisibleOpacity<0||this.settings.captionSettings.nonVisibleOpacity>1)throw"captionSettings.nonVisibleOpacity must be in the interval [0, 1]";if("boolean"!==a.type(this.settings.fixedHeight))throw"fixedHeight must be a boolean";if(this.checkOrConvertNumber(this.settings,"imagesAnimationDuration"),this.checkOrConvertNumber(this.settings,"refreshTime"),"boolean"!==a.type(this.settings.randomize))throw"randomize must be a boolean";if("string"!==a.type(this.settings.selector))throw"selector must be a string";if(this.settings.sort!==!1&&!a.isFunction(this.settings.sort))throw"sort must be false or a comparison function";if(this.settings.filter!==!1&&!a.isFunction(this.settings.sort)&&"string"!==a.type(this.settings.filter))throw"filter must be false, a string or a filter function"},b.prototype.retrieveSuffixRanges=function(){var a=[];for(var b in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(b)&&a.push(parseInt(b,10));return a.sort(function(a,b){return a>b?1:b>a?-1:0}),a},b.prototype.updateSettings=function(b){this.settings=a.extend({},this.settings,b),this.checkSettings(),this.border=this.settings.border>=0?this.settings.border:this.settings.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges()},a.fn.justifiedGallery=function(c){return this.each(function(d,e){var f=a(e);f.addClass("justified-gallery");var g=f.data("jg.controller");if("undefined"==typeof g){if("undefined"!=typeof c&&null!==c&&"object"!==a.type(c))throw"The argument must be an object";g=new b(f,a.extend({},a.fn.justifiedGallery.defaults,c)),f.data("jg.controller",g)}else if("norewind"===c)g.hideBuildingRowImages();else{if("destroy"===c)return void g.destroy();g.updateSettings(c),g.rewind()}g.updateEntries("norewind"===c)&&g.init()})},a.fn.justifiedGallery.defaults={sizeRangeSuffixes:{},rowHeight:120,maxRowHeight:"200%",margins:1,border:-1,lastRow:"nojustify",justifyThreshold:.75,fixedHeight:!1,waitThumbnailsLoad:!0,captions:!0,cssAnimation:!1,imagesAnimationDuration:500,captionSettings:{animationDuration:500,visibleOpacity:.7,nonVisibleOpacity:0},rel:null,target:null,extension:/\.[^.\\/]+$/,refreshTime:100,randomize:!1,sort:!1,filter:!1,selector:"> a, > div:not(.spinner)"}}(jQuery); \ No newline at end of file +!function(a){var b=function(b,c){this.settings=c,this.checkSettings(),this.imgAnalyzerTimeout=null,this.entries=null,this.buildingRow={entriesBuff:[],width:0,height:0,aspectRatio:0},this.lastAnalyzedIndex=-1,this.yield={every:2,flushed:0},this.border=c.border>=0?c.border:c.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges(),this.offY=this.border,this.spinner={phase:0,timeSlot:150,$el:a('
'),intervalId:null},this.checkWidthIntervalId=null,this.galleryWidth=b.width(),this.$gallery=b};b.prototype.getSuffix=function(a,b){var c,d;for(c=a>b?a:b,d=0;d img");return 0===b.length&&(b=a.find("> a > img")),0===b.length?null:b},b.prototype.captionFromEntry=function(a){var b=a.find("> .caption");return 0===b.length?null:b},b.prototype.displayEntry=function(b,c,d,e,f,g){b.width(e),b.height(g),b.css("top",d),b.css("left",c);var h=this.imgFromEntry(b);if(null!==h){h.css("width",e),h.css("height",f),h.css("margin-left",-e/2),h.css("margin-top",-f/2);var i=h.attr("src"),j=this.newSrc(i,e,f);h.one("error",function(){h.attr("src",h.data("jg.originalSrc"))});var k=function(){i!==j&&h.attr("src",j)};"skipped"===b.data("jg.loaded")?this.onImageEvent(i,a.proxy(function(){this.showImg(b,k),b.data("jg.loaded",!0)},this)):this.showImg(b,k)}else this.showImg(b);this.displayEntryCaption(b)},b.prototype.displayEntryCaption=function(b){var c=this.imgFromEntry(b);if(null!==c&&this.settings.captions){var d=this.captionFromEntry(b);if(null===d){var e=c.attr("alt");this.isValidCaption(e)||(e=b.attr("title")),this.isValidCaption(e)&&(d=a('
'+e+"
"),b.append(d),b.data("jg.createdCaption",!0))}null!==d&&(this.settings.cssAnimation||d.stop().fadeTo(0,this.settings.captionSettings.nonVisibleOpacity),this.addCaptionEventsHandlers(b))}else this.removeCaptionEventsHandlers(b)},b.prototype.isValidCaption=function(a){return"undefined"!=typeof a&&a.length>0},b.prototype.onEntryMouseEnterForCaption=function(b){var c=this.captionFromEntry(a(b.currentTarget));this.settings.cssAnimation?c.addClass("caption-visible").removeClass("caption-hidden"):c.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.visibleOpacity)},b.prototype.onEntryMouseLeaveForCaption=function(b){var c=this.captionFromEntry(a(b.currentTarget));this.settings.cssAnimation?c.removeClass("caption-visible").removeClass("caption-hidden"):c.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.nonVisibleOpacity)},b.prototype.addCaptionEventsHandlers=function(b){var c=b.data("jg.captionMouseEvents");"undefined"==typeof c&&(c={mouseenter:a.proxy(this.onEntryMouseEnterForCaption,this),mouseleave:a.proxy(this.onEntryMouseLeaveForCaption,this)},b.on("mouseenter",void 0,void 0,c.mouseenter),b.on("mouseleave",void 0,void 0,c.mouseleave),b.data("jg.captionMouseEvents",c))},b.prototype.removeCaptionEventsHandlers=function(a){var b=a.data("jg.captionMouseEvents");"undefined"!=typeof b&&(a.off("mouseenter",void 0,b.mouseenter),a.off("mouseleave",void 0,b.mouseleave),a.removeData("jg.captionMouseEvents"))},b.prototype.prepareBuildingRow=function(a){var b,c,d,e,f,g=!0,h=0,i=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,j=i/this.buildingRow.aspectRatio,k=this.buildingRow.width/i>this.settings.justifyThreshold;if(a&&"hide"===this.settings.lastRow&&!k){for(b=0;bf)&&(h=f);return this.settings.fixedHeight&&h>this.settings.rowHeight&&(h=this.settings.rowHeight),this.buildingRow.height=h,g},b.prototype.clearBuildingRow=function(){this.buildingRow.entriesBuff=[],this.buildingRow.aspectRatio=0,this.buildingRow.width=0},b.prototype.flushRow=function(a){var b,c,d,e=this.settings,f=this.border;if(c=this.prepareBuildingRow(a),a&&"hide"===e.lastRow&&-1===this.buildingRow.height)return void this.clearBuildingRow();if(this.maxRowHeight.isPercentage?this.maxRowHeight.value*e.rowHeight0&&this.maxRowHeight.valuethis.settings.refreshSensitivity&&(this.galleryWidth=a,this.rewind(),this.startImgAnalyzer(!0))},this),this.settings.refreshTime)},b.prototype.isSpinnerActive=function(){return null!==this.spinner.intervalId},b.prototype.getSpinnerHeight=function(){return this.spinner.$el.innerHeight()},b.prototype.stopLoadingSpinnerAnimation=function(){clearInterval(this.spinner.intervalId),this.spinner.intervalId=null,this.$gallery.height(this.$gallery.height()-this.getSpinnerHeight()),this.spinner.$el.detach()},b.prototype.startLoadingSpinnerAnimation=function(){var a=this.spinner,b=a.$el.find("span");clearInterval(a.intervalId),this.$gallery.append(a.$el),this.$gallery.height(this.offY+this.buildingRow.height+this.getSpinnerHeight()),a.intervalId=setInterval(function(){a.phase0;b--)c=Math.floor(Math.random()*(b+1)),d=a[b],a[b]=a[c],a[c]=d;return this.insertToGallery(a),a},b.prototype.sortArray=function(a){return a.sort(this.settings.sort),this.insertToGallery(a),a},b.prototype.resetFilters=function(b){for(var c=0;c=this.yield.every))return void this.startImgAnalyzer(b);this.buildingRow.entriesBuff.push(d),this.buildingRow.aspectRatio+=f,this.buildingRow.width+=f*this.settings.rowHeight,this.lastAnalyzedIndex=c}else if("error"!==d.data("jg.loaded"))return}this.buildingRow.entriesBuff.length>0&&this.flushRow(!0),this.isSpinnerActive()&&this.stopLoadingSpinnerAnimation(),this.stopImgAnalyzerStarter(),this.$gallery.trigger(b?"jg.resize":"jg.complete")},b.prototype.stopImgAnalyzerStarter=function(){this.yield.flushed=0,null!==this.imgAnalyzerTimeout&&clearTimeout(this.imgAnalyzerTimeout)},b.prototype.startImgAnalyzer=function(a){var b=this;this.stopImgAnalyzerStarter(),this.imgAnalyzerTimeout=setTimeout(function(){b.analyzeImages(a)},.001)},b.prototype.onImageEvent=function(b,c,d){if(c||d){var e=new Image,f=a(e);c&&f.one("load",function(){f.off("load error"),c(e)}),d&&f.one("error",function(){f.off("load error"),d(e)}),e.src=b}},b.prototype.init=function(){var b=!1,c=!1,d=this;a.each(this.entries,function(e,f){var g=a(f),h=d.imgFromEntry(g);if(g.addClass("jg-entry"),g.data("jg.loaded")!==!0&&"skipped"!==g.data("jg.loaded"))if(null!==d.settings.rel&&g.attr("rel",d.settings.rel),null!==d.settings.target&&g.attr("target",d.settings.target),null!==h){var i=d.extractImgSrcFromImage(h);if(h.attr("src",i),d.settings.waitThumbnailsLoad===!1){var j=parseFloat(h.attr("width")),k=parseFloat(h.attr("height"));if(!isNaN(j)&&!isNaN(k))return g.data("jg.width",j),g.data("jg.height",k),g.data("jg.loaded","skipped"),c=!0,d.startImgAnalyzer(!1),!0}g.data("jg.loaded",!1),b=!0,d.isSpinnerActive()||d.startLoadingSpinnerAnimation(),d.onImageEvent(i,function(a){g.data("jg.width",a.width),g.data("jg.height",a.height),g.data("jg.loaded",!0),d.startImgAnalyzer(!1)},function(){g.data("jg.loaded","error"),d.startImgAnalyzer(!1)})}else g.data("jg.loaded",!0),g.data("jg.width",g.width()|parseFloat(g.css("width"))|1),g.data("jg.height",g.height()|parseFloat(g.css("height"))|1)}),b||c||this.startImgAnalyzer(!1),this.checkWidth()},b.prototype.checkOrConvertNumber=function(b,c){if("string"===a.type(b[c])&&(b[c]=parseFloat(b[c])),"number"!==a.type(b[c]))throw c+" must be a number";if(isNaN(b[c]))throw"invalid number for "+c},b.prototype.checkSizeRangesSuffixes=function(){if("object"!==a.type(this.settings.sizeRangeSuffixes))throw"sizeRangeSuffixes must be defined and must be an object";var b=[];for(var c in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(c)&&b.push(c);for(var d={0:""},e=0;e0&&b.value1)throw"justifyThreshold must be in the interval [0,1]";if("boolean"!==a.type(this.settings.cssAnimation))throw"cssAnimation must be a boolean";if("boolean"!==a.type(this.settings.captions))throw"captions must be a boolean";if(this.checkOrConvertNumber(this.settings.captionSettings,"animationDuration"),this.checkOrConvertNumber(this.settings.captionSettings,"visibleOpacity"),this.settings.captionSettings.visibleOpacity<0||this.settings.captionSettings.visibleOpacity>1)throw"captionSettings.visibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings.captionSettings,"nonVisibleOpacity"),this.settings.captionSettings.nonVisibleOpacity<0||this.settings.captionSettings.nonVisibleOpacity>1)throw"captionSettings.nonVisibleOpacity must be in the interval [0, 1]";if("boolean"!==a.type(this.settings.fixedHeight))throw"fixedHeight must be a boolean";if(this.checkOrConvertNumber(this.settings,"imagesAnimationDuration"),this.checkOrConvertNumber(this.settings,"refreshTime"),this.checkOrConvertNumber(this.settings,"refreshSensitivity"),"boolean"!==a.type(this.settings.randomize))throw"randomize must be a boolean";if("string"!==a.type(this.settings.selector))throw"selector must be a string";if(this.settings.sort!==!1&&!a.isFunction(this.settings.sort))throw"sort must be false or a comparison function";if(this.settings.filter!==!1&&!a.isFunction(this.settings.filter)&&"string"!==a.type(this.settings.filter))throw"filter must be false, a string or a filter function"},b.prototype.retrieveSuffixRanges=function(){var a=[];for(var b in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(b)&&a.push(parseInt(b,10));return a.sort(function(a,b){return a>b?1:b>a?-1:0}),a},b.prototype.updateSettings=function(b){this.settings=a.extend({},this.settings,b),this.checkSettings(),this.border=this.settings.border>=0?this.settings.border:this.settings.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges()},a.fn.justifiedGallery=function(c){return this.each(function(d,e){var f=a(e);f.addClass("justified-gallery");var g=f.data("jg.controller");if("undefined"==typeof g){if("undefined"!=typeof c&&null!==c&&"object"!==a.type(c)){if("destroy"===c)return;throw"The argument must be an object"}g=new b(f,a.extend({},a.fn.justifiedGallery.defaults,c)),f.data("jg.controller",g)}else if("norewind"===c);else{if("destroy"===c)return void g.destroy();g.updateSettings(c),g.rewind()}g.updateEntries("norewind"===c)&&g.init()})},a.fn.justifiedGallery.defaults={sizeRangeSuffixes:{},thumbnailPath:void 0,rowHeight:120,maxRowHeight:-1,margins:1,border:-1,lastRow:"nojustify",justifyThreshold:.75,fixedHeight:!1,waitThumbnailsLoad:!0,captions:!0,cssAnimation:!1,imagesAnimationDuration:500,captionSettings:{animationDuration:500,visibleOpacity:.7,nonVisibleOpacity:0},rel:null,target:null,extension:/\.[^.\\/]+$/,refreshTime:200,refreshSensitivity:0,randomize:!1,sort:!1,filter:!1,selector:"> a, > div:not(.spinner)"}}(jQuery); \ No newline at end of file diff --git a/library/justifiedGallery/justifiedGallery.css b/library/justifiedGallery/justifiedGallery.css index 0d45475ce..99be92ff2 100644 --- a/library/justifiedGallery/justifiedGallery.css +++ b/library/justifiedGallery/justifiedGallery.css @@ -1,5 +1,5 @@ /*! - * Justified Gallery - v3.6.0 + * Justified Gallery - v3.6.1 * http://miromannino.github.io/Justified-Gallery/ * Copyright (c) 2015 Miro Mannino * Licensed under the MIT license. diff --git a/library/justifiedGallery/justifiedGallery.min.css b/library/justifiedGallery/justifiedGallery.min.css index d7b1c6726..09ae4e1f0 100644 --- a/library/justifiedGallery/justifiedGallery.min.css +++ b/library/justifiedGallery/justifiedGallery.min.css @@ -1,5 +1,5 @@ /*! - * Justified Gallery - v3.6.0 + * Justified Gallery - v3.6.1 * http://miromannino.github.io/Justified-Gallery/ * Copyright (c) 2015 Miro Mannino * Licensed under the MIT license. diff --git a/view/php/theme_init.php b/view/php/theme_init.php index 648b144b3..67a80ead7 100644 --- a/view/php/theme_init.php +++ b/view/php/theme_init.php @@ -13,7 +13,7 @@ head_add_css('library/justifiedGallery/justifiedGallery.min.css'); head_add_js('jquery.js'); //head_add_js('jquery-migrate-1.1.1.js'); -head_add_js('library/justifiedGallery/jquery.justifiedGallery.min.js'); +head_add_js('library/justifiedGallery/jquery.justifiedGallery.js'); head_add_js('library/sprintf.js/dist/sprintf.min.js'); //head_add_js('jquery-compat.js'); From deaf0e99fdd4edb1cccbcf721d34821927c50f3c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 5 Apr 2016 15:27:45 +0200 Subject: [PATCH 7/9] expand list of bbcode in autocomplete --- view/js/autocomplete.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index b6e81eb8c..a990ad187 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -202,14 +202,17 @@ function submit_form(e) { $.fn.bbco_autocomplete = function(type) { if(type=='bbcode') { - var open_close_elements = ['b', 'i', 'u', 's', 'quote', 'code', 'spoiler', 'map', 'observer']; - var open_elements = ['observer.photo', 'observer.name', 'observer.url']; + var open_close_elements = ['b', 'i', 'u', 's', 'quote', 'code', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer',]; + var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ]; var elements = open_close_elements.concat(open_elements); } if(type=='comanche') { - var elements = ['region', 'widget', 'var', 'template', 'css', 'js']; + var open_close_elements = ['region', 'widget', 'var', 'template', 'css', 'js']; + var open_elements = []; + + var elements = open_close_elements.concat(open_elements); } bbco = { From 32ccdd1f57dc036b9917c9f5577d0ef4298d959c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 5 Apr 2016 15:28:39 +0200 Subject: [PATCH 8/9] use min version of justifiedGallery --- view/php/theme_init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/php/theme_init.php b/view/php/theme_init.php index 67a80ead7..648b144b3 100644 --- a/view/php/theme_init.php +++ b/view/php/theme_init.php @@ -13,7 +13,7 @@ head_add_css('library/justifiedGallery/justifiedGallery.min.css'); head_add_js('jquery.js'); //head_add_js('jquery-migrate-1.1.1.js'); -head_add_js('library/justifiedGallery/jquery.justifiedGallery.js'); +head_add_js('library/justifiedGallery/jquery.justifiedGallery.min.js'); head_add_js('library/sprintf.js/dist/sprintf.min.js'); //head_add_js('jquery-compat.js'); From bd29551f9aec4c463c02a3c57a5d6d94c9ee318d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 5 Apr 2016 16:59:32 +0200 Subject: [PATCH 9/9] fix contextual help --- include/nav.php | 5 ++--- view/js/autocomplete.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/nav.php b/include/nav.php index 4bcef4425..e8c1a2e92 100644 --- a/include/nav.php +++ b/include/nav.php @@ -151,8 +151,8 @@ EOT; if(! get_config('system','hide_help')) { require_once('mod/help.php'); - $context_help = load_doc_file('doc/context/' . $a->cmd . '/help.html'); - $parentdir = dirname($a->cmd); + $context_help = load_doc_file('doc/context/' . App::$cmd . '/help.html'); + $parentdir = dirname(App::$cmd); while (! $context_help && $parentdir !== '.') { $context_help = load_doc_file('doc/context/' . $parentdir . '/help.html'); $parentdir = dirname($parentdir); @@ -266,7 +266,6 @@ $powered_by = ''; * */ function nav_set_selected($item){ - $a = get_app(); App::$nav_sel = array( 'community' => null, 'network' => null, diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index a990ad187..b4879d464 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -202,7 +202,7 @@ function submit_form(e) { $.fn.bbco_autocomplete = function(type) { if(type=='bbcode') { - var open_close_elements = ['b', 'i', 'u', 's', 'quote', 'code', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer',]; + var open_close_elements = ['b', 'i', 'u', 's', 'quote', 'code', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer']; var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ]; var elements = open_close_elements.concat(open_elements);