Cleaning up text on share bookmarklet.

This commit is contained in:
Samuel Clay 2012-08-11 13:53:00 -07:00
parent 8a5a5edacc
commit 4689b47a4e
8 changed files with 101 additions and 29 deletions

View file

@ -61,8 +61,8 @@ def logout(request):
def add_site_load_script(request, token):
code = 0
usf = None
def image_base64(image_name):
image_file = open(os.path.join(settings.MEDIA_ROOT, 'img/icons/silk/%s.png' % image_name))
def image_base64(image_name, path='icons/silk/'):
image_file = open(os.path.join(settings.MEDIA_ROOT, 'img/%s%s.png' % (path, image_name)))
return base64.b64encode(image_file.read())
accept_image = image_base64('accept')
@ -84,7 +84,7 @@ def add_site_load_script(request, token):
except UserSubscriptionFolders.DoesNotExist:
code = -1
return render_to_response('api/bookmarklet_subscribe.js', {
return render_to_response('api/share_bookmarklet.js', {
'code': code,
'token': token,
'folders': (usf and usf.folders) or [],

View file

@ -2,10 +2,10 @@ from django.conf.urls.defaults import *
from apps.feed_import import views
urlpatterns = patterns('apps.feed_import.views',
url(r'^opml_upload$', views.opml_upload, name='opml-upload'),
url(r'^opml_export$', views.opml_export, name='opml-export'),
url(r'^authorize/$', views.reader_authorize, name='google-reader-authorize'),
url(r'^callback/$', views.reader_callback, name='google-reader-callback'),
url(r'^signup/$', views.import_signup, name='import-signup'),
url(r'^import_from_google_reader/$', views.import_from_google_reader, name='import-from-google-reader')
url(r'^opml_upload/?$', views.opml_upload, name='opml-upload'),
url(r'^opml_export/?$', views.opml_export, name='opml-export'),
url(r'^authorize/?$', views.reader_authorize, name='google-reader-authorize'),
url(r'^callback/?$', views.reader_callback, name='google-reader-callback'),
url(r'^signup/?$', views.import_signup, name='import-signup'),
url(r'^import_from_google_reader/?$', views.import_from_google_reader, name='import-from-google-reader')
)

View file

@ -433,16 +433,16 @@ class MSocialProfile(mongo.Document):
def send_email_for_new_follower(self, follower_user_id):
user = User.objects.get(pk=self.user_id)
if follower_user_id not in self.follower_user_ids:
logging.user(user, "~BB~FMNo longer being followed by %s" % follower_user_id)
logging.user(user, "~FMNo longer being followed by %s" % follower_user_id)
return
if not user.email:
logging.user(user, "~BB~FMNo email to send to, skipping.")
logging.user(user, "~FMNo email to send to, skipping.")
return
elif not user.profile.send_emails:
logging.user(user, "~BB~FMDisabled emails, skipping.")
logging.user(user, "~FMDisabled emails, skipping.")
return
if self.user_id == follower_user_id:
logging.user(user, "~BB~FMDisabled emails, skipping.")
logging.user(user, "~FMDisabled emails, skipping.")
return
emails_sent = MSentEmail.objects.filter(receiver_user_id=user.pk,
@ -451,7 +451,7 @@ class MSocialProfile(mongo.Document):
day_ago = datetime.datetime.now() - datetime.timedelta(days=1)
for email in emails_sent:
if email.date_sent > day_ago:
logging.user(user, "~BB~SK~FMNot sending new follower email, already sent before. NBD.")
logging.user(user, "~SK~FMNot sending new follower email, already sent before. NBD.")
return
follower_profile = MSocialProfile.get_user(follower_user_id)
@ -483,7 +483,7 @@ class MSocialProfile(mongo.Document):
MSentEmail.record(receiver_user_id=user.pk, sending_user_id=follower_user_id,
email_type='new_follower')
logging.user(user, "~BB~FM~SBSending email for new follower: %s" % follower_profile.username)
logging.user(user, "~BB~FR~SBSending email for new follower: %s" % follower_profile.username)
def save_feed_story_history_statistics(self):
"""
@ -1507,9 +1507,9 @@ class MSharedStory(mongo.Document):
if not user.email or not user.profile.send_emails:
if not user.email:
logging.user(user, "~BB~FMNo email to send to, skipping.")
logging.user(user, "~FMNo email to send to, skipping.")
elif not user.profile.send_emails:
logging.user(user, "~BB~FMDisabled emails, skipping.")
logging.user(user, "~FMDisabled emails, skipping.")
continue
mute_url = "http://%s%s" % (
@ -1558,9 +1558,9 @@ class MSharedStory(mongo.Document):
if not original_user.email or not original_user.profile.send_emails:
if not original_user.email:
logging.user(original_user, "~BB~FMNo email to send to, skipping.")
logging.user(original_user, "~FMNo email to send to, skipping.")
elif not original_user.profile.send_emails:
logging.user(original_user, "~BB~FMDisabled emails, skipping.")
logging.user(original_user, "~FMDisabled emails, skipping.")
return
story_feed = Feed.objects.get(pk=self.story_feed_id)
@ -1766,7 +1766,7 @@ class MSocialServices(mongo.Document):
followers += 1
user = User.objects.get(pk=self.user_id)
logging.user(user, "~BB~FRTwitter import: %s users, now following ~SB%s~SN with ~SB%s~SN follower-backs" % (len(self.twitter_friend_ids), len(following), followers))
logging.user(user, "~BM~FRTwitter import: %s users, now following ~SB%s~SN with ~SB%s~SN follower-backs" % (len(self.twitter_friend_ids), len(following), followers))
return following

View file

@ -122,6 +122,7 @@ stylesheets:
bookmarklet:
- media/css/bookmarklet/reset.css
- media/css/modals.css
- media/css/bookmarklet.css
blurblog:
- media/css/jquery.tipsy.css
- media/css/social/social_page.css

62
media/css/bookmarklet.css Normal file
View file

@ -0,0 +1,62 @@
/* ========== */
/* = Resets = */
/* ========== */
.NB-modal p,
.NB-modal ol,
.NB-modal ul,
.NB-modal li,
.NB-modal h1,
.NB-modal h2,
.NB-modal h3,
.NB-modal h4,
.NB-modal h5,
.NB-modal h6 {
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif !important;
letter-spacing: normal !important;
line-height: 16px !important;
margin: 12px 0;
padding: 0;
color: #202020;
}
.NB-modal p,
.NB-modal ol,
.NB-modal ul,
.NB-modal li,
.NB-modal #readability-content {
font-size: 12px !important;
}
.NB-modal h1,
.NB-modal h2,
.NB-modal h3,
.NB-modal h4,
.NB-modal h5,
.NB-modal h6 {
font-weight: bold;
}
.NB-modal h1 {
font-size: 24px !important;
margin: 30px 0 24px !important;
}
.NB-modal h2 {
font-size: 18px !important;
margin: 24px 0 18px !important;
}
.NB-modal h3 {
font-size: 15px !important;
margin: 18px 0 12px !important;
}
.NB-modal h4 {
font-size: 12px !important;
margin: 12px 0 12px !important;
}
.NB-modal h5 {
font-size: 11px !important;
margin: 12px 0 12px !important;
}
.NB-modal h6 {
font-size: 10px !important;
margin: 12px 0 12px !important;
}

View file

@ -1078,6 +1078,7 @@ window.readability = {
// Remove style attribute(s) :
if(cur.className !== "readability-styled") {
cur.removeAttribute("style");
cur.removeAttribute("class");
}
readability.cleanStyles( cur );
}

View file

@ -179,7 +179,7 @@ TEST_DATABASE_NAME = 'newsblur_test'
ROOT_URLCONF = 'urls'
INTERNAL_IPS = ('127.0.0.1',)
LOGGING_LOG_SQL = True
APPEND_SLASH = True
APPEND_SLASH = False
SOUTH_TESTS_MIGRATE = False
SESSION_ENGINE = "django.contrib.sessions.backends.db"
TEST_RUNNER = "utils.testrunner.TestRunner"

View file

@ -5,7 +5,7 @@
{% include_bookmarklet_js %}
NEWSBLUR.BookmarkletModal = function(options) {
NEWSBLUR.Bookmarklet = function(options) {
var defaults = {};
this.token = "{{ token }}";
@ -25,7 +25,7 @@
{% endif %}
};
NEWSBLUR.BookmarkletModal.prototype = {
NEWSBLUR.Bookmarklet.prototype = {
fix_title: function() {
var d = document;
@ -35,6 +35,7 @@
close: function() {
this.active = false;
$('body').css('overflow', 'scroll');
},
runner: function() {
@ -65,9 +66,14 @@
attach_css: function() {
var css = "{% include_bookmarklet_css %}";
var style = '<style>' + css + '</style>';
if ($('head').length) $('head').append(style);
else $('body').append(style);
var style = '<style id="newsblur_bookmarklet_css">' + css + '</style>';
if ($('#newsblur_bookmarklet_css').length) {
$('#newsblur_bookmarklet_css').replaceWith(style);
} else if ($('head').length) {
$('head').append(style);
} else {
$('body').append(style);
}
},
alert: function(message) {
@ -183,6 +189,8 @@
$('.NB-modal-holder').empty().remove();
}
});
$('body').css('overflow', 'hidden');
},
save: function() {
@ -293,10 +301,10 @@
};
if (NEWSBLUR.bookmarklet_modal && NEWSBLUR.bookmarklet_modal.active) {
NEWSBLUR.bookmarklet_modal.fix_title();
if (NEWSBLUR.bookmarklet && NEWSBLUR.bookmarklet.active) {
NEWSBLUR.bookmarklet.fix_title();
return;
}
NEWSBLUR.bookmarklet_modal = new NEWSBLUR.BookmarkletModal();
NEWSBLUR.bookmarklet = new NEWSBLUR.Bookmarklet();
})();