aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/readmore.js/README.md22
-rw-r--r--library/readmore.js/hubzilla-custom-fix-webkit-browsers.patch13
-rw-r--r--library/readmore.js/readmore.js28
3 files changed, 13 insertions, 50 deletions
diff --git a/library/readmore.js/README.md b/library/readmore.js/README.md
index 24649f32d..0116fbe8b 100644
--- a/library/readmore.js/README.md
+++ b/library/readmore.js/README.md
@@ -9,22 +9,16 @@ Readmore.js is tested with—and supported on—all versions of jQuery greater t
## Install
-Install Readmore.js with npm:
+Install Readmore.js with Bower:
```
-$ npm install readmore-js
+$ bower install readmore
```
Then include it in your HTML:
```html
-<script src="/node_modules/readmore-js/readmore.min.js"></script>
-```
-
-Or, using Webpack or Browserify:
-
-```javascript
-require('readmore-js');
+<script src="/bower_components/readmore/readmore.min.js"></script>
```
@@ -55,23 +49,17 @@ $('article').readmore({
* `startOpen: false` do not immediately truncate, start in the fully opened position
* `beforeToggle: function() {}` called after a more or less link is clicked, but *before* the block is collapsed or expanded
* `afterToggle: function() {}` called *after* the block is collapsed or expanded
-* `blockProcessed: function() {}` called once per block during initilization after Readmore.js has processed the block.
If the element has a `max-height` CSS property, Readmore.js will use that value rather than the value of the `collapsedHeight` option.
### The callbacks:
-The `beforeToggle` and `afterToggle` callbacks both receive the same arguments: `trigger`, `element`, and `expanded`.
+The callback functions, `beforeToggle` and `afterToggle`, both receive the same arguments: `trigger`, `element`, and `expanded`.
* `trigger`: the "Read more" or "Close" element that was clicked
* `element`: the block that is being collapsed or expanded
* `expanded`: Boolean; `true` means the block is expanded
-The `blockProcessed` callback receives `element` and `collapsable`.
-
-* `element`: the block that has just been processed
-* `collapsable`: Boolean; `false` means the block was shorter than the specified minimum `collapsedHeight`--the block will not have a "Read more" link
-
#### Callback example:
Here's an example of how you could use the `afterToggle` callback to scroll back to the top of a block when the "Close" link is clicked.
@@ -178,6 +166,6 @@ $ npm install
Which will install the necessary development dependencies. Then, to build the minified script:
```
-$ npm run build
+$ gulp compress
```
diff --git a/library/readmore.js/hubzilla-custom-fix-webkit-browsers.patch b/library/readmore.js/hubzilla-custom-fix-webkit-browsers.patch
deleted file mode 100644
index fd3146152..000000000
--- a/library/readmore.js/hubzilla-custom-fix-webkit-browsers.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/library/readmore.js/readmore.js b/library/readmore.js/readmore.js
-index 34a624e..51222ce 100644
---- a/library/readmore.js/readmore.js
-+++ b/library/readmore.js/readmore.js
-@@ -246,7 +246,7 @@
- collapsedHeight = $element.data('collapsedHeight');
-
- if ($element.height() <= collapsedHeight) {
-- newHeight = $element.data('expandedHeight') + 'px';
-+ newHeight = 100 + '%';
- newLink = 'lessLink';
- expanded = true;
- }
diff --git a/library/readmore.js/readmore.js b/library/readmore.js/readmore.js
index 51222ced0..fb5a0e0f9 100644
--- a/library/readmore.js/readmore.js
+++ b/library/readmore.js/readmore.js
@@ -37,9 +37,8 @@
startOpen: false,
// callbacks
- blockProcessed: function() {},
- beforeToggle: function() {},
- afterToggle: function() {}
+ beforeToggle: function(){},
+ afterToggle: function(){}
},
cssEmbedded = {},
uniqueIdCounter = 0;
@@ -188,9 +187,6 @@
if (current.outerHeight(true) <= collapsedHeight + heightMargin) {
// The block is shorter than the limit, so there's no need to truncate it.
- if (this.options.blockProcessed && typeof this.options.blockProcessed === 'function') {
- this.options.blockProcessed(current, false);
- }
return true;
}
else {
@@ -210,7 +206,7 @@
};
})(this))
.attr({
- 'data-readmore-toggle': id,
+ 'data-readmore-toggle': '',
'aria-controls': id
}));
@@ -219,10 +215,6 @@
height: collapsedHeight
});
}
-
- if (this.options.blockProcessed && typeof this.options.blockProcessed === 'function') {
- this.options.blockProcessed(current, true);
- }
}
},
@@ -232,11 +224,11 @@
}
if (! trigger) {
- trigger = $('[aria-controls="' + this.element.id + '"]')[0];
+ trigger = $('[aria-controls="' + _this.element.id + '"]')[0];
}
if (! element) {
- element = this.element;
+ element = _this.element;
}
var $element = $(element),
@@ -258,18 +250,14 @@
// Fire beforeToggle callback
// Since we determined the new "expanded" state above we're now out of sync
// with our true current state, so we need to flip the value of `expanded`
- if (this.options.beforeToggle && typeof this.options.beforeToggle === 'function') {
- this.options.beforeToggle(trigger, $element, ! expanded);
- }
+ this.options.beforeToggle(trigger, $element, ! expanded);
$element.css({'height': newHeight});
// Fire afterToggle callback
$element.on('transitionend', (function(_this) {
return function() {
- if (_this.options.afterToggle && typeof _this.options.afterToggle === 'function') {
- _this.options.afterToggle(trigger, $element, expanded);
- }
+ _this.options.afterToggle(trigger, $element, expanded);
$(this).attr({
'aria-expanded': expanded
@@ -284,7 +272,7 @@
};
})(this))
.attr({
- 'data-readmore-toggle': $element.attr('id'),
+ 'data-readmore-toggle': '',
'aria-controls': $element.attr('id')
}));
},