diff options
-rw-r--r-- | include/features.php | 79 | ||||
-rw-r--r-- | library/jquery.timeago.js | 347 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/css/mod_manage.css | 4 | ||||
-rw-r--r-- | view/js/main.js | 19 |
5 files changed, 270 insertions, 181 deletions
diff --git a/include/features.php b/include/features.php index 7009b1d6b..1a4b2654f 100644 --- a/include/features.php +++ b/include/features.php @@ -7,13 +7,28 @@ function feature_enabled($uid,$feature) { $x = get_pconfig($uid,'feature',$feature); - if($x === false) + if($x === false) { $x = get_config('feature',$feature); + if($x === false) + $x = get_feature_default($feature); + } $arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x); call_hooks('feature_enabled',$arr); return($arr['enabled']); } +function get_feature_default($feature) { + $f = get_features(); + foreach($f as $cat) { + foreach($cat as $feat) { + if(is_array($feat) && $feat[0] === $feature) + return $feat[3]; + } + } + return false; +} + + function get_features() { $arr = array( @@ -22,58 +37,52 @@ function get_features() { 'general' => array( t('General Features'), // This is per post, and different from fixed expiration 'expire' which isn't working yet - array('content_expire', t('Content Expiration'), t('Remove posts/comments and/or private messages at a future time')), - array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles')), - array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections')), - array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels')), - array('webpages', t('Web Pages'), t('Provide managed web pages on your channel')), - array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders')), -// prettyphoto has licensing issues and will no longer be provided in core - -// in any event this setting should probably be a theme option or plugin -// array('prettyphoto', t('Enhanced Photo Albums'), t('Enable photo album with enhanced features')), - array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu')), + array('content_expire', t('Content Expiration'), t('Remove posts/comments and/or private messages at a future time'), false), + array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles'), false), + array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections'),false), + array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false), + array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false), + array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders'),false), + array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false), //FIXME - needs a description, but how the hell do we explain this to normals? - array('sendzid', t('Extended Identity Sharing'), t('Share your identity with all websites on the internet. When disabled, identity is only shared with sites in the matrix.')), - array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options')), - array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel')), + array('sendzid', t('Extended Identity Sharing'), t('Share your identity with all websites on the internet. When disabled, identity is only shared with sites in the matrix.'),false), + array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options'),false), + array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel'),false), ), // Post composition 'composition' => array( t('Post Composition Features'), -// array('richtext', t('Richtext Editor'), t('Enable richtext editor')), - array('markdown', t('Use Markdown'), t('Allow use of "Markdown" to format posts')), -// array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')), - array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds')), - array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key')), - array('adult_photo_flagging', t('Flag Adult Photos'), t('Provide photo edit option to hide adult photos from default album view')), +// array('richtext', t('Richtext Editor'), t('Enable richtext editor'),false), + array('markdown', t('Use Markdown'), t('Allow use of "Markdown" to format posts'),false), + array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds'),false), + array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key'),false), + array('adult_photo_flagging', t('Flag Adult Photos'), t('Provide photo edit option to hide adult photos from default album view'),false), ), // Network Tools 'net_module' => array( t('Network and Stream Filtering'), - array('archives', t('Search by Date'), t('Ability to select posts by date ranges')), - array('groups', t('Collections Filter'), t('Enable widget to display Network posts only from selected collections')), - array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')), - array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on')), - array('new_tab', t('Network New Tab'), t('Enable tab to display all new Network activity')), - array('affinity', t('Affinity Tool'), t('Filter stream activity by depth of relationships')), - array('suggest', t('Suggest Channels'), t('Show channel suggestions')), + array('archives', t('Search by Date'), t('Ability to select posts by date ranges'),false), + array('groups', t('Collections Filter'), t('Enable widget to display Network posts only from selected collections'),false), + array('savedsearch', t('Saved Searches'), t('Save search terms for re-use'),false), + array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on'),false), + array('new_tab', t('Network New Tab'), t('Enable tab to display all new Network activity'),false), + array('affinity', t('Affinity Tool'), t('Filter stream activity by depth of relationships'),false), + array('suggest', t('Suggest Channels'), t('Show channel suggestions'),false), ), // Item tools 'tools' => array( t('Post/Comment Tools'), -// array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once')), -// array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')), - array('commtag', t('Tagging'), t('Ability to tag existing posts')), - array('categories', t('Post Categories'), t('Add categories to your posts')), - array('filing', t('Saved Folders'), t('Ability to file posts under folders')), - array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')), - array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')), - array('tagadelic', t('Tag Cloud'), t('Provide a personal tag cloud on your channel page')), + array('commtag', t('Tagging'), t('Ability to tag existing posts'),false), + array('categories', t('Post Categories'), t('Add categories to your posts'),false), + array('filing', t('Saved Folders'), t('Ability to file posts under folders'),false), + array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments'),false), + array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'),false), + array('tagadelic', t('Tag Cloud'), t('Provide a personal tag cloud on your channel page'),false), ), ); diff --git a/library/jquery.timeago.js b/library/jquery.timeago.js index f7a657e93..ef9327aac 100644 --- a/library/jquery.timeago.js +++ b/library/jquery.timeago.js @@ -3,7 +3,7 @@ * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). * * @name timeago - * @version 0.11.4 + * @version 1.4.1 * @requires jQuery v1.2.3+ * @author Ryan McGeary * @license MIT License - http://www.opensource.org/licenses/mit-license.php @@ -11,142 +11,211 @@ * For usage and examples, visit: * http://timeago.yarp.com/ * - * Copyright (c) 2008-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + * Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) */ -(function($) { - $.timeago = function(timestamp) { - if (timestamp instanceof Date) { - return inWords(timestamp); - } else if (typeof timestamp === "string") { - return inWords($.timeago.parse(timestamp)); - } else if (typeof timestamp === "number") { - return inWords(new Date(timestamp)); - } else { - return inWords($.timeago.datetime(timestamp)); - } - }; - var $t = $.timeago; - - $.extend($.timeago, { - settings: { - refreshMillis: 60000, - allowFuture: false, - strings: { - prefixAgo: null, - prefixFromNow: null, - suffixAgo: "ago", - suffixFromNow: "from now", - seconds: "less than a minute", - minute: "about a minute", - minutes: "%d minutes", - hour: "about an hour", - hours: "about %d hours", - day: "a day", - days: "%d days", - month: "about a month", - months: "%d months", - year: "about a year", - years: "%d years", - wordSeparator: " ", - numbers: [] - } - }, - inWords: function(distanceMillis) { - var $l = this.settings.strings; - var prefix = $l.prefixAgo; - var suffix = $l.suffixAgo; - if (this.settings.allowFuture) { - if (distanceMillis < 0) { - prefix = $l.prefixFromNow; - suffix = $l.suffixFromNow; - } - } - - var seconds = Math.abs(distanceMillis) / 1000; - var minutes = seconds / 60; - var hours = minutes / 60; - var days = hours / 24; - var years = days / 365; - - function substitute(stringOrFunction, number) { - var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; - var value = ($l.numbers && $l.numbers[number]) || number; - return string.replace(/%d/i, value); - } - - var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || - seconds < 90 && substitute($l.minute, 1) || - minutes < 45 && substitute($l.minutes, Math.round(minutes)) || - minutes < 90 && substitute($l.hour, 1) || - hours < 24 && substitute($l.hours, Math.round(hours)) || - hours < 42 && substitute($l.day, 1) || - days < 30 && substitute($l.days, Math.round(days)) || - days < 45 && substitute($l.month, 1) || - days < 365 && substitute($l.months, Math.round(days / 30)) || - years < 1.5 && substitute($l.year, 1) || - substitute($l.years, Math.round(years)); - - var separator = $l.wordSeparator === undefined ? " " : $l.wordSeparator; - return $.trim([prefix, words, suffix].join(separator)); - }, - parse: function(iso8601) { - var s = $.trim(iso8601); - s = s.replace(/\.\d+/,""); // remove milliseconds - s = s.replace(/-/,"/").replace(/-/,"/"); - s = s.replace(/T/," ").replace(/Z/," UTC"); - s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 - return new Date(s); - }, - datetime: function(elem) { - var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); - return $t.parse(iso8601); - }, - isTime: function(elem) { - // jQuery's `is()` doesn't play well with HTML5 in IE - return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); - } - }); - - $.fn.timeago = function() { - var self = this; - self.each(refresh); - - var $s = $t.settings; - if ($s.refreshMillis > 0) { - setInterval(function() { self.each(refresh); }, $s.refreshMillis); - } - return self; - }; - - function refresh() { - var data = prepareData(this); - if (!isNaN(data.datetime)) { - $(this).text(inWords(data.datetime)); - } - return this; - } - - function prepareData(element) { - element = $(element); - if (!element.data("timeago")) { - element.data("timeago", { datetime: $t.datetime(element) }); - var text = $.trim(element.text()); - if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { - element.attr("title", text); - } - } - return element.data("timeago"); - } - - function inWords(date) { - return $t.inWords(distance(date)); - } - - function distance(date) { - return (new Date().getTime() - date.getTime()); - } - - // fix for IE6 suckage - document.createElement("abbr"); - document.createElement("time"); -}(jQuery)); + +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else if (typeof timestamp === "number") { + return inWords(new Date(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowPast: true, + allowFuture: false, + localeTitle: false, + cutoff: 0, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + inPast: 'any moment now', + seconds: "less than a minute", + minute: "about a minute", + minutes: "%d minutes", + hour: "about an hour", + hours: "about %d hours", + day: "a day", + days: "%d days", + month: "about a month", + months: "%d months", + year: "about a year", + years: "%d years", + wordSeparator: " ", + numbers: [] + } + }, + + inWords: function(distanceMillis) { + if(!this.settings.allowPast && ! this.settings.allowFuture) { + throw 'timeago allowPast and allowFuture settings can not both be set to false.'; + } + + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + if(!this.settings.allowPast && distanceMillis >= 0) { + return this.settings.strings.inPast; + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator || ""; + if ($l.wordSeparator === undefined) { separator = " "; } + return $.trim([prefix, words, suffix].join(separator)); + }, + + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + // functions that can be called via $(el).timeago('action') + // init is default when no action is given + // functions are called with context of a single element + var functions = { + init: function(){ + var refresh_el = $.proxy(refresh, this); + refresh_el(); + var $s = $t.settings; + if ($s.refreshMillis > 0) { + this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis); + } + }, + update: function(time){ + var parsedTime = $t.parse(time); + $(this).data('timeago', { datetime: parsedTime }); + if($t.settings.localeTitle) $(this).attr("title", parsedTime.toLocaleString()); + refresh.apply(this); + }, + updateFromDOM: function(){ + $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) }); + refresh.apply(this); + }, + dispose: function () { + if (this._timeagoInterval) { + window.clearInterval(this._timeagoInterval); + this._timeagoInterval = null; + } + } + }; + + $.fn.timeago = function(action, options) { + var fn = action ? functions[action] : functions.init; + if(!fn){ + throw new Error("Unknown function name '"+ action +"' for timeago"); + } + // each over objects here and call the requested function + this.each(function(){ + fn.call(this, options); + }); + return this; + }; + + function refresh() { + //check if it's still visible + if(!$.contains(document.documentElement,this)){ + //stop if it has been removed + $(this).timeago("dispose"); + return this; + } + + var data = prepareData(this); + var $s = $t.settings; + + if (!isNaN(data.datetime)) { + if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) { + $(this).text(inWords(data.datetime)); + } + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if ($t.settings.localeTitle) { + element.attr("title", element.data('timeago').datetime.toLocaleString()); + } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})); diff --git a/version.inc b/version.inc index 95fdfb820..9c65a441a 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-01-05.910 +2015-01-06.911 diff --git a/view/css/mod_manage.css b/view/css/mod_manage.css index bb7ef566d..fbe4a672a 100644 --- a/view/css/mod_manage.css +++ b/view/css/mod_manage.css @@ -51,3 +51,7 @@ .selected-channel img { border: 2px solid #ff0000; } + +.channels-end { + clear: both; +}
\ No newline at end of file diff --git a/view/js/main.js b/view/js/main.js index 85aea9875..974f5f971 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -135,11 +135,13 @@ function showHideComments(id) { if( $('#collapsed-comments-' + id).is(':visible')) { + $('#collapsed-comments-' + id + ' .autotime').timeago('dispose'); $('#collapsed-comments-' + id).slideUp(); $('#hide-comments-' + id).html(aStr['showmore']); $('#hide-comments-total-' + id).show(); } else { + $('#collapsed-comments-' + id + ' .autotime').timeago(); $('#collapsed-comments-' + id).slideDown(); $('#hide-comments-' + id).html(aStr['showfewer']); $('#hide-comments-total-' + id).hide(); @@ -452,6 +454,7 @@ function updateConvItems(mode,data) { $('.thread-wrapper.toplevel_item',data).each(function() { var ident = $(this).attr('id'); + // This should probably use the context argument instead var commentWrap = $('#'+ident+' .collapsed-comments').attr('id'); var itmId = 0; var isVisible = false; @@ -468,7 +471,7 @@ function updateConvItems(mode,data) { $('#' + prev).after($(this)); if(isVisible) showHideComments(itmId); - $(".autotime",this).timeago(); + $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); } else { $('img',this).each(function() { @@ -479,7 +482,7 @@ function updateConvItems(mode,data) { $('#' + ident).replaceWith($(this)); if(isVisible) showHideComments(itmId); - $(".autotime",this).timeago(); + $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); } prev = ident; }); @@ -510,7 +513,7 @@ function updateConvItems(mode,data) { $('#threads-end').before($(this)); if(isVisible) showHideComments(itmId); - $(".autotime",this).timeago(); + $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); } else { $('img',this).each(function() { @@ -521,7 +524,7 @@ function updateConvItems(mode,data) { $('#' + ident).replaceWith($(this)); if(isVisible) showHideComments(itmId); - $(".autotime",this).timeago(); + $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); } }); @@ -555,7 +558,7 @@ function updateConvItems(mode,data) { $('#' + prev).after($(this)); if(isVisible) showHideComments(itmId); - $(".autotime",this).timeago(); + $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); } prev = ident; @@ -598,7 +601,11 @@ function updateConvItems(mode,data) { $(".wall-item-body, .contact-info").each(function() { if($(this).height() > divmore_height + 10) { if(! $(this).hasClass('divmore')) { - $(this).readmore({collapsedHeight: divmore_height, moreLink: '<a href="#">'+aStr['divgrowmore']+'</a>', lessLink: '<a href="#">'+aStr['divgrowless']+'</a>'}); + $(this).readmore({ + collapsedHeight: divmore_height, + moreLink: '<a href="#" class="divgrow-showmore">'+aStr['divgrowmore']+'</a>', + lessLink: '<a href="#">'+aStr['divgrowless']+'</a>' + }); $(this).addClass('divmore'); } } |