mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Merge branch 'master' into social
* master: Updating bookmarklet. Showing when the bookmarklet is broken, and fixes bugs with enumerable prototype chain fucking.
This commit is contained in:
commit
1f18f0e8dc
3 changed files with 35 additions and 1 deletions
|
@ -83,7 +83,7 @@ def add_site_load_script(request, token):
|
||||||
return render_to_response('api/bookmarklet_subscribe.js', {
|
return render_to_response('api/bookmarklet_subscribe.js', {
|
||||||
'code': code,
|
'code': code,
|
||||||
'token': token,
|
'token': token,
|
||||||
'folders': usf and usf.folders,
|
'folders': (usf and usf.folders) or [],
|
||||||
'accept_image': accept_image,
|
'accept_image': accept_image,
|
||||||
'error_image': error_image,
|
'error_image': error_image,
|
||||||
'add_image': add_image,
|
'add_image': add_image,
|
||||||
|
|
|
@ -498,6 +498,7 @@
|
||||||
}
|
}
|
||||||
.NB-bookmarklet .NB-modal-submit {
|
.NB-bookmarklet .NB-modal-submit {
|
||||||
margin: 24px 0 8px;
|
margin: 24px 0 8px;
|
||||||
|
padding: 0 0 6px;
|
||||||
}
|
}
|
||||||
.NB-bookmarklet .NB-modal-submit-button {
|
.NB-bookmarklet .NB-modal-submit-button {
|
||||||
clear: both;
|
clear: both;
|
||||||
|
@ -505,6 +506,7 @@
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
text-shadow: none;
|
||||||
}
|
}
|
||||||
.NB-bookmarklet .NB-modal-submit-button img {
|
.NB-bookmarklet .NB-modal-submit-button img {
|
||||||
margin: 5px 6px 0 0;
|
margin: 5px 6px 0 0;
|
||||||
|
@ -530,4 +532,16 @@
|
||||||
}
|
}
|
||||||
.NB-bookmarklet .NB-folders {
|
.NB-bookmarklet .NB-folders {
|
||||||
float: right;
|
float: right;
|
||||||
|
}
|
||||||
|
.NB-bookmarklet .NB-error-invalid {
|
||||||
|
padding: 12px 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
text-shadow: none;
|
||||||
|
color: white;
|
||||||
|
background-color: #690F0F;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
.NB-bookmarklet .NB-error-invalid a {
|
||||||
|
color: #9FC6F5;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
|
@ -18,6 +18,10 @@
|
||||||
|
|
||||||
this.options = $.extend({}, defaults, options);
|
this.options = $.extend({}, defaults, options);
|
||||||
this.runner();
|
this.runner();
|
||||||
|
|
||||||
|
{% if code < 0 %}
|
||||||
|
this.show_error();
|
||||||
|
{% endif %}
|
||||||
};
|
};
|
||||||
|
|
||||||
NEWSBLUR.BookmarkletModal.prototype = {
|
NEWSBLUR.BookmarkletModal.prototype = {
|
||||||
|
@ -47,6 +51,15 @@
|
||||||
this.$modal.bind('click', $.rescope(this.handle_clicks, this));
|
this.$modal.bind('click', $.rescope(this.handle_clicks, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
show_error: function() {
|
||||||
|
$('.NB-bookmarklet-folder-container', this.$modal).hide();
|
||||||
|
$('.NB-modal-submit', this.$modal).html($.make('div', { className: 'NB-error-invalid' }, [
|
||||||
|
'This bookmarklet no longer matches an account. Re-create it in ',
|
||||||
|
$.make('a', { href: 'http://www.newsblur.com/?next=goodies' }, 'Goodies on NewsBlur'),
|
||||||
|
'.'
|
||||||
|
]));
|
||||||
|
},
|
||||||
|
|
||||||
attach_css: function() {
|
attach_css: function() {
|
||||||
var css = "{% include_bookmarklet_css %}";
|
var css = "{% include_bookmarklet_css %}";
|
||||||
var style = '<style>' + css + '</style>';
|
var style = '<style>' + css + '</style>';
|
||||||
|
@ -110,11 +123,18 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
make_folder_options: function($options, items, depth) {
|
make_folder_options: function($options, items, depth) {
|
||||||
|
if (depth && depth.length > 5) {
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i in items) {
|
for (var i in items) {
|
||||||
|
if (!items.hasOwnProperty(i)) continue;
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
if (typeof item == "object") {
|
if (typeof item == "object") {
|
||||||
for (var o in item) {
|
for (var o in item) {
|
||||||
|
if (!item.hasOwnProperty(o)) continue;
|
||||||
var folder = item[o];
|
var folder = item[o];
|
||||||
|
console.log(["make_folder_options", folder, o, depth]);
|
||||||
var $option = $.make('option', { value: o }, depth + ' ' + o);
|
var $option = $.make('option', { value: o }, depth + ' ' + o);
|
||||||
$options.append($option);
|
$options.append($option);
|
||||||
$options = this.make_folder_options($options, folder, depth+'-');
|
$options = this.make_folder_options($options, folder, depth+'-');
|
||||||
|
|
Loading…
Add table
Reference in a new issue