Sha256: f1df5e0277cb3335f72f95ef07c09ca29747c94d3f301359b0f8f93c2bbd45b8

Contents?: true

Size: 989 Bytes

Versions: 7

Compression:

Stored size: 989 Bytes

Contents

swizzle(Campfire.StarManager, {
  toggle: function($super, element) {
    $super(element);

    var star = $(element).up('span.star'),
        message = this.chat.findMessage(element)
    if (star.hasClassName('starred')) {
      trackStar(message);
    }
  }
});

// 5490ef76-50fa-11e0-8fed-2495f6688d41
// bb628a4e-5199-11e0-949d-2e03dd584bf3 is a test cluster
function trackStar(message) {
  var id   = message.id()
    , url  = "http://allofthestars.com/clusters/.../campfire" +
      "?message="    + encodeURIComponent(message.bodyElement().innerText) +
      "&message_id=" + encodeURIComponent(id.toString()) +
      "&url="        + encodeURIComponent(starPermalink(id)) +
      "&author="     + encodeURIComponent(message.author()) +
      "&room="       + encodeURIComponent($('room_name').innerText)
  window.propane.requestJSON(id, url)
}

function starPermalink(id) {
  return location.href.toString().replace(/#.*/, '') +
    "transcript/message/" + id + "#message_" + id
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
caveat_patch_kids-0.0.8 scripts/caveat_patch_kids/unsupported/display_stars.js
caveat_patch_kids-0.0.7 scripts/caveat_patch_kids/unsupported/display_stars.js
caveat_patch_kids-0.0.5 scripts/caveat_patch_kids/unsupported/display_stars.js
caveat_patch_kids-0.0.4 scripts/caveat_patch_kids/unsupported/display_stars.js
caveat_patch_kids-0.0.3 scripts/caveat_patch_kids/unsupported/display_stars.js
caveat_patch_kids-0.0.2 scripts/caveat_patch_kids/unsupported/display_stars.js
caveat_patch_kids-0.0.1 scripts/caveat_patch_kids/unsupported/display_stars.js