Merge branch 'master' of github.com:samuelclay/NewsBlur

* 'master' of github.com:samuelclay/NewsBlur:
  Saving last used recipient email address as a cookie.
  Don't bother showing 'Download Image' enclosure links. Just embed them.
This commit is contained in:
Samuel Clay 2012-01-16 10:39:19 -08:00
commit 3fce5007dd
4 changed files with 46 additions and 1 deletions

View file

@ -43,6 +43,7 @@ javascripts:
- media/js/jquery.ui.slider.js
- media/js/jquery.ui.autocomplete.js
- media/js/jquery.ui.progressbar.js
- media/js/jquery.cookie.js
- media/js/jquery.layout.js
- media/js/jquery.tinysort.js
- media/js/jquery.fieldselection.js

41
media/js/jquery.cookie.js Normal file
View file

@ -0,0 +1,41 @@
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie = function (key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && String(value) !== "[object Object]") {
options = jQuery.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

View file

@ -46,7 +46,8 @@ NEWSBLUR.ReaderSendEmail.prototype = _.extend({}, NEWSBLUR.Modal.prototype, {
$.make('span', { className: 'NB-raquo' }, '»'),
' Recipient\'s email: '
]),
$.make('input', { className: 'NB-input NB-modal-to', name: 'to', id: 'NB-send-email-to', value: "" })
$.make('input', { className: 'NB-input NB-modal-to', name: 'to', id: 'NB-send-email-to', value:
($.cookie('NB:email:to') || "") })
]),
$.make('div', { className: 'NB-modal-email-explanation' }, [
"Add an optional comment to send with the story. The story will be sent below your comment."
@ -114,6 +115,7 @@ NEWSBLUR.ReaderSendEmail.prototype = _.extend({}, NEWSBLUR.Modal.prototype, {
$save.removeClass('NB-disabled').val('Send this story');
} else {
$save.val('Sent!');
$.cookie('NB:email:to', $('input[name=to]', this.$modal).val());
this.close();
}
},

View file

@ -91,6 +91,7 @@ def pre_process_story(entry):
}
elif 'image' in media_type and media_url:
entry['story_content'] += """<br><br><img src="%s" />""" % media_url
continue
elif media_content.get('rel') == 'alternative' or 'text' in media_content.get('type'):
continue
elif media_type_name in ['application']: