Commits

David Chambers committed b1704c7

Appended short URL to raw output.

Comments (0)

Files changed (1)

 
     windowWidth,
 
+    _ = {
+      subs: {},
+      sub: function (event, action) {
+        _.subs[event] = action;
+      },
+      pub: function (event) {
+        var action = _.subs[event];
+        if (action) {
+          action.apply(null, Array.prototype.slice.call(arguments, 1));
+          delete _.subs[event];
+        }
+      }
+    },
+
     convert = new Showdown('datetimes', 'abbreviations').convert,
 
     encode = Hashify.encode,
       wrapper.insertBefore(shorturl, qrcode);
       return function (data) {
         var tweetText, url = data.url;
+        // publish "shorturl" event
+        _.pub('shorturl', url);
         if (textNode) shorturl.removeChild(textNode);
         shorturl.appendChild(textNode = document.createTextNode(url));
         shorturl.href = url;
 
     function ready() {
       if (queryContains('raw:yes')) {
-        location = 'data:text/plain;base64,' + hash;
-        return;
-      }
-      if (presentationMode) {
+        _.sub('shorturl', function (url) {
+          var encoded = encode(editor.value + '\n\n[' + url + ']');
+          location = 'data:text/plain;base64,' + encoded;
+        });
+      } else if (presentationMode) {
         resizeSidebar(0);
       } else {
         if (preferredWidth > sidebarMinimumWidth) {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.