2011-01-20 09:57:23 -05:00
NEWSBLUR . ReaderGoodies = function ( options ) {
var defaults = { } ;
this . options = $ . extend ( { } , defaults , options ) ;
this . model = NEWSBLUR . AssetModel . reader ( ) ;
this . runner ( ) ;
} ;
NEWSBLUR . ReaderGoodies . prototype = {
runner : function ( ) {
this . make _modal ( ) ;
this . open _modal ( ) ;
this . $modal . bind ( 'click' , $ . rescope ( this . handle _click , this ) ) ;
} ,
make _modal : function ( ) {
var self = this ;
this . $modal = $ . make ( 'div' , { className : 'NB-modal-goodies NB-modal' } , [
$ . make ( 'h2' , { className : 'NB-modal-title' } , 'Goodies & Extras' ) ,
$ . make ( 'div' , { className : 'NB-goodies-group' } , [
2011-01-22 21:42:58 -05:00
NEWSBLUR . generate _bookmarklet ( ) ,
$ . make ( 'div' , { className : 'NB-goodies-title' } , 'Add Site Bookmarklet' )
2011-02-01 03:35:11 +01:00
] ) ,
2011-02-25 13:07:08 -05:00
$ . make ( 'div' , { className : 'NB-goodies-group NB-modal-submit' } , [
2011-02-01 03:35:11 +01:00
$ . make ( 'a' , {
2011-02-25 13:07:08 -05:00
className : 'NB-goodies-firefox-link NB-modal-submit-button NB-modal-submit-green' ,
2011-02-01 03:35:11 +01:00
href : '#'
2011-02-25 15:20:38 -05:00
} , 'Add to Firefox' ) ,
2011-02-25 13:07:08 -05:00
$ . make ( 'div' , { className : 'NB-goodies-firefox' } ) ,
$ . make ( 'div' , { className : 'NB-goodies-title' } , 'Firefox: Register Newsblur as an RSS reader' )
2011-02-25 14:04:03 -05:00
] ) ,
2011-03-18 00:09:33 -04:00
$ . make ( 'div' , { className : 'NB-goodies-group NB-modal-submit' } , [
$ . make ( 'a' , {
className : 'NB-goodies-chrome-link NB-modal-submit-button NB-modal-submit-green' ,
href : '#'
} , 'Add to Chrome' ) ,
$ . make ( 'div' , { className : 'NB-goodies-chrome' } ) ,
$ . make ( 'div' , { className : 'NB-goodies-title' } , 'Google Chome: NewsBlur Chrome Web App' )
] ) ,
2011-02-25 14:04:03 -05:00
$ . make ( 'div' , { className : 'NB-goodies-group NB-modal-submit' } , [
$ . make ( 'a' , {
className : 'NB-goodies-safari-link NB-modal-submit-button NB-modal-submit-green' ,
href : '#'
2011-02-25 15:20:38 -05:00
} , 'Add to Safari' ) ,
2011-02-25 14:04:03 -05:00
$ . make ( 'div' , { className : 'NB-goodies-safari' } ) ,
2011-03-18 00:00:17 -04:00
$ . make ( 'div' , { className : 'NB-goodies-title' } , 'Safari: Register Newsblur as an RSS reader' ) ,
$ . make ( 'div' , { className : 'NB-goodies-subtitle' } , [
'To use this extension, extract and move the NewsBlur Safari Helper.app ' ,
'to your Applications folder. Then in ' ,
$ . make ( 'b' , 'Safari > Settings > RSS' ) ,
' choose the new NewsBlur Safari Helper.app. Then clicking on the RSS button in ' ,
'Safari will open the feed in NewsBlur. Simple!'
] )
2011-02-25 15:20:38 -05:00
] ) ,
$ . make ( 'div' , { className : 'NB-goodies-group NB-modal-submit' } , [
$ . make ( 'input' , {
className : 'NB-goodies-custom-input' ,
value : 'http://www.newsblur.com/?url=BLOG_URL_GOES_HERE'
} ) ,
$ . make ( 'div' , { className : 'NB-goodies-custom' } ) ,
$ . make ( 'div' , { className : 'NB-goodies-title' } , 'Custom Add Site URL' )
2011-08-07 21:38:09 -07:00
] ) ,
$ . make ( 'div' , { className : 'NB-goodies-group NB-modal-submit' } , [
$ . make ( 'a' , {
className : 'NB-goodies-mobile-link NB-modal-submit-button NB-modal-submit-green' ,
href : 'mailto:samuel@ofbrooklyn.com?subject=iPhone Beta! Yeah!&body=My username is: ' + NEWSBLUR . Globals . username + ', and my iTunes/iPhone UUID is: [http://www.ispeeddial.com/how-to-find-your-iphone-uuid/]'
} , 'Request Beta' ) ,
$ . make ( 'div' , { className : 'NB-goodies-iphone' } ) ,
$ . make ( 'div' , { className : 'NB-goodies-title' } , 'Official NewsBlur iPhone App' )
] ) ,
$ . make ( 'div' , { className : 'NB-goodies-group NB-modal-submit' } , [
$ . make ( 'a' , {
className : 'NB-goodies-mobile-link NB-modal-submit-button NB-modal-submit-green' ,
href : 'https://market.android.com/details?id=bitwrit.Blar'
} , 'View in Android Market' ) ,
$ . make ( 'div' , { className : 'NB-goodies-android' } ) ,
$ . make ( 'div' , { className : 'NB-goodies-title' } , 'Blar: User-Created Android App' )
2011-01-20 09:57:23 -05:00
] )
] ) ;
} ,
open _modal : function ( ) {
var self = this ;
this . $modal . modal ( {
'minWidth' : 600 ,
'maxWidth' : 600 ,
'overlayClose' : true ,
'onOpen' : function ( dialog ) {
dialog . overlay . fadeIn ( 200 , function ( ) {
dialog . container . fadeIn ( 200 ) ;
dialog . data . fadeIn ( 200 ) ;
2011-02-25 15:20:38 -05:00
setTimeout ( function ( ) {
$ ( window ) . resize ( ) ;
} ) ;
2011-01-20 09:57:23 -05:00
} ) ;
} ,
'onShow' : function ( dialog ) {
$ ( '#simplemodal-container' ) . corner ( '6px' ) ;
} ,
'onClose' : function ( dialog ) {
dialog . data . hide ( ) . empty ( ) . remove ( ) ;
dialog . container . hide ( ) . empty ( ) . remove ( ) ;
dialog . overlay . fadeOut ( 200 , function ( ) {
dialog . overlay . empty ( ) . remove ( ) ;
$ . modal . close ( ) ;
} ) ;
$ ( '.NB-modal-holder' ) . empty ( ) . remove ( ) ;
}
} ) ;
} ,
// ===========
// = Actions =
// ===========
handle _click : function ( elem , e ) {
var self = this ;
2011-01-24 09:58:16 -05:00
$ . targetIs ( e , { tagSelector : '.NB-goodies-bookmarklet-button' } , function ( $t , $p ) {
2011-01-20 09:57:23 -05:00
e . preventDefault ( ) ;
2011-01-24 09:58:16 -05:00
alert ( 'Drag this button to your bookmark toolbar.' ) ;
2011-01-20 09:57:23 -05:00
} ) ;
2011-02-01 03:35:11 +01:00
2011-02-25 13:07:08 -05:00
$ . targetIs ( e , { tagSelector : '.NB-goodies-firefox-link' } , function ( $t , $p ) {
2011-02-01 03:35:11 +01:00
e . preventDefault ( ) ;
navigator . registerContentHandler ( "application/vnd.mozilla.maybe.feed" ,
2011-02-25 13:07:08 -05:00
document . location + "?url=%s" ,
2011-02-01 03:35:11 +01:00
"NewsBlur" ) ;
} ) ;
2011-02-25 14:04:03 -05:00
$ . targetIs ( e , { tagSelector : '.NB-goodies-safari-link' } , function ( $t , $p ) {
e . preventDefault ( ) ;
2011-03-17 23:46:59 -04:00
window . location . href = NEWSBLUR . Globals . MEDIA _URL + 'extensions/NewsBlur Safari Helper.app.zip' ;
2011-02-25 14:04:03 -05:00
} ) ;
2011-02-25 15:20:38 -05:00
2011-03-18 00:09:33 -04:00
$ . targetIs ( e , { tagSelector : '.NB-goodies-chrome-link' } , function ( $t , $p ) {
e . preventDefault ( ) ;
window . location . href = 'https://chrome.google.com/webstore/detail/gchdledhagjbhhodjjhiclbnaioljomj' ;
} ) ;
2011-02-25 15:20:38 -05:00
$ . targetIs ( e , { tagSelector : '.NB-goodies-custom-input' } , function ( $t , $p ) {
e . preventDefault ( ) ;
$t . select ( ) ;
} ) ;
2011-01-20 09:57:23 -05:00
}
} ;