Merge branch 'master' into dejal

This commit is contained in:
David Sinclair 2022-01-31 19:52:38 -08:00
commit 359ea72ef7
8 changed files with 167 additions and 12 deletions

View file

@ -14,12 +14,12 @@
"media/ios": true,
"**/*.map": true,
"ansible/playbooks/*/*": true,
"archive/*": true,
// "archive/*": true,
"logs/*": true,
"static/*": true,
// "static/*": true,
"media/fonts": true,
"static/*.css": true,
"static/*.js": true,
"static/js/*.*.js": true,
"blog/.jekyll-cache": true,
"blog/_site": true,
"docker/volumes": true,

View file

@ -217,6 +217,10 @@ def check_share_on_site(request, token):
logging.user(request.user, "~FBFinding feed (check_share_on_site): %s" % rss_url)
feed = Feed.get_feed_from_url(rss_url, create=False, fetch=False)
if not feed:
rss_url = urllib.parse.urljoin(story_url, rss_url)
logging.user(request.user, "~FBFinding feed (check_share_on_site): %s" % rss_url)
feed = Feed.get_feed_from_url(rss_url, create=False, fetch=False)
if not feed:
logging.user(request.user, "~FBFinding feed (check_share_on_site): %s" % story_url)
feed = Feed.get_feed_from_url(story_url, create=False, fetch=False)

110
media/css/vendor/jquery.tagit.css vendored Executable file
View file

@ -0,0 +1,110 @@
ul.tagit {
border-style: solid;
border-width: 1px;
border-color: #C6C6C6;
background: inherit;
margin-left: inherit; /* usually we don't want the regular ul margins. */
margin-right: inherit;
padding: 5px 5px 0;
overflow: hidden;
}
ul.tagit li.tagit-choice {
display: block;
margin: 2px 5px 2px 0;
cursor: pointer;
position: relative;
float: left;
font-weight: normal;
font-size: 9px;
border-radius: 4px;
line-height: 14px;
padding: 1px 16px 2px 5px;
margin: 0 4px 4px 0;
background: none;
background-color: rgba(0, 0, 0, .1);
color: #959B8B;
/* text-shadow: 0 1px 0 rgba(255, 255, 255, .5);*/
border: 1px solid transparent;
border-color: rgba(255, 255, 255, .3) transparent rgba(0, 0, 0, .1);
}
ul.tagit li.tagit-new {
padding: 0;
margin: 0;
list-style: none;
}
ul.tagit li.tagit-choice a.tagit-label {
text-decoration: none;
}
ul.tagit li.tagit-choice .tagit-close {
cursor: pointer;
position: absolute;
right: .1em;
top: 50%;
margin-top: -8px;
line-height: 17px;
}
/* used for some custom themes that don't need image icons */
ul.tagit li.tagit-choice .tagit-close .text-icon {
display: none;
}
ul.tagit li.tagit-choice a.tagit-close {
text-decoration: none;
}
ul.tagit li.tagit-choice .tagit-close {
right: .4em;
}
ul.tagit li.tagit-choice .ui-icon {
display: none;
}
ul.tagit li.tagit-choice .tagit-close .text-icon {
display: inline;
font-family: arial, sans-serif;
font-size: 16px;
line-height: 16px;
color: #777;
}
ul.tagit li.tagit-choice:hover, ul.tagit li.tagit-choice.remove {
background-color: #EDADAF;
border-color: #D6565B;
color: white;
}
ul.tagit li.tagit-choice:active {
background-color: #E6888D;
border-color: #CA404A;
color: white;
}
ul.tagit li:hover a.tagit-close .text-icon {
color: #722;
}
ul.tagit input[type="text"] {
color: #333333;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-size: 11px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
border: none;
padding: 0 1px 5px 1px;
width: inherit;
background-color: inherit;
outline: none;
}
ul.tagit li.tagit-choice input {
display: block;
float: left;
margin: 2px 5px 2px 0;
}

View file

@ -1 +1 @@
var $ = jQuery = jQuery.noConflict(true);
window.NB_$ = jQuery = jQuery.noConflict(true);

View file

@ -27,7 +27,7 @@ DEBUG = True
# `./manage.py collectstatic` first. Turn this on for development so you can see
# changes in your JS/CSS.
DEBUG_ASSETS = False # Make sure to run `./manage.py collectstatic` first
# DEBUG_ASSETS = True
DEBUG_ASSETS = True
# DEBUG_QUERIES controls the output of the database query logs. Can be rather verbose
# but is useful to catch slow running queries. A summary is also useful in cutting

View file

@ -3,9 +3,11 @@
(function() {
window.NEWSBLUR = window.NEWSBLUR || {};
var exports = undefined;
{% include_javascripts "bookmarklet" %}
{% include_javascripts_raw "bookmarklet" %}
var $ = window.NB_$;
console.log('jquery', $, window.NB_$);
NEWSBLUR.Bookmarklet = function(options) {
var defaults = {};
@ -473,6 +475,7 @@
$.make('img', { src: 'data:image/png;charset=utf-8;base64,' + this.images['accept_image'] }),
'Saved'
]));
this.pre_share_check_story();
setTimeout(function() {
// $.modal.close();
}, 2000);
@ -634,7 +637,7 @@
},
attach_css: function() {
var css = '{% include_stylesheets "bookmarklet" %}';
var css = "{% include_stylesheets_raw "bookmarklet" %}";
var style = '<style id="newsblur_bookmarklet_css">' + css + '</style>';
if ($('#newsblur_bookmarklet_css').length) {
$('#newsblur_bookmarklet_css').replaceWith(style);

View file

@ -8,14 +8,14 @@ from pipeline.storage import PipelineManifestStorage
class PipelineStorage(PipelineManifestStorage):
def url(self, *args, **kwargs):
if settings.DEBUG_ASSETS:
print(f"Pre-Pipeline storage: {args} {kwargs}")
# print(f"Pre-Pipeline storage: {args} {kwargs}")
kwargs['name'] = re.sub(r'\.[a-f0-9]{12}\.(css|js)$', r'.\1', args[0])
args = args[1:]
url = super().url(*args, **kwargs)
if settings.DEBUG_ASSETS:
url = url.replace(settings.STATIC_URL, settings.MEDIA_URL)
url = re.sub(r'\.[a-f0-9]{12}\.(css|js)$', r'.\1', url)
print(f"Pipeline storage: {args} {kwargs} {url}")
# print(f"Pipeline storage: {args} {kwargs} {url}")
return url
class GzipPipelineStorage(GZIPMixin, PipelineManifestStorage):

View file

@ -1,3 +1,5 @@
import os
import re
import struct
from django.contrib.sites.models import Site
from django.conf import settings
@ -9,6 +11,7 @@ from vendor.timezones.utilities import localtime_for_timezone
from utils.user_functions import get_user
from django.utils.safestring import mark_safe
from pipeline.templatetags.pipeline import stylesheet, javascript
from pipeline.templatetags.pipeline import JavascriptNode, StylesheetNode
register = template.Library()
@ -219,7 +222,42 @@ def include_javascripts(parser, token):
return javascript(parser, token)
# asset_type = 'javascripts'
# return mark_safe(settings.JAMMIT.render_tags(asset_type, asset_package))
class RawJSNode(JavascriptNode):
def render(self, context):
output = super(RawJSNode, self).render(context)
path = re.search(r"src=\"/(.*?)\"", output)
assert path
filename = path.group(1)
abs_filename = os.path.join(settings.NEWSBLUR_DIR, filename)
f = open(abs_filename, 'r')
output = f.read()
return output
@register.tag
def include_javascripts_raw(parser, token):
"""Prints out the JS code found in the static asset packages."""
tag_name, name = token.split_contents()
scripts = RawJSNode(name)
return scripts
class RawStylesheetNode(StylesheetNode):
def render(self, context):
output = super(RawStylesheetNode, self).render(context)
path = re.search(r"href=\"/(.*?)\"", output)
assert path
filename = path.group(1)
abs_filename = os.path.join(settings.NEWSBLUR_DIR, filename)
f = open(abs_filename, 'r')
output = f.read().replace('"', '\\"').replace('\n', '')
return output
@register.tag
def include_stylesheets_raw(parser, token):
"""Prints out the CSS code found in the static asset packages."""
tag_name, name = token.split_contents()
scripts = RawStylesheetNode(name)
return scripts
@register.tag
def include_stylesheets(parser, token):