Pārlūkot izejas kodu

Merge pull request #1287 from Alkarex/load-event

FreshRSS custom event 'freshrss:load-more'
Alexandre Alapetite 9 gadi atpakaļ
vecāks
revīzija
57115d9ef7
2 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 2 0
      CHANGELOG.md
  2. 5 0
      p/scripts/main.js

+ 2 - 0
CHANGELOG.md

@@ -25,6 +25,8 @@
 	* Prevent `<a target="_blank">` attacks with `window.opener` [#1245](https://github.com/FreshRSS/FreshRSS/issues/1245)
 * UI
 	* Download icon 💾 for podcasts [#1236](https://github.com/FreshRSS/FreshRSS/issues/1236)
+* Extensions
+	* Trigger a `freshrss:load-more` JavaScript event to help extensions [#1278](https://github.com/FreshRSS/FreshRSS/issues/1278)
 
 
 ## 2016-08-29 FreshRSS 1.5.0

+ 5 - 0
p/scripts/main.js

@@ -1021,6 +1021,9 @@ function focus_search() {
 	$('#search').focus();
 }
 
+var freshrssLoadMoreEvent = document.createEvent('Event');
+freshrssLoadMoreEvent.initEvent('freshrss:load-more', true, true);
+
 function init_load_more(box) {
 	box_load_more = box;
 
@@ -1030,6 +1033,8 @@ function init_load_more(box) {
 		});
 	}
 
+	document.body.dispatchEvent(freshrssLoadMoreEvent);
+
 	var $next_link = $("#load_more");
 	if (!$next_link.length) {
 		// no more article to load