Renaming News Blur to Protoread.

This commit is contained in:
Samuel Clay 2010-05-13 11:11:01 -04:00
parent e7fde59174
commit b1ac2147ba
31 changed files with 415 additions and 175 deletions

View file

@ -3,7 +3,7 @@
"pk": 1,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/analyzer/fixtures/brownstoner.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/analyzer/fixtures/brownstoner.xml",
"days_to_trim": 90,
"feed_link": "http://brownstoner.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 1,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/analyzer/fixtures/brownstoner2.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/analyzer/fixtures/brownstoner2.xml",
"days_to_trim": 90,
"feed_link": "http://brownstoner.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 4,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/analyzer/fixtures/gothamist1.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/analyzer/fixtures/gothamist1.xml",
"days_to_trim": 90,
"feed_link": "http://gothamist.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 4,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/analyzer/fixtures/gothamist2.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/analyzer/fixtures/gothamist2.xml",
"days_to_trim": 90,
"feed_link": "http://gothamist.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 1,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/rss_feeds/fixtures/gawker1.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/rss_feeds/fixtures/gawker1.xml",
"days_to_trim": 90,
"feed_link": "http://gawker.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 1,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/rss_feeds/fixtures/gawker2.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/rss_feeds/fixtures/gawker2.xml",
"days_to_trim": 90,
"feed_link": "http://gawker.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 4,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/rss_feeds/fixtures/gothamist_aug_2009_1.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/rss_feeds/fixtures/gothamist_aug_2009_1.xml",
"days_to_trim": 90,
"feed_link": "http://gothamist.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 4,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/rss_feeds/fixtures/gothamist_aug_2009_2.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/rss_feeds/fixtures/gothamist_aug_2009_2.xml",
"days_to_trim": 90,
"feed_link": "http://gothamist.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 5,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/rss_feeds/fixtures/slashdot1.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/rss_feeds/fixtures/slashdot1.xml",
"days_to_trim": 90,
"feed_link": "http://slashdot.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 5,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "%(NEWSBLUR_DIR)s/apps/rss_feeds/fixtures/slashdot2.xml",
"feed_address": "%(PROTOREAD_DIR)s/apps/rss_feeds/fixtures/slashdot2.xml",
"days_to_trim": 90,
"feed_link": "http://slashdot.com",
"num_subscribers": 0,

View file

@ -22,7 +22,7 @@ import datetime
import hashlib
from utils.diff import HTMLDiff
USER_AGENT = 'News Blur v1.0 - newsblur.com'
USER_AGENT = 'Protoread v1.0 - protoread.com'
ENTRY_NEW, ENTRY_UPDATED, ENTRY_SAME, ENTRY_ERR = range(4)
@ -62,7 +62,7 @@ class Feed(models.Model):
def update(self, force=False, feed=None, single_threaded=False):
from utils import feed_fetcher
try:
self.feed_address = self.feed_address % {'NEWSBLUR_DIR': settings.NEWSBLUR_DIR}
self.feed_address = self.feed_address % {'PROTOREAD_DIR': settings.PROTOREAD_DIR}
except:
pass

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd">
<allow-access-from domain="*.newsblur.com" />
<allow-access-from domain="nb.local.host" />
<allow-access-from domain="media.newsblur" />
<allow-access-from domain="*.protoread.com" />
<allow-access-from domain="pr.local.host" />
<allow-access-from domain="media.protoread" />
<site-control permitted-cross-domain-policies="master-only"/>
</cross-domain-policy>

View file

@ -1171,17 +1171,17 @@ form.opml_import_form input {
position: absolute;
bottom: 0;
margin-left: 244px;
background: transparent url('../img/reader/newsblur_logo_small.gif') no-repeat 0 0;
height: 51px;
background: transparent url('../img/reader/protoread_logo.png') no-repeat 0 0;
height: 52px;
right: 250px;
width: 246px;
width: 242px;
}
#NB-splash .NB-splash-image {
margin: 0 auto;
height: 376px;
width: 600px;
background: transparent url('../img/reader/newsblur_splash_image.png') no-repeat 0 0;
background: transparent url('../img/reader/protoread_splash_image.png') no-repeat 0 0;
}
#NB-splash .NB-splash-links {

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -71,9 +71,9 @@
ajaxFn.xhrID = xhrID;
o.xhrID = xhrID;
// NEWSBLUR.log(['add', o, o.queue, this.opts, this.requests[xhrID], this.qName]);
// PROTOREAD.log(['add', o, o.queue, this.opts, this.requests[xhrID], this.qName]);
o.beforeSend = function(xhr, opts){
// NEWSBLUR.log(['o.beforeSend', xhr, opts]);
// PROTOREAD.log(['o.beforeSend', xhr, opts]);
var ret = beforeSend.call(this, xhr, opts);
if(ret === false){
that._removeXHR(xhrID);
@ -82,20 +82,20 @@
return ret;
};
o.complete = function(xhr, status){
// NEWSBLUR.log(['o.complete', xhr, status, o]);
// PROTOREAD.log(['o.complete', xhr, status, o]);
that._complete.call(that, this, origCom, xhr, status, xhrID, o);
xhr = null;
};
o.success = function(data, status, xhr){
// NEWSBLUR.log(['o.success', data, status]);
// PROTOREAD.log(['o.success', data, status]);
that._success.call(that, this, origSuc, data, status, xhr, o);
xhr = null;
};
//always add some error callback
o.error = function(ahr, status, errorStr){
// NEWSBLUR.log(['o.error', errorStr, status]);
// PROTOREAD.log(['o.error', errorStr, status]);
ahr = (ahr || {});
var httpStatus = ahr.status,
content = ahr.responseXML || ahr.responseText
@ -115,7 +115,7 @@
}
if(o.queue){
// NEWSBLUR.log(['Queueing', o.queue, this.qName]);
// PROTOREAD.log(['Queueing', o.queue, this.qName]);
$.queue(document, this.qName, ajaxFn);
if(this.inProgress < o.maxRequests){
$.dequeue(document, this.qName);
@ -136,7 +136,7 @@
that._success.call(that, o.context || o, origSuc, cache[id], 'success', {}, o);
}, 0);
} else {
// NEWSBLUR.log(['create_ajax', o, o.complete, o.error, o.success]);
// PROTOREAD.log(['create_ajax', o, o.complete, o.error, o.success]);
that.requests[id] = $.ajax(o);
}
if(that.inProgress === 1){
@ -159,7 +159,7 @@
return ret;
},
_complete: function(context, origFn, xhr, status, xhrID, o){
// NEWSBLUR.log(['complete', o]);
// PROTOREAD.log(['complete', o]);
if(this._isAbort(xhr, o)){
status = 'abort';
o.abort.call(context, xhr, status, o);
@ -178,7 +178,7 @@
xhr = null;
},
_success: function(context, origFn, data, status, xhr, o){
// NEWSBLUR.log(['_success', data, status]);
// PROTOREAD.log(['_success', data, status]);
var that = this;
if(this._isAbort(xhr, o)){
xhr = null;
@ -203,7 +203,7 @@
xhr = null;
},
getData: function(id){
// NEWSBLUR.log(['getData', id]);
// PROTOREAD.log(['getData', id]);
if( id ){
var ret = this.requests[id];
if(!ret && this.opts.queue) {
@ -220,7 +220,7 @@
};
},
abort: function(id){
// NEWSBLUR.log(['abort', id]);
// PROTOREAD.log(['abort', id]);
var xhr;
if(id){
xhr = this.getData(id);
@ -251,7 +251,7 @@
});
},
clear: function(shouldAbort){
// NEWSBLUR.log(['clear', shouldAbort]);
// PROTOREAD.log(['clear', shouldAbort]);
$(document).clearQueue(this.qName);
if(shouldAbort){
this.abort();

241
media/js/jquery.jstorage.js Normal file
View file

@ -0,0 +1,241 @@
/**
* ----------------------------- JSTORAGE -------------------------------------
* Simple local storage wrapper to save data on the browser side, supporting
* all major browsers - IE6+, Firefox2+, Safari4+, Chrome4+ and Opera 10.5+
*
* Copyright (c) 2010 Andris Reinman, andris.reinman@gmail.com
* Project homepage: www.jstorage.info
*
* Licensed under MIT-style license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* USAGE:
*
* jStorage requires Prototype, MooTools or jQuery! If jQuery is used, then
* jQuery-JSON (http://code.google.com/p/jquery-json/) is also needed.
* (jQuery-JSON needs to be loaded BEFORE jStorage!)
*
* Methods:
*
* -set(key, value)
* $.jStorage.set(key, value) -> saves a value
*
* -get(key[, default])
* value = $.jStorage.get(key [, default]) ->
* retrieves value if key exists, or default if it doesn't
*
* -deleteKey(key)
* $.jStorage.deleteKey(key) -> removes a key from the storage
*
* -flush()
* $.jStorage.flush() -> clears the cache
*
* <value> can be any JSON-able value, including objects and arrays.
*
*/
(function($){
if(!$ || !($.toJSON || Object.toJSON || window.JSON)){
throw new Error("jQuery, MooTools or Prototype needs to be loaded before jStorage!");
}
var
/* This is the object, that holds the cached values */
_storage = {},
/* Actual browser storage (localStorage or globalStorage['domain']) */
_storage_service = {jStorage:"{}"},
/* DOM element for older IE versions, holds userData behavior */
_storage_elm = null,
/* function to encode objects to JSON strings */
json_encode = $.toJSON || Object.toJSON || (window.JSON && (JSON.encode || JSON.stringify)),
/* function to decode objects from JSON strings */
json_decode = $.evalJSON || (window.JSON && (JSON.decode || JSON.parse)) || function(str){
return String(str).evalJSON();
};
////////////////////////// PRIVATE METHODS ////////////////////////
/**
* Initialization function. Detects if the browser supports DOM Storage
* or userData behavior and behaves accordingly.
* @returns undefined
*/
function _init(){
/* Check if browser supports localStorage */
if(window.localStorage){
try {
_storage_service = window.localStorage;
} catch(E0) {/* Firefox fails when touching localStorage and cookies are disabled */}
}
/* Check if browser supports globalStorage */
else if(window.globalStorage){
try {
_storage_service = window.globalStorage[window.location.hostname];
} catch(E1) {/* Firefox fails when touching localStorage and cookies are disabled */}
}
/* Check if browser supports userData behavior */
else {
_storage_elm = document.createElement('link');
if(_storage_elm.addBehavior){
/* Use a DOM element to act as userData storage */
_storage_elm.style.behavior = 'url(#default#userData)';
/* userData element needs to be inserted into the DOM! */
document.getElementsByTagName('head')[0].appendChild(_storage_elm);
_storage_elm.load("jStorage");
var data = "{}";
try{
data = _storage_elm.getAttribute("jStorage");
}catch(E2){}
_storage_service.jStorage = data;
}else{
_storage_elm = null;
return;
}
}
/* if jStorage string is retrieved, then decode it */
if(_storage_service.jStorage){
try{
_storage = json_decode(_storage_service.jStorage);
}catch(E3){_storage_service.jStorage = "{}";}
}else{
_storage_service.jStorage = "{}";
}
}
/**
* This functions provides the "save" mechanism to store the jStorage object
* @returns undefined
*/
function _save(){
try{
_storage_service.jStorage = json_encode(_storage);
// If userData is used as the storage engine, additional
if(_storage_elm) {
_storage_elm.setAttribute("jStorage",_storage_service.jStorage);
_storage_elm.save("jStorage");
}
}catch(E4){/* probably cache is full, nothing is saved this way*/}
}
/**
* Function checks if a key is set and is string or numberic
*/
function _checkKey(key){
if(!key || (typeof key != "string" && typeof key != "number")){
throw new TypeError('Key name must be string or numeric');
}
return true;
}
////////////////////////// PUBLIC INTERFACE /////////////////////////
$.jStorage = {
/* Version number */
version: "0.1.3",
/**
* Sets a key's value.
*
* @param {String} key - Key to set. If this value is not set or not
* a string an exception is raised.
* @param value - Value to set. This can be any value that is JSON
* compatible (Numbers, Strings, Objects etc.).
* @returns the used value
*/
set: function(key, value){
_checkKey(key);
_storage[key] = value;
_save();
return value;
},
/**
* Looks up a key in cache
*
* @param {String} key - Key to look up.
* @param {mixed} def - Default value to return, if key didn't exist.
* @returns the key value, default value or <null>
*/
get: function(key, def){
_checkKey(key);
if(key in _storage){
return _storage[key];
}
return typeof(def) == 'undefined' ? null : def;
},
/**
* Deletes a key from cache.
*
* @param {String} key - Key to delete.
* @returns true if key existed or false if it didn't
*/
deleteKey: function(key){
_checkKey(key);
if(key in _storage){
delete _storage[key];
_save();
return true;
}
return false;
},
/**
* Deletes everything in cache.
*
* @returns true
*/
flush: function(){
_storage = {};
_save();
/*
* Just to be sure - andris9/jStorage#3
*/
if (window.localStorage){
try{
localStorage.clear();
}catch(E5){}
}
return true;
},
/**
* Returns a read-only copy of _storage
*
* @returns Object
*/
storageObj: function(){
function F() {}
F.prototype = _storage;
return new F();
}
};
// Initialize jStorage
_init();
})(window.jQuery || window.$);

View file

@ -1,11 +1,11 @@
if (typeof NEWSBLUR == 'undefined') NEWSBLUR = {};
if (typeof NEWSBLUR.Globals == 'undefined') NEWSBLUR.Globals = {};
if (typeof PROTOREAD == 'undefined') PROTOREAD = {};
if (typeof PROTOREAD.Globals == 'undefined') PROTOREAD.Globals = {};
/* ============================= */
/* = Core News Blur Javascript = */
/* = Core Protoread Javascript = */
/* ============================= */
NEWSBLUR.log = function(msg) {
PROTOREAD.log = function(msg) {
try {
if (typeof o == "object")
{
@ -39,7 +39,7 @@ NEWSBLUR.log = function(msg) {
var elemTop = $elem.offset().top - docOffset;
var elemBottom = elemTop + $elem.outerHeight();
// NEWSBLUR.log(['isScrollVisible', docViewTop, docViewBottom, docOffset, elemTop, elemBottom]);
// PROTOREAD.log(['isScrollVisible', docViewTop, docViewBottom, docOffset, elemTop, elemBottom]);
return ((elemTop >= docViewTop) && (elemBottom <= docViewBottom));
}

View file

@ -1,10 +1,10 @@
NEWSBLUR.AssetModel = function() {
PROTOREAD.AssetModel = function() {
var _Reader = null;
return {
reader: function(){
if(!_Reader){
_Reader = new NEWSBLUR.AssetModel.Reader();
_Reader = new PROTOREAD.AssetModel.Reader();
_Reader.init();
} else {
_Reader.init();
@ -13,7 +13,7 @@ NEWSBLUR.AssetModel = function() {
},
preferences: function(){
if(!_Prefs){
_Prefs = new NEWSBLUR.AssetModel.Preferences();
_Prefs = new PROTOREAD.AssetModel.Preferences();
_Prefs.init();
} else {
_Prefs.init();
@ -23,7 +23,7 @@ NEWSBLUR.AssetModel = function() {
};
}();
NEWSBLUR.AssetModel.Reader = function() {
PROTOREAD.AssetModel.Reader = function() {
this.feeds = {};
this.folders = [];
this.stories = {};
@ -31,7 +31,7 @@ NEWSBLUR.AssetModel.Reader = function() {
this.classifiers = {};
};
NEWSBLUR.AssetModel.Reader.prototype = {
PROTOREAD.AssetModel.Reader.prototype = {
init: function() {
this.ajax = {};
@ -60,19 +60,19 @@ NEWSBLUR.AssetModel.Reader.prototype = {
type: 'POST',
dataType: 'json',
beforeSend: function() {
// NEWSBLUR.log(['beforeSend', options]);
// PROTOREAD.log(['beforeSend', options]);
$.isFunction(options['beforeSend']) && options['beforeSend']();
return true;
},
success: function(o) {
// NEWSBLUR.log(['make_request 1', o]);
// PROTOREAD.log(['make_request 1', o]);
if ($.isFunction(callback)) {
callback(o);
}
},
error: function(e) {
// NEWSBLUR.log(['AJAX Error', e]);
// PROTOREAD.log(['AJAX Error', e]);
if ($.isFunction(error_callback)) {
error_callback();
}
@ -93,10 +93,10 @@ NEWSBLUR.AssetModel.Reader.prototype = {
}
}
if (!read && NEWSBLUR.Globals.is_authenticated) {
if (!read && PROTOREAD.Globals.is_authenticated) {
if (!(feed_id in this.read_stories)) { this.read_stories[feed_id] = []; }
this.read_stories[feed_id].push(story_id);
NEWSBLUR.log(['Marking Read', this.read_stories, story_id]);
PROTOREAD.log(['Marking Read', this.read_stories, story_id]);
var story_ids = new Array(this.read_stories[feed_id]);
this.make_request('/reader/mark_story_as_read', {
@ -126,7 +126,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
}
}
NEWSBLUR.log(['Like', opinion, this.stories[s].opinion]);
PROTOREAD.log(['Like', opinion, this.stories[s].opinion]);
if (opinion != 1) {
this.make_request('/reader/mark_story_as_like',
{
@ -147,7 +147,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
break;
}
}
NEWSBLUR.log(['Dislike', opinion, this.stories[s].opinion]);
PROTOREAD.log(['Dislike', opinion, this.stories[s].opinion]);
if (opinion != -1) {
this.make_request('/reader/mark_story_as_dislike',
{
@ -186,7 +186,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
return self.load_feed_precallback(data, feed_id, callback, first_load);
};
// NEWSBLUR.log(['load_feed', feed_id, page, first_load, callback, pre_callback]);
// PROTOREAD.log(['load_feed', feed_id, page, first_load, callback, pre_callback]);
if (feed_id) {
this.make_request('/reader/load_single_feed',
{
@ -202,7 +202,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
},
load_feed_precallback: function(data, feed_id, callback, first_load) {
// NEWSBLUR.log(['pre_callback', data]);
// PROTOREAD.log(['pre_callback', data]);
if (feed_id != this.feed_id) {
this.stories = data.stories;
this.feed_tags = data.feed_tags;
@ -248,7 +248,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
var feed = feeds[f];
for (var k in feed) {
if (self.feeds[f][k] != feed[k]) {
// NEWSBLUR.log(['New Feed', self.feeds[f][k], feed[k], f, k]);
// PROTOREAD.log(['New Feed', self.feeds[f][k], feed[k], f, k]);
self.feeds[f][k] = feed[k];
if (!(f in updated_feeds)) {
updated_feeds.push(f);
@ -260,7 +260,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
callback(updated_feeds);
};
if (NEWSBLUR.Globals.is_authenticated) {
if (PROTOREAD.Globals.is_authenticated) {
this.make_request('/reader/refresh_feeds', {}, pre_callback);
}
},
@ -269,11 +269,11 @@ NEWSBLUR.AssetModel.Reader.prototype = {
var self = this;
var pre_callback = function(data) {
// NEWSBLUR.log(['refresh_feed pre_callback', data]);
// PROTOREAD.log(['refresh_feed pre_callback', data]);
self.load_feed_precallback(data, feed_id, callback);
};
// NEWSBLUR.log(['refresh_feed', feed_id, page, first_load, callback, pre_callback]);
// PROTOREAD.log(['refresh_feed', feed_id, page, first_load, callback, pre_callback]);
if (feed_id) {
this.make_request('/reader/load_single_feed',
{
@ -370,12 +370,12 @@ NEWSBLUR.AssetModel.Reader.prototype = {
NEWSBLUR.AssetModel.Preferences = function() {
PROTOREAD.AssetModel.Preferences = function() {
this.feeds = {};
this.stories = {};
};
NEWSBLUR.AssetModel.Preferences.prototype = {
PROTOREAD.AssetModel.Preferences.prototype = {
init: function() {
return;

View file

@ -1,6 +1,6 @@
(function($) {
NEWSBLUR.Reader = function() {
PROTOREAD.Reader = function() {
var self = this;
this.$feed_list = $('#feed_list');
this.$story_titles = $('#story_titles');
@ -10,7 +10,7 @@
this.$story_iframe = $('.NB-feed-frame');
this.$intelligence_slider = $('.NB-intelligence-slider');
this.model = NEWSBLUR.AssetModel.reader();
this.model = PROTOREAD.AssetModel.reader();
this.options = {};
this.google_favicon_url = 'http://www.google.com/s2/favicons?domain_url=';
this.story_view = 'page';
@ -43,14 +43,14 @@
this.setup_feed_refresh();
};
NEWSBLUR.Reader.prototype = {
PROTOREAD.Reader.prototype = {
// =================
// = Node Creation =
// =================
make_story_title: function(story) {
var unread_view = NEWSBLUR.Globals.unread_view;
var unread_view = PROTOREAD.Globals.unread_view;
var read = story.read_status
? 'read'
: '';
@ -361,7 +361,7 @@
navigate_story_titles_to_story: function(story) {
var $next_story = this.find_story_in_story_titles(story);
if ($next_story && $next_story.length && $next_story.is(':visible') && !$next_story.hasClass('selected')) {
// NEWSBLUR.log(['navigate_story_titles_to_story', story, $next_story]);
// PROTOREAD.log(['navigate_story_titles_to_story', story, $next_story]);
this.push_current_story_on_history();
this.scroll_story_titles_to_show_selected_story_title($next_story);
@ -376,7 +376,7 @@
if (direction == -1) {
dir = '-';
}
// NEWSBLUR.log(['page_in_story', this.$story_pane, direction, page_height, scroll_height]);
// PROTOREAD.log(['page_in_story', this.$story_pane, direction, page_height, scroll_height]);
if (this.story_view == 'page') {
this.$story_iframe.scrollTo({top:dir+'='+scroll_height, left:'+=0'}, 150);
} else if (this.story_view == 'feed' || this.story_view == 'story') {
@ -408,7 +408,7 @@
var $feed_list = this.$feed_list.empty();
var folders = this.model.folders;
var feeds = this.model.feeds;
// NEWSBLUR.log(['Making feeds', {'folders': folders, 'feeds': feeds}]);
// PROTOREAD.log(['Making feeds', {'folders': folders, 'feeds': feeds}]);
$('#story_taskbar').css({'display': 'block'});
@ -585,7 +585,7 @@
this.show_feedbar_loading();
this.make_content_pane_feed_counter(feed_id);
this.switch_taskbar_view(this.story_view);
// NEWSBLUR.log(['open_feed', this.flags, this.active_feed, feed_id]);
// PROTOREAD.log(['open_feed', this.flags, this.active_feed, feed_id]);
this.model.load_feed(feed_id, 0, true, $.rescope(this.post_open_feed, this));
this.load_iframe(feed_id);
this.flags['opening_feed'] = false;
@ -607,7 +607,7 @@
}
if (this.active_feed == feed_id) {
// NEWSBLUR.log(['post_open_feed', data.stories, this.flags]);
// PROTOREAD.log(['post_open_feed', data.stories, this.flags]);
this.flags['feed_view_positions_calculated'] = false;
this.story_titles_clear_loading_endbar();
this.create_story_titles(stories);
@ -656,7 +656,7 @@
}
$story_titles.append($story_title);
}
// NEWSBLUR.log(['create_story_titles', stories]);
// PROTOREAD.log(['create_story_titles', stories]);
if (!stories || stories.length == 0) {
var $end_stories_line = $.make('div', {
className: 'NB-story-titles-end-stories-line'
@ -681,7 +681,7 @@
make_story_feed_entries: function(stories, first_load, refresh_load) {
var $feed_view = this.$feed_view;
var self = this;
var unread_view = NEWSBLUR.Globals.unread_view;
var unread_view = PROTOREAD.Globals.unread_view;
var $stories;
if (first_load) {
@ -734,7 +734,7 @@
} else {
(function($story, story, image_count) {
$('img', $story).load(function() {
// NEWSBLUR.log(['Loaded image', $story, story, image_count]);
// PROTOREAD.log(['Loaded image', $story, story, image_count]);
if (image_count == 1) {
self.flags.feed_view_images_loaded[story.id] = true;
} else {
@ -763,9 +763,9 @@
var story = stories[story_index];
var $story = self.cache.feed_view_stories[story.id];
// NEWSBLUR.log(['Appending $story', $story, self.flags.feed_view_images_loaded[story.id]]);
// PROTOREAD.log(['Appending $story', $story, self.flags.feed_view_images_loaded[story.id]]);
if (self.flags.feed_view_images_loaded[story.id]) {
// NEWSBLUR.log(['Feed view story pre-loaded', $('img', $story).length + " images", $story, story_index]);
// PROTOREAD.log(['Feed view story pre-loaded', $('img', $story).length + " images", $story, story_index]);
self.determine_feed_view_story_position($story, story);
self.process_stories_location_in_feed_view(story_index+1);
} else {
@ -773,22 +773,22 @@
(function($story, story, story_index) {
// In case the images don't load, move on to the next story
var story_load = setTimeout(function() {
// NEWSBLUR.log(['Feed view story did not load in time', $('img', $story).length + " images", $story, story_index]);
// PROTOREAD.log(['Feed view story did not load in time', $('img', $story).length + " images", $story, story_index]);
story_load = false;
self.determine_feed_view_story_position($story, story);
self.process_stories_location_in_feed_view(story_index+1);
}, 2000);
// NEWSBLUR.log(['Feed view story not loaded', $('img', $story).length + " images", $story, story_index]);
// PROTOREAD.log(['Feed view story not loaded', $('img', $story).length + " images", $story, story_index]);
// Load each image, loading next story on last image
var recheck = function() {
if (self.flags.feed_view_images_loaded[story.id] && story_load) {
// NEWSBLUR.log(['Feed view story finally loaded', $('img', $story).length + " images", $story, story_index]);
// PROTOREAD.log(['Feed view story finally loaded', $('img', $story).length + " images", $story, story_index]);
clearTimeout(story_load);
self.determine_feed_view_story_position($story, story);
self.process_stories_location_in_feed_view(story_index+1);
} else if (story_load) {
// NEWSBLUR.log(['Feed view story loading...', $('img', $story).length + " images", $story, story_index]);
// PROTOREAD.log(['Feed view story loading...', $('img', $story).length + " images", $story, story_index]);
setTimeout(recheck, 200);
}
};
@ -799,10 +799,10 @@
}
} else if (stories[story_index]
&& stories[story_index]['story_feed_id'] != this.active_feed) {
NEWSBLUR.log(['Switched off feed early']);
PROTOREAD.log(['Switched off feed early']);
} else {
self.flags['feed_view_positions_calculated'] = true;
NEWSBLUR.log(['Feed view entirely loaded', stories.length + " stories"]);
PROTOREAD.log(['Feed view entirely loaded', stories.length + " stories"]);
var $feed_view = this.$feed_view;
var $stories = $('.NB-feed-stories', $feed_view);
var $endbar = $.make('div', { className: 'NB-feed-story-endbar' });
@ -818,7 +818,7 @@
this.cache.feed_view_story_positions[position] = story;
this.cache.feed_view_story_positions_keys.push(position);
this.cache.feed_view_story_positions_keys.sort(function(a,b) {return a>b;});
// NEWSBLUR.log(['Positioning story', position, $story, story, this.cache.feed_view_story_positions_keys]);
// PROTOREAD.log(['Positioning story', position, $story, story, this.cache.feed_view_story_positions_keys]);
}
},
@ -862,20 +862,20 @@
if (self.iframe_scroll
&& self.flags.iframe_scroll_snap_back_prepared
&& $story_iframe.contents().scrollTop() == 0) {
NEWSBLUR.log(['Snap back, loaded, scroll', self.iframe_scroll]);
PROTOREAD.log(['Snap back, loaded, scroll', self.iframe_scroll]);
$story_iframe.contents().scrollTop(self.iframe_scroll);
self.flags.iframe_scroll_snap_back_prepared = false;
}
});
}, 50);
// NEWSBLUR.log(['iFrame domain', $story_iframe.attr('src').indexOf('/reader/load_feed_page?feed_id='+feed_id), $story_iframe.attr('src')]);
// PROTOREAD.log(['iFrame domain', $story_iframe.attr('src').indexOf('/reader/load_feed_page?feed_id='+feed_id), $story_iframe.attr('src')]);
if ($story_iframe.attr('src').indexOf('/reader/load_feed_page?feed_id='+feed_id) != -1) {
var iframe_link_attacher = function() {
var num_links = $story_iframe.contents().find('a').length;
// NEWSBLUR.log(['Finding links', self.iframe_link_attacher_num_links, num_links]);
// PROTOREAD.log(['Finding links', self.iframe_link_attacher_num_links, num_links]);
if (self.iframe_link_attacher_num_links != num_links) {
// NEWSBLUR.log(['Found new links', num_links, self.iframe_link_attacher_num_links]);
// PROTOREAD.log(['Found new links', num_links, self.iframe_link_attacher_num_links]);
self.iframe_link_attacher_num_links = num_links;
$story_iframe.contents().find('a')
.unbind('click.NB-taskbar')
@ -909,7 +909,7 @@
e.preventDefault();
var $footnote = $('a[name='+href.substr(1)+'], [id='+href.substr(1)+']',
$story_iframe.contents());
// NEWSBLUR.log(['Footnote', $footnote, href, href.substr(1)]);
// PROTOREAD.log(['Footnote', $footnote, href, href.substr(1)]);
$story_iframe.contents().scrollTo($footnote, 600, {
axis: 'y',
easing: 'easeInOutQuint',
@ -1042,7 +1042,7 @@
open_feed_intelligence_modal: function(score) {
var feed_id = this.active_feed;
NEWSBLUR.classifier = new NEWSBLUR.ReaderClassifierFeed(feed_id, score);
PROTOREAD.classifier = new PROTOREAD.ReaderClassifierFeed(feed_id, score);
},
// ===================
@ -1053,7 +1053,7 @@
var self = this;
var $story_pane = this.$story_pane;
// NEWSBLUR.log(['$button', $button, this.flags['page_view_showing_feed_view'], $button.hasClass('NB-active'), story_not_found]);
// PROTOREAD.log(['$button', $button, this.flags['page_view_showing_feed_view'], $button.hasClass('NB-active'), story_not_found]);
var $taskbar_buttons = $('.NB-taskbar .task_button_view');
var $feed_view = this.$feed_view;
var $story_iframe = this.$story_iframe;
@ -1144,7 +1144,7 @@
var $stories = $('.NB-feed-stories', $feed_view);
var story = this.active_story;
// NEWSBLUR.log(['Showing feed view', this.story_view, this.flags['page_view_showing_feed_view']]);
// PROTOREAD.log(['Showing feed view', this.story_view, this.flags['page_view_showing_feed_view']]);
if (this.story_view == 'page' && this.flags['page_view_showing_feed_view']) {
this.show_correct_story_titles_in_unread_view({'animate': false});
} else if (this.story_view == 'feed') {
@ -1193,7 +1193,7 @@
var $iframe_story = this.find_story_in_story_iframe(story);
this.active_story = story;
// NEWSBLUR.log(['Story', story, this.flags.iframe_view_loaded, skip_scrolls]);
// PROTOREAD.log(['Story', story, this.flags.iframe_view_loaded, skip_scrolls]);
this.mark_story_title_as_selected($st);
this.mark_story_as_read(story.id, $st);
@ -1229,7 +1229,7 @@
this.show_correct_stories_in_page_and_feed_view();
}
// NEWSBLUR.log(['Opening story', feed_position, iframe_position, feed_position in this.cache.feed_view_story_positions_keys, iframe_position in this.cache.iframe_story_positions_keys]);
// PROTOREAD.log(['Opening story', feed_position, iframe_position, feed_position in this.cache.feed_view_story_positions_keys, iframe_position in this.cache.iframe_story_positions_keys]);
// if (feed_position && !(feed_position in this.cache.feed_view_story_positions_keys)) {
// this.process_stories_location_in_feed_view(0, true);
// }
@ -1239,7 +1239,7 @@
},
switch_to_correct_view: function(found_story_in_page) {
// NEWSBLUR.log(['Found story', found_story_in_page, this.story_view, this.flags.iframe_view_loaded, this.flags['page_view_showing_feed_view']]);
// PROTOREAD.log(['Found story', found_story_in_page, this.story_view, this.flags.iframe_view_loaded, this.flags['page_view_showing_feed_view']]);
if (found_story_in_page === false) {
// Story not found, show in feed view with link to page view
if (this.story_view == 'page' && !this.flags['page_view_showing_feed_view']) {
@ -1260,7 +1260,7 @@
var self = this;
var $feed_view = this.$feed_view;
// NEWSBLUR.log(['scroll_to_story_in_story_feed', story, $story]);
// PROTOREAD.log(['scroll_to_story_in_story_feed', story, $story]);
if ($story && $story.length) {
if (this.story_view == 'feed' || this.flags['page_view_showing_feed_view']) {
@ -1332,7 +1332,7 @@
for (var s in stories) {
var story = stories[s];
var $story = this.find_story_in_story_iframe(story, $iframe);
// NEWSBLUR.log(['Pre-fetching', $story, $iframe, story.story_title]);
// PROTOREAD.log(['Pre-fetching', $story, $iframe, story.story_title]);
if (!$story || !$story.length || this.flags['iframe_fetching_story_locations']) break;
}
}
@ -1365,7 +1365,7 @@
if (story && story['story_feed_id'] == this.active_feed) {
var $story = this.find_story_in_story_iframe(story, $iframe);
// NEWSBLUR.log(['Prefetching story', s, story.story_title, $story]);
// PROTOREAD.log(['Prefetching story', s, story.story_title, $story]);
setTimeout(function() {
if ((stories.length-1) >= (s+1)
@ -1379,12 +1379,12 @@
self.fetch_story_locations_in_story_frame(s+1, false, $iframe);
self.flags.iframe_story_locations_fetched = false;
} else {
NEWSBLUR.log(['iFrame view entirely loaded', (s-2) + ' stories', self.cache.iframe_stories]);
PROTOREAD.log(['iFrame view entirely loaded', (s-2) + ' stories', self.cache.iframe_stories]);
self.flags.iframe_story_locations_fetched = true;
}
}, 50);
} else if (story && story['story_feed_id'] != this.active_feed) {
NEWSBLUR.log(['Switched off iframe early']);
PROTOREAD.log(['Switched off iframe early']);
}
},
@ -1403,7 +1403,7 @@
if (node && node.nodeType == 3) {
// if (node.data.indexOf(story.story_title.substr(0, 20)) >= 0) {
// NEWSBLUR.log(['found', {
// PROTOREAD.log(['found', {
// node: node.data.replace(/&nbsp;|[^a-z0-9-]/gi, ''),
// title: title
// }]);
@ -1433,7 +1433,7 @@
$('h1,h2,h3,h4,h5,h6', $iframe).filter(':visible').each(function() {
pos = $(this).text().replace(/&nbsp;|[^a-z0-9-,]/gi, '')
.indexOf(title);
// NEWSBLUR.log(['Search headers', title, pos, $(this), $(this).text()]);
// PROTOREAD.log(['Search headers', title, pos, $(this), $(this).text()]);
if (pos >= 0) {
$stories.push($(this));
return false;
@ -1446,14 +1446,14 @@
$('.post,.postProp,#postContent', $iframe).filter(':visible').each(function() {
pos = $(this).text().replace(/&nbsp;|[^a-z0-9-,]/gi, '')
.indexOf(title);
// NEWSBLUR.log(['Search .post', title, pos, $(this), $(this).text().replace(/&nbsp;|[^a-z0-9-,]/gi, '')]);
// PROTOREAD.log(['Search .post', title, pos, $(this), $(this).text().replace(/&nbsp;|[^a-z0-9-,]/gi, '')]);
if (pos >= 0) {
$stories.push($(this));
return false;
}
});
}
// NEWSBLUR.log(['Found stories', $stories, story.story_title]);
// PROTOREAD.log(['Found stories', $stories, story.story_title]);
var max_size = 0;
var $story;
@ -1474,7 +1474,7 @@
this.cache.iframe_story_positions_keys.push(position);
}
// NEWSBLUR.log(['Found story', $story]);
// PROTOREAD.log(['Found story', $story]);
return $story;
},
@ -1511,7 +1511,7 @@
var $this = $(this);
if ($this.data('story_id') == story.id) {
$story_title = $this;
// NEWSBLUR.log(['Finding story in story titles', $this, story]);
// PROTOREAD.log(['Finding story in story titles', $this, story]);
return false;
}
});
@ -1534,7 +1534,7 @@
var unread_count_positive = feed.ps;
var unread_count_neutral = feed.nt;
var unread_count_negative = feed.ng;
// NEWSBLUR.log(['marked read', unread_count_positive, unread_count_neutral, unread_count_negative, $story_title.is('.NB-story-positive'), $story_title.is('.NB-story-neutral'), $story_title.is('.NB-story-negative')]);
// PROTOREAD.log(['marked read', unread_count_positive, unread_count_neutral, unread_count_negative, $story_title.is('.NB-story-positive'), $story_title.is('.NB-story-neutral'), $story_title.is('.NB-story-negative')]);
if ($story_title.is('.NB-story-positive')) {
var count = Math.max(unread_count_positive-1, 0);
@ -1613,13 +1613,13 @@
mark_story_as_like: function(story_id, $button) {
var feed_id = this.active_feed;
NEWSBLUR.classifier = new NEWSBLUR.ReaderClassifierStory(story_id, feed_id, 1);
PROTOREAD.classifier = new PROTOREAD.ReaderClassifierStory(story_id, feed_id, 1);
},
mark_story_as_dislike: function(story_id, $button) {
var feed_id = this.active_feed;
NEWSBLUR.classifier = new NEWSBLUR.ReaderClassifierStory(story_id, feed_id, -1);
PROTOREAD.classifier = new PROTOREAD.ReaderClassifierStory(story_id, feed_id, -1);
},
// ==========
@ -1761,7 +1761,7 @@
$.targetIs(e, { tagSelector: '#story_titles .story' }, function($t, $p){
e.preventDefault();
e.stopPropagation();
// NEWSBLUR.log(['Story dblclick', $t]);
// PROTOREAD.log(['Story dblclick', $t]);
var story_id = $('.story_id', $t).text();
var story = self.find_story_in_stories(story_id);
self.open_story_link(story, $t);
@ -1769,7 +1769,7 @@
$.targetIs(e, { tagSelector: '#feed_list .feed' }, function($t, $p){
e.preventDefault();
e.stopPropagation();
// NEWSBLUR.log(['Feed dblclick', $('.feed_id', $t), $t]);
// PROTOREAD.log(['Feed dblclick', $('.feed_id', $t), $t]);
var feed_id = $t.data('feed_id');
self.open_feed_link(feed_id, $t);
});
@ -1784,7 +1784,7 @@
var full_height = ($last_story.offset() && $last_story.offset().top) + $last_story.height() - container_offset;
var visible_height = $('#story_titles').height();
var scroll_y = $('#story_titles').scrollTop();
// NEWSBLUR.log(['Story_titles Scroll', full_height, container_offset, visible_height, scroll_y]);
// PROTOREAD.log(['Story_titles Scroll', full_height, container_offset, visible_height, scroll_y]);
if (full_height <= visible_height) {
this.load_page_of_feed_stories();
@ -1799,11 +1799,11 @@
var positions = this.cache.iframe_story_positions_keys;
var closest = this.closest(from_top, positions);
var story = this.cache.iframe_story_positions[positions[closest]];
// NEWSBLUR.log(['Scroll iframe', from_top, closest, positions[closest], this.cache.iframe_story_positions[positions[closest]]]);
// PROTOREAD.log(['Scroll iframe', from_top, closest, positions[closest], this.cache.iframe_story_positions[positions[closest]]]);
this.navigate_story_titles_to_story(story);
this.iframe_scroll = from_top;
this.flags.iframe_scroll_snap_back_prepared = false;
// NEWSBLUR.log(['Setting snap back', this.iframe_scroll]);
// PROTOREAD.log(['Setting snap back', this.iframe_scroll]);
}
},
@ -1830,7 +1830,7 @@
var positions = this.cache.feed_view_story_positions_keys;
var closest = parseInt(this.closest(from_top, positions), 10);
var story = this.cache.feed_view_story_positions[positions[closest]];
// NEWSBLUR.log(['Scroll feed view', from_top, closest, positions[closest], this.cache.feed_view_story_positions_keys, positions, self.cache]);
// PROTOREAD.log(['Scroll feed view', from_top, closest, positions[closest], this.cache.feed_view_story_positions_keys, positions, self.cache]);
this.navigate_story_titles_to_story(story);
}
},
@ -1852,13 +1852,13 @@
clearInterval(this.flags['bouncing_callout']);
NEWSBLUR.add_feed = new NEWSBLUR.ReaderAddFeed();
PROTOREAD.add_feed = new PROTOREAD.ReaderAddFeed();
},
open_manage_feed_modal: function() {
var feed_id = this.active_feed;
NEWSBLUR.manage_feed = new NEWSBLUR.ReaderManageFeed(feed_id);
PROTOREAD.manage_feed = new PROTOREAD.ReaderManageFeed(feed_id);
},
// ================
@ -1868,7 +1868,7 @@
load_intelligence_slider: function() {
var self = this;
var $slider = this.$intelligence_slider;
var unread_view = NEWSBLUR.Globals.unread_view;
var unread_view = PROTOREAD.Globals.unread_view;
this.switch_feed_view_unread_view(unread_view);
@ -1877,7 +1877,7 @@
min: -1,
max: 1,
step: 1,
value: NEWSBLUR.Globals.unread_view,
value: PROTOREAD.Globals.unread_view,
slide: function(e, ui) {
self.switch_feed_view_unread_view(ui.value);
},
@ -1894,7 +1894,7 @@
var unread_view_name = this.get_unread_view_name(unread_view);
var $next_story_button = $('.task_story_next_unread');
NEWSBLUR.Globals.unread_view = unread_view;
PROTOREAD.Globals.unread_view = unread_view;
$feed_list.removeClass('unread_view_positive')
.removeClass('unread_view_neutral')
@ -1922,7 +1922,7 @@
if (!visible_only) {
total = feed.ng + feed.nt + feed.ps;
} else {
var unread_view = NEWSBLUR.Globals.unread_view;
var unread_view = PROTOREAD.Globals.unread_view;
var unread_view_name = this.get_unread_view_name(unread_view);
if (unread_view_name == 'positive') {
total = feed.ps;
@ -1937,7 +1937,7 @@
show_correct_story_titles_in_unread_view: function(options) {
var self = this;
var unread_view = NEWSBLUR.Globals.unread_view;
var unread_view = PROTOREAD.Globals.unread_view;
var $story_titles = this.$story_titles;
var unread_view_name = this.get_unread_view_name(unread_view);
var $stories_show, $stories_hide;
@ -1972,7 +1972,7 @@
if (!this.flags['feed_view_positions_calculated']
|| $stories_show.filter(':visible').length != $stories_show.length
|| $stories_hide.filter(':visible').length != 0) {
// NEWSBLUR.log(['Show/Hide stories', $stories_show.filter(':visible').length, $stories_show.length, $stories_hide.filter(':visible').length, $stories_hide.length]);
// PROTOREAD.log(['Show/Hide stories', $stories_show.filter(':visible').length, $stories_show.length, $stories_hide.filter(':visible').length, $stories_hide.length]);
setTimeout(function() {
if (!self.flags['feed_view_positions_calculated']) {
self.process_stories_location_in_feed_view(0, true);
@ -1981,13 +1981,13 @@
}
}
// NEWSBLUR.log(['Showing correct stories', this.story_view, this.flags['feed_view_positions_calculated'], unread_view_name, $stories_show.length, $stories_hide.length]);
// PROTOREAD.log(['Showing correct stories', this.story_view, this.flags['feed_view_positions_calculated'], unread_view_name, $stories_show.length, $stories_hide.length]);
if (options['animate']) {
$stories_hide.slideUp(500);
$stories_show.slideDown(500);
setTimeout(function() {
var $story = self.find_story_in_story_titles(self.active_story);
// NEWSBLUR.log(['$story', $story]);
// PROTOREAD.log(['$story', $story]);
if ($story && $story.length && $story.is(':visible')) {
var story = self.active_story;
self.active_story = null; // Set is in open_story(), which allows it to scroll.
@ -2074,11 +2074,11 @@
$feed_on_page.replaceWith($feed);
$('.unread_count', $feed).corner('4px');
if (feed_id == this.active_feed) {
NEWSBLUR.log(['UPDATING INLINE', feed.feed_title, $feed, $feed_on_page]);
PROTOREAD.log(['UPDATING INLINE', feed.feed_title, $feed, $feed_on_page]);
var limit = $('.story', this.$story_titles).length;
this.model.refresh_feed(feed_id, $.rescope(this.post_refresh_active_feed, this), limit);
} else {
NEWSBLUR.log(['UPDATING', feed.feed_title, $feed, $feed_on_page]);
PROTOREAD.log(['UPDATING', feed.feed_title, $feed, $feed_on_page]);
}
}
},
@ -2126,7 +2126,7 @@
$new_story = this.make_story_title(story);
$new_story.css({'display': 'none'});
$first_story.before($new_story);
NEWSBLUR.log(['New story', $new_story, $first_story]);
PROTOREAD.log(['New story', $new_story, $first_story]);
}
}
if (new_stories.length) {
@ -2143,7 +2143,7 @@
// ===========
save_profile: function(key, value) {
NEWSBLUR.Globals[key] = value;
PROTOREAD.Globals[key] = value;
},
// ========
@ -2180,7 +2180,7 @@
$(document).ready(function() {
NEWSBLUR.reader = new NEWSBLUR.Reader();
PROTOREAD.reader = new PROTOREAD.Reader();
});

View file

@ -1,13 +1,13 @@
NEWSBLUR.ReaderAddFeed = function(feed_id, score, options) {
PROTOREAD.ReaderAddFeed = function(feed_id, score, options) {
var defaults = {};
this.options = $.extend({}, defaults, options);
this.model = NEWSBLUR.AssetModel.reader();
this.model = PROTOREAD.AssetModel.reader();
this.google_favicon_url = 'http://www.google.com/s2/favicons?domain_url=';
this.runner();
};
NEWSBLUR.ReaderAddFeed.prototype = {
PROTOREAD.ReaderAddFeed.prototype = {
runner: function() {
this.make_modal();
@ -176,7 +176,7 @@ NEWSBLUR.ReaderAddFeed.prototype = {
var $loading = $('.NB-fieldset.NB-add-opml .NB-loading');
$loading.addClass('NB-active');
// NEWSBLUR.log(['Uploading']);
// PROTOREAD.log(['Uploading']);
$.ajaxFileUpload({
url: '/opml/opml_upload',
secureuri: false,
@ -185,13 +185,13 @@ NEWSBLUR.ReaderAddFeed.prototype = {
success: function (data, status)
{
$loading.removeClass('NB-active');
NEWSBLUR.reader.load_feeds();
PROTOREAD.reader.load_feeds();
$.modal.close();
},
error: function (data, status, e)
{
$loading.removeClass('NB-active');
NEWSBLUR.log(['Error', data, status, e]);
PROTOREAD.log(['Error', data, status, e]);
}
});
@ -232,12 +232,12 @@ NEWSBLUR.ReaderAddFeed.prototype = {
},
post_save_add_url: function(e, data) {
NEWSBLUR.log(['Data', data]);
PROTOREAD.log(['Data', data]);
var $loading = $('.NB-loading', '.NB-fieldset.NB-add-add-url');
$loading.removeClass('NB-active');
if (data.code > 0) {
NEWSBLUR.reader.load_feeds();
PROTOREAD.reader.load_feeds();
$.modal.close();
} else {
var $error = $('.NB-error', '.NB-fieldset.NB-add-add-url');
@ -260,12 +260,12 @@ NEWSBLUR.ReaderAddFeed.prototype = {
},
post_save_add_folder: function(e, data) {
NEWSBLUR.log(['Data', data]);
PROTOREAD.log(['Data', data]);
var $loading = $('.NB-loading', '.NB-fieldset.NB-add-add-folder');
$loading.removeClass('NB-active');
if (data.code > 0) {
NEWSBLUR.reader.load_feeds();
PROTOREAD.reader.load_feeds();
$.modal.close();
} else {
var $error = $('.NB-error', '.NB-fieldset.NB-add-add-folder');

View file

@ -1,4 +1,4 @@
NEWSBLUR.ReaderClassifierFeed = function(feed_id, score, options) {
PROTOREAD.ReaderClassifierFeed = function(feed_id, score, options) {
var defaults = {};
this.flags = {
@ -8,13 +8,13 @@ NEWSBLUR.ReaderClassifierFeed = function(feed_id, score, options) {
this.feed_id = feed_id;
this.score = score;
this.options = $.extend({}, defaults, options);
this.model = NEWSBLUR.AssetModel.reader();
this.model = PROTOREAD.AssetModel.reader();
this.google_favicon_url = 'http://www.google.com/s2/favicons?domain_url=';
this.runner_feed();
};
NEWSBLUR.ReaderClassifierStory = function(story_id, feed_id, score, options) {
PROTOREAD.ReaderClassifierStory = function(story_id, feed_id, score, options) {
var defaults = {};
this.flags = {
@ -25,7 +25,7 @@ NEWSBLUR.ReaderClassifierStory = function(story_id, feed_id, score, options) {
this.feed_id = feed_id;
this.score = score;
this.options = $.extend({}, defaults, options);
this.model = NEWSBLUR.AssetModel.reader();
this.model = PROTOREAD.AssetModel.reader();
this.google_favicon_url = 'http://www.google.com/s2/favicons?domain_url=';
this.runner_story();
};
@ -69,7 +69,7 @@ var classifier = {
var feed = this.feed;
var opinion = (this.score == 1 ? 'like_' : 'dislike_');
NEWSBLUR.log(['Make feed', feed, this.feed_authors, this.feed_tags]);
PROTOREAD.log(['Make feed', feed, this.feed_authors, this.feed_tags]);
this.$classifier = $.make('div', { className: 'NB-classifier NB-modal' }, [
this.make_modal_intelligence_slider(),
@ -115,7 +115,7 @@ var classifier = {
var feed = this.feed;
var opinion = (this.score == 1 ? 'like_' : 'dislike_');
NEWSBLUR.log(['Make Story', story, feed]);
PROTOREAD.log(['Make Story', story, feed]);
// HTML entities decoding.
story.story_title = $('<div/>').html(story.story_title).text();
@ -475,11 +475,11 @@ var classifier = {
var story_id = this.story_id;
var data = this.serialize_classifier();
NEWSBLUR.reader.update_opinions(this.$classifier, this.feed_id);
PROTOREAD.reader.update_opinions(this.$classifier, this.feed_id);
$save.text('Saving...').addClass('NB-disabled').attr('disabled', true);
this.model.save_classifier_publisher(data, function() {
NEWSBLUR.reader.force_feed_refresh();
PROTOREAD.reader.force_feed_refresh();
$.modal.close();
});
},
@ -489,16 +489,16 @@ var classifier = {
var story_id = this.story_id;
var data = this.serialize_classifier();
NEWSBLUR.reader.update_opinions(this.$classifier, this.feed_id);
PROTOREAD.reader.update_opinions(this.$classifier, this.feed_id);
$save.text('Saving...').addClass('NB-disabled').attr('disabled', true);
this.model.save_classifier_story(story_id, data, function() {
NEWSBLUR.reader.force_feed_refresh();
PROTOREAD.reader.force_feed_refresh();
$.modal.close();
});
}
};
NEWSBLUR.ReaderClassifierStory.prototype = classifier;
NEWSBLUR.ReaderClassifierFeed.prototype = classifier;
PROTOREAD.ReaderClassifierStory.prototype = classifier;
PROTOREAD.ReaderClassifierFeed.prototype = classifier;

View file

@ -1,8 +1,8 @@
NEWSBLUR.ReaderManageFeed = function(feed_id, options) {
PROTOREAD.ReaderManageFeed = function(feed_id, options) {
var defaults = {};
this.options = $.extend({}, defaults, options);
this.model = NEWSBLUR.AssetModel.reader();
this.model = PROTOREAD.AssetModel.reader();
this.feed_id = feed_id;
this.google_favicon_url = 'http://www.google.com/s2/favicons?domain_url=';
this.counters = {
@ -11,7 +11,7 @@ NEWSBLUR.ReaderManageFeed = function(feed_id, options) {
this.runner();
};
NEWSBLUR.ReaderManageFeed.prototype = {
PROTOREAD.ReaderManageFeed.prototype = {
runner: function() {
this.feeds = this.model.get_feeds();
@ -171,8 +171,8 @@ NEWSBLUR.ReaderManageFeed.prototype = {
if (!$('.NB-classifier', $classifiers).length) {
var $empty_classifier = $.make('div', { className: 'NB-classifier-empty' }, [
'No opinions yet. Use the ',
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL + 'img/reader/thumbs-down.png', className: 'NB-dislike' }),
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL + 'img/reader/thumbs-up.png', className: 'NB-like' }),
$.make('img', { src: PROTOREAD.Globals.MEDIA_URL + 'img/reader/thumbs-down.png', className: 'NB-dislike' }),
$.make('img', { src: PROTOREAD.Globals.MEDIA_URL + 'img/reader/thumbs-up.png', className: 'NB-like' }),
' buttons next to stories.'
]);
$classifiers.append($empty_classifier);
@ -316,11 +316,11 @@ NEWSBLUR.ReaderManageFeed.prototype = {
var $save = $('.NB-modal input[type=submit]');
var data = this.serialize_classifier();
NEWSBLUR.reader.update_opinions(this.$manage, this.feed_id);
PROTOREAD.reader.update_opinions(this.$manage, this.feed_id);
$save.text('Saving...').addClass('NB-disabled').attr('disabled', true);
this.model.save_classifier_publisher(data, function() {
NEWSBLUR.reader.force_feed_refresh();
PROTOREAD.reader.force_feed_refresh();
$.modal.close();
});
},
@ -331,7 +331,7 @@ NEWSBLUR.ReaderManageFeed.prototype = {
var feed_id = this.feed_id;
this.model.delete_publisher(feed_id, function() {
NEWSBLUR.reader.delete_feed(feed_id);
PROTOREAD.reader.delete_feed(feed_id);
$.modal.close();
});
},

View file

@ -7,11 +7,11 @@ import os
# ===========================
CURRENT_DIR = os.path.dirname(__file__)
NEWSBLUR_DIR = CURRENT_DIR
PROTOREAD_DIR = CURRENT_DIR
TEMPLATE_DIRS = (''.join([CURRENT_DIR, '/templates']),)
MEDIA_ROOT = ''.join([CURRENT_DIR, '/media'])
UTILS_ROOT = ''.join([CURRENT_DIR, '/utils'])
LOG_FILE = ''.join([CURRENT_DIR, '/logs/newsblur.log'])
LOG_FILE = ''.join([CURRENT_DIR, '/logs/protoread.log'])
# ==============
# = PYTHONPATH =
@ -45,10 +45,9 @@ SECRET_KEY = '6yx-@2u@v$)-=fqm&tc8lhk3$6d68+c7gd%p$q2@o7b4o8-*fz'
# = Enviornment =
# ===============
PRODUCTION = __file__.find('/home/conesus/newsblur') == 0
STAGING = __file__.find('/home/conesus/stg-newsblur') == 0
DEV_SERVER1 = __file__.find('/Users/conesus/Projects/newsblur') == 0
DEV_SERVER2 = __file__.find('/Users/conesus/newsblur') == 0
PRODUCTION = __file__.find('/home/conesus/protoread') == 0
DEV_SERVER1 = __file__.find('/Users/conesus/Projects/protoread') == 0
DEV_SERVER2 = __file__.find('/Users/conesus/protoread') == 0
DEVELOPMENT = DEV_SERVER1 or DEV_SERVER2
logging.basicConfig(level=logging.INFO,
@ -89,7 +88,7 @@ COMPRESS_JS = {
'source_filenames': (
'js/jquery-1.4.2.js',
'js/jquery.easing.js',
'js/jquery.newsblur.js',
'js/jquery.protoread.js',
'js/jquery.scrollTo.js',
'js/jquery.timers.js',
'js/jquery.corners.js',
@ -108,11 +107,11 @@ COMPRESS_JS = {
'js/jquery.layout.js',
'js/jquery.tinysort.js',
'js/jquery.fieldselection.js',
'js/newsblur/assetmodel.js',
'js/newsblur/reader.js',
'js/newsblur/reader_classifier.js',
'js/newsblur/reader_add_feed.js',
'js/newsblur/reader_manage_feed.js',
'js/protoread/assetmodel.js',
'js/protoread/reader.js',
'js/protoread/reader_classifier.js',
'js/protoread/reader_add_feed.js',
'js/protoread/reader_manage_feed.js',
),
'output_filename': 'js/all-compressed-?.js'
}
@ -157,7 +156,7 @@ DEBUG_TOOLBAR_PANELS = (
# = Miscellaneous Settings =
# ==========================
AUTH_PROFILE_MODULE = 'newsblur.UserProfile'
AUTH_PROFILE_MODULE = 'protoread.UserProfile'
TEST_DATABASE_COLLATION = 'utf8_general_ci'
ROOT_URLCONF = 'urls'
INTERNAL_IPS = ('127.0.0.1',)

View file

@ -1,3 +1,3 @@
<h1>It's a 404!</h1>
<p><a href="{% url index %}">Return to News Blur</a></p>
<p><a href="{% url index %}">Return to Protoread</a></p>

View file

@ -2,4 +2,4 @@
<p>The error has been e-mailed and will hopefully be fixed so you won't have to see this again.</p>
<p><a href="{% url index %}">Return to News Blur</a></p>
<p><a href="{% url index %}">Return to Protoread</a></p>

View file

@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>{% block title %}News Blur{% endblock %}</title>
<title>{% block title %}Protoread{% endblock %}</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<link rel="shortcut icon" HREF="/media/img/favicon.png">
@ -12,8 +12,8 @@
<script type="text/javascript" charset="utf-8">
var NEWSBLUR = {};
NEWSBLUR.Globals = {
var PROTOREAD = {};
PROTOREAD.Globals = {
'is_authenticated': {% if user.is_authenticated %}true{% else %}false{% endif %},
'is_anonymous': {% if user.is_anonymous %}true{% else %}false{% endif %},
'username': "{{ user.username|safe }}",

View file

@ -1,6 +1,6 @@
<script>
NEWSBLUR.Globals = {
PROTOREAD.Globals = {
logged_in: '{{ user }}'
};

View file

@ -2,7 +2,7 @@
{% block content %}
<h1 class="NB-splash-heading">News Blur</h1>
<h1 class="NB-splash-heading">Protoread</h1>
<h2 class="NB-splash-heading">- A feed reader with intelligence.</h2>
<div id="NB-splash">

View file

@ -23,8 +23,8 @@ import socket
# http://feedjack.googlecode.com
VERSION = '0.9'
URL = 'http://www.newsblur.com/'
USER_AGENT = 'News Blur %s - %s' % (VERSION, URL)
URL = 'http://www.protoread.com/'
USER_AGENT = 'Protoread %s - %s' % (VERSION, URL)
SLOWFEED_WARNING = 10
ENTRY_NEW, ENTRY_UPDATED, ENTRY_SAME, ENTRY_ERR = range(4)
FEED_OK, FEED_SAME, FEED_ERRPARSE, FEED_ERRHTTP, FEED_ERREXC = range(5)