[Wactclc-primo] Embedding Twitter Feed, not just a link

Guidry, Wade WadeG at bigbend.edu
Fri Jun 28 10:27:15 PDT 2019


Maryanne,

I took a look at your VE customization package this morning, and was able to get you the rest of the way there with the twitter feed timeline...


Wade Guidry
Library Consortium Services Manager, WACTCLC
wadeg at bigbend.edu<mailto:wadeg at bigbend.edu>
(509) 760-4474
http://www.wactclc.org


From: Wactclc-primo <wactclc-primo-bounces at lists.ctc.edu> On Behalf Of Hirning, Maryanne
Sent: Wednesday, June 26, 2019 5:37 PM
To: 'WACTCLC Primo discussions' <wactclc-primo at lists.ctc.edu>
Subject: Re: [Wactclc-primo] Embedding Twitter Feed, not just a link

ATTENTION: This email contains links. Please follow best practices before clicking on links
Ugh, I hate javascript.

From: Wactclc-primo <wactclc-primo-bounces at lists.ctc.edu<mailto:wactclc-primo-bounces at lists.ctc.edu>> On Behalf Of Guidry, Wade
Sent: Wednesday, June 26, 2019 5:11 PM
To: WACTCLC Primo discussions <wactclc-primo at lists.ctc.edu<mailto:wactclc-primo at lists.ctc.edu>>
Subject: Re: [Wactclc-primo] Embedding Twitter Feed, not just a link

For what it's worth, here's a link to Edmond's custom.js file: https://sbctc-edcc.primo.exlibrisgroup.com/discovery/custom/01STATEWA_EDCC-EDMONDS/js/custom.js

I think the parts that are driving the Twitter timeline are near the top of the file:

/* BEGIN Bootstrap Script */

var app = angular.module('viewCustom', ['angularLoad', 'ngtweet']);

/* END Bootstrap Script */

And towards the bottom:


/**

 * ngTweet - Angular directives for better Twitter integration.

 *

 * @license

 * The MIT License (MIT)

 *

 * Copyright (c) 2015 Aru Sahni, http://arusahni.net

 *

 * Permission is hereby granted, free of charge, to any person obtaining a copy

 * of this software and associated documentation files (the "Software"), to deal

 * in the Software without restriction, including without limitation the rights

 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

 * copies of the Software, and to permit persons to whom the Software is

 * furnished to do so, subject to the following conditions:

 *

 * The above copyright notice and this permission notice shall be included in all

 * copies or substantial portions of the Software.

 *

 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

 * SOFTWARE.

 *

 */

!function () {

  "use strict";

  angular.module("ngtweet", []).value("ngTweetLogVerbose", !0).value("twitterWidgetURL", "https://platform.twitter.com/widgets.js");

}(), function () {

  "use strict";

  function e(e, t) {

    var n = function n() {},

        i = function i(e) {

      return t === !0 ? e : n;

    };return { log: i(e.log), debug: i(e.debug), info: i(e.info), warn: e.warn, error: e.error };

  }e.$inject = ["$log", "ngTweetLogVerbose"], angular.module("ngtweet").factory("ngTweetLogger", e);

}(), function () {

  "use strict";

  function e(e, t) {

    function n(e, t) {

      this.timelineType = e, this.message = t;

    }function i(e, t) {

      if (!Array.isArray(e) || !Array.isArray(t)) return !0;if (e.length !== t.length) return !0;for (var n = 0, i = e.length; n < i; n++) {

        if (e[n] !== t[n]) return !0;

      }return !1;

    }function r(e) {

      function t(e) {

        return 1 === e.length ? '"' + e + '"' : '("' + e.join('" AND "') + '")';

      }return e.map(t).join(" OR ");

    }function o(e) {

      var t = { sourceType: e.sourceType };if (!l.hasOwnProperty(e.sourceType)) throw new n(e.sourceType, "unknown type");for (var i = l[e.sourceType], o = !1, u = 0, a = i.length; u < a; u++) {

        for (var c = i[u], d = {}, g = 0, s = c.length; g < s; g++) {

          angular.isDefined(e[c[g]]) && (d[c[g]] = e[c[g]]);

        }if (Object.keys(d).length === s) {

          angular.merge(t, d), o = !0;break;

        }

      }if (!o) throw new n(e.sourceType, "args: " + r(i));return t;

    }function u(n, r, u) {

      e.debug("Linking", n, r, u), n.id && !angular.isString(n.id) && e.warn("twitterTimelineId should probably be a string due to loss of precision.");try {

        n.twitterTimelineOptions = JSON.parse(u.twitterTimelineOptions);

      } catch (a) {

        n.$watch(function () {

          return n.$parent.$eval(u.twitterTimelineOptions);

        }, function (e, t) {

          n.twitterTimelineOptions = e;

        });

      }angular.isUndefined(n.twitterTimelineOptions) && (n.twitterTimelineOptions = {}), n.sourceType ? n.$watchGroup(c, function (u, a) {

        if (i(a, u) && angular.element(r[0]).empty(), u.every(function (e) {

          return !e;

        })) return void e.debug("Falsey args received. Not rendering the timeline.");var c;try {

          c = o(n);

        } catch (l) {

          return void e.error('Could not create new timeline: bad args for type "' + l.timelineType + '". Reason: ' + l.message);

        }t.createTimelineNew(c, r[0], n.twitterTimelineOptions).then(function (t) {

          e.debug("New Timeline Success!");

        })["catch"](function (t) {

          e.error("Could not create new timeline: ", t, r);

        });

      }) : angular.isDefined(n.id) || angular.isString(n.screenName) ? n.$watch("id", function (i, o) {

        null !== n.id && (void 0 !== o && i !== o && angular.element(r[0]).empty(), t.createTimeline(n.id, n.screenName, r[0], n.twitterTimelineOptions).then(function (t) {

          e.debug("Timeline Success!!!");

        })["catch"](function (t) {

          e.error("Could not create timeline: ", t, r);

        }));

      }) : t.load(r[0]);

    }var a = { id: "=?twitterTimelineId", screenName: "=?twitterTimelineScreenName", sourceType: "@?twitterTimelineType", userId: "=?twitterTimelineUserId", ownerScreenName: "=?twitterTimelineOwnerScreenName", slug: "=?twitterTimelineSlug", url: "=?twitterTimelineUrl" },

        c = Object.keys(a).reduce(function (e, t) {

      return "=" === a[t][0] && e.push(t), e;

    }, []),

        l = { profile: [["screenName"], ["userId"]], likes: [["screenName"], ["userId"]], collection: [["id"]], widget: [["id"]], list: [["id"], ["ownerScreenName", "slug"]], url: [["url"]] };return { restrict: "E", replace: !0, transclude: !0, scope: a, template: '<div class="ngtweet-wrapper" ng-transclude></div>', link: u };

  }e.$inject = ["ngTweetLogger", "TwitterWidgetFactory"], angular.module("ngtweet").directive("twitterTimeline", e);

}(), function () {

  "use strict";

  function e(e, t) {

    return { restrict: "E", replace: !0, transclude: !0, scope: { twitterWidgetId: "=", twitterWidgetOnRendered: "&", twitterWidgetOptions: "@" }, template: '<div class="ngtweet-wrapper" ng-transclude></div>', link: function link(n, i, r) {

        n.$watch("twitterWidgetId", function (o, u) {

          e.debug("Linking", i, r);var a = n.$eval(r.twitterWidgetOptions);void 0 !== u && o !== u && angular.element(i[0]).empty(), angular.isUndefined(n.twitterWidgetId) ? t.load(i[0]) : (angular.isString(n.twitterWidgetId) || e.warn("twitterWidgetId should probably be a string due to loss of precision."), t.createTweet(n.twitterWidgetId, i[0], a).then(function (t) {

            e.debug("Created tweet widget: ", n.twitterWidgetId, i), n.twitterWidgetOnRendered();

          })["catch"](function (t) {

            e.error("Could not create widget: ", t, i);

          }));

        });

      } };

  }e.$inject = ["ngTweetLogger", "TwitterWidgetFactory"], angular.module("ngtweet").directive("twitterWidget", e);

}(), function () {

  "use strict";

  function e(e, t, n, i, r, o) {

    function u() {

      o.twttr = function (e, t, n) {

        var r,

            u = e.getElementsByTagName(t)[0],

            a = o.twttr || {};if (!e.getElementById(n)) return r = e.createElement(t), r.id = n, r.src = i, u.parentNode.insertBefore(r, u), a._e = [], a.ready = function (e) {

          a._e.push(e);

        }, a;

      }(e[0], "script", "twitter-wjs");

    }function a() {

      return o.twttr && o.twttr.init;

    }function c() {

      return angular.isUndefined(f) ? (f = r.defer(), a() ? f.resolve(o.twttr) : (u(), o.twttr.ready(function (e) {

        n.debug("Twitter script ready"), e.events.bind("rendered", l), f.resolve(e);

      }), f.promise)) : f.promise;

    }function l(e) {

      n.debug("Tweet rendered", e.target.parentElement.attributes);

    }function d(e, t, i) {

      return c().then(function (o) {

        return n.debug("Creating Tweet", o, e, t, i), r.when(o.widgets.createTweet(e, t, i));

      });

    }function g(e, t, i, o) {

      return c().then(function (u) {

        return n.debug("Creating Timeline", e, t, o, i), angular.isString(t) && t.length > 0 && (o.screenName = t), r.when(u.widgets.createTimeline(e, i, o));

      });

    }function s(e, t, i) {

      return c().then(function (o) {

        return n.debug("Creating new Timeline", e, i, t), r.when(o.widgets.createTimeline(e, t, i));

      });

    }function w(e) {

      c().then(function (t) {

        n.debug("Wrapping", t, e), t.widgets.load(e);

      })["catch"](function (t) {

        n.error("Could not wrap element: ", t, e);

      });

    }var f;return { createTweet: d, createTimeline: g, createTimelineNew: s, initialize: c, load: w };

  }e.$inject = ["$document", "$http", "ngTweetLogger", "twitterWidgetURL", "$q", "$window"], angular.module("ngtweet").factory("TwitterWidgetFactory", e);

}(), function () {

  "use strict";

  function e(e, t) {

    return { restrict: "A", replace: !1, scope: !1, link: function link(n, i, r) {

        e.debug("Initializing"), t.initialize();

      } };

  }e.$inject = ["ngTweetLogger", "TwitterWidgetFactory"], angular.module("ngtweet").directive("twitterWidgetInitialize", e);

}(), function () {

  "use strict";

  function e(e) {

    e.decorator("ngTweetLogVerbose", ["$delegate", function (e) {

      return !1;

    }]);

  }e.$inject = ["$provide"], angular.module("ngtweet").config(e);

}();



Wade Guidry
Library Consortium Services Manager, WACTCLC
wadeg at bigbend.edu<mailto:wadeg at bigbend.edu>
(509) 760-4474
http://www.wactclc.org


From: Wactclc-primo <wactclc-primo-bounces at lists.ctc.edu<mailto:wactclc-primo-bounces at lists.ctc.edu>> On Behalf Of Guidry, Wade
Sent: Wednesday, June 26, 2019 5:01 PM
To: WACTCLC Primo discussions <wactclc-primo at lists.ctc.edu<mailto:wactclc-primo at lists.ctc.edu>>
Subject: Re: [Wactclc-primo] Embedding Twitter Feed, not just a link

ATTENTION: This email contains links. Please follow best practices before clicking on links
Looks like Dan has some additional Twitter functionality in custom.js that is helping drive the expansion of that Twitter link into a Timeline.

I'll take a closer look at it tomorrow and see if I can figure it out.




Wade Guidry
Library Consortium Services Manager, WACTCLC
wadeg at bigbend.edu<mailto:wadeg at bigbend.edu>
(509) 760-4474
http://www.wactclc.org


From: Wactclc-primo <wactclc-primo-bounces at lists.ctc.edu<mailto:wactclc-primo-bounces at lists.ctc.edu>> On Behalf Of Hirning, Maryanne
Sent: Wednesday, June 26, 2019 3:42 PM
To: WACTCLC Primo discussions <wactclc-primo at lists.ctc.edu<mailto:wactclc-primo at lists.ctc.edu>>
Subject: Re: [Wactclc-primo] Embedding Twitter Feed, not just a link

ATTENTION: This email contains links. Please follow best practices before clicking on links
Thanks, I saw that. I copied the code twitter supplied for embedding but the html code doesn't include iframe, which seems weird. I'm going to mess with it, but I figured if Dan had it available that would save me the frustration.

From: Wactclc-primo <wactclc-primo-bounces at lists.ctc.edu<mailto:wactclc-primo-bounces at lists.ctc.edu>> On Behalf Of Guidry, Wade
Sent: Wednesday, June 26, 2019 3:20 PM
To: WACTCLC Primo discussions <wactclc-primo at lists.ctc.edu<mailto:wactclc-primo at lists.ctc.edu>>
Subject: Re: [Wactclc-primo] Embedding Twitter Feed, not just a link

I think Dan is on quarter break this week.

But check out this link:

https://help.twitter.com/en/using-twitter/embed-twitter-feed

You may just need to change the Twitter HTML code in use on your homepage_en.html page.




Wade Guidry
Library Consortium Services Manager, WACTCLC
wadeg at bigbend.edu<mailto:wadeg at bigbend.edu>
(509) 760-4474
http://www.wactclc.org


From: Wactclc-primo <wactclc-primo-bounces at lists.ctc.edu<mailto:wactclc-primo-bounces at lists.ctc.edu>> On Behalf Of Hirning, Maryanne
Sent: Wednesday, June 26, 2019 1:43 PM
To: 'wactclc-primo at lists.ctc.edu' <wactclc-primo at lists.ctc.edu<mailto:wactclc-primo at lists.ctc.edu>>
Subject: [Wactclc-primo] Embedding Twitter Feed, not just a link

ATTENTION: This email contains links. Please follow best practices before clicking on links

So in yesterday's conference call there is a link to Edmond's fancy new Primo home page with an embedded Twitter feed: https://sbctc-edcc.primo.exlibrisgroup.com/discovery/search?vid=01STATEWA_EDCC:EDMONDS&sortby=rank

I followed the directions on the Primo VE Customization:
https://knowledge.exlibrisgroup.com/Primo/Product_Documentation/020Primo_VE/008Primo_VE_User_Interface/010Primo_VE_Customization_-_Best_Practices

and was able to add a box with a link to Twitter, but not an embedded timeline. Where am I going wrong?

Thanks in advance!

Maryanne E. Hirning
Library Circulation Services Manager
Lower Columbia College
1600 Maple Street
Longview, WA 98632
360-442-2668

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ctc.edu/pipermail/wactclc-primo_lists.ctc.edu/attachments/20190628/16afcfd3/attachment-0002.html>


More information about the Wactclc-primo mailing list