Last active
January 24, 2018 07:10
-
-
Save Ray33/c14a65a761cdb72f1663f19cec961c25 to your computer and use it in GitHub Desktop.
Revisions
-
Ray33 revised this gist
Jan 24, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ var visible_urls = new Map(); var fired_urls = []; //When news item is created, add it's id and the it's visibilityUrl to map visible_urls.set(news_item.id, news_item.visibleUrl); //call the url in background function open_visible_url(url) { -
Ray33 revised this gist
Jan 24, 2018 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,8 +21,8 @@ function open_visible_url(url) { //Select all items and append the visbility url call on visible. // This should be called after all items are rendered (on each call to the API) $(".class_selector_with_news").each(function () { //activate the waypoint library to trigger on visible $("#" + this.id).waypoint({ handler: function (direction) { if (jQuery.inArray(visible_urls.get(this.id), fired_urls) == -1) { @@ -32,5 +32,5 @@ $(".mui-table-view").find(".firLi").each(function () { }, offset: "bottom-in-view" }); }); -
Ray33 created this gist
Dec 1, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ //initialize variables var visible_urls = new Map(); var fired_urls = []; //When news item is created, add it's id and the it's visibilityUrl to map visible_urls.set(news_id, value.visibleUrl); //call the url in background function open_visible_url(url) { if (url){ if (!url.startsWith(protocol)){ url = url.replace("http", protocol); } $.getJSON(url, function () { console.log("visible url called:" + url); } ); } } //Select all items and append the visbility url call on visible. // This should be called after all items are rendered (on each call to the API) $(".mui-table-view").find(".firLi").each(function () { if (this.id.indexOf("ad") != -1) { $("#" + this.id).waypoint({ handler: function (direction) { if (jQuery.inArray(visible_urls.get(this.id), fired_urls) == -1) { open_visible_url(visible_urls.get(this.id)); fired_urls.push(visible_urls.get(this.id)); } }, offset: "bottom-in-view" }); } });