@ -296,7 +296,7 @@ if (typeof VMM == 'undefined') {
} ;
// VMM.getJSON(url, the_function);
VMM . getJSON = function ( url , the _function ) {
VMM . getJSON = function ( url , data , callback ) {
if ( typeof ( jQuery ) != 'undefined' ) {
/ * C H E C K F O R I E A N D U S E U s e M i c r o s o f t X D R
@ -307,7 +307,7 @@ if (typeof VMM == 'undefined') {
if ( ie _url . match ( '^http://' ) ) {
//ie_url = ie_url.replace("http://","//");
$ . getJSON ( url , the _function ) ;
$ . getJSON ( url , data ) ;
} else if ( ie _url . match ( '^https://' ) ) {
ie _url = ie _url . replace ( "https://" , "http://" ) ;
var xdr = new XDomainRequest ( ) ;
@ -319,7 +319,9 @@ if (typeof VMM == 'undefined') {
xdr . send ( ) ;
}
} else {
$ . getJSON ( url , the _function ) ;
//$.getJSON(url, data);
return jQuery . getJSON ( url , data , callback ) ;
}
}
@ -1295,11 +1297,11 @@ if (typeof VMM == 'undefined') {
// CREDIT
if ( data . credit != null && data . credit != "" ) {
creditElem = "<div class='credit'>" + data . credit + "</div>" ;
creditElem = "<div class='credit'>" + VMM . Util . linkify _with _twitter ( data . credit , "_blank" ) + "</div>" ;
}
// CAPTION
if ( data . caption != null && data . caption != "" ) {
captionElem = "<div class='caption'>" + data . caption + "</div>" ;
captionElem = "<div class='caption'>" + VMM . Util . linkify _with _twitter ( data . caption , "_blank" ) + "</div>" ;
}
// MEDIA TYPE
@ -1327,7 +1329,7 @@ if (typeof VMM == 'undefined') {
} else if ( m . type == "vimeo" ) {
mediaElem = "<iframe class='media-frame video vimeo' frameborder='0' width='100%' height='100%' src='http://player.vimeo.com/video/" + m . id + "?title=0&byline=0&portrait=0&color=ffffff'></iframe>" ;
} else if ( m . type == "twitter" ) {
mediaElem = "<div class='twitter' id='" + m . id + "'>Loading Tweet</div>" ;
mediaElem = "<div class='twitter' id='" + "twitter_" + m . id + "'>Loading Tweet</div>" ;
//VMM.ExternalAPI.twitter.getHTML(m.id);
trace ( "TWITTER" ) ;
VMM . ExternalAPI . twitter . prettyHTML ( m . id ) ;
@ -1505,16 +1507,9 @@ if (typeof VMM == 'undefined') {
onJSONLoaded : function ( d ) {
trace ( "TWITTER JSON LOADED" ) ;
var id = d . id ;
VMM . attachElement ( "#" + id , VMM . ExternalAPI . twitter . linkify ( d . html ) ) ;
} ,
//somestring = VMM.ExternalAPI.twitter.linkify(d);
linkify : function ( d ) {
return d . replace ( /[@]+[A-Za-z0-9-_]+/g , function ( u ) {
var username = u . replace ( "@" , "" ) ;
return u . link ( "http://twitter.com/" + username ) ;
} ) ;
VMM . attachElement ( "#" + id , VMM . Util . linkify _with _twitter ( d . html ) ) ;
} ,
// VMM.ExternalAPI.twitter.parseTwitterDate(date);
parseTwitterDate : function ( d ) {
var date = new Date ( Date . parse ( d ) ) ;
@ -1561,10 +1556,7 @@ if (typeof VMM == 'undefined') {
/ * F O R M A T R E S P O N S E
=== === === === === === === === === === === === === === === === == * /
var twit = "<div class='twitter'><blockquote><p>" ;
var td = VMM . Util . linkify ( d . text ) ;
td = td . replace ( /(@([\w]+))/g , "<a href='http://twitter.com/$2'>$1</a>" ) ;
td = td . replace ( /(#([\w]+))/g , "<a href='http://twitter.com/#search?q=%23$2'>$1</a>" ) ;
//twit += VMM.Util.linkify(d.text);
var td = VMM . Util . linkify _with _twitter ( d . text , "_blank" ) ;
twit += td ;
twit += "</p>" ;
@ -1582,7 +1574,10 @@ if (typeof VMM == 'undefined') {
var the _tweets = { tweetdata : tweetArray }
VMM . fireEvent ( global , "TWEETSLOADED" , the _tweets ) ;
}
} ) ;
} )
. success ( function ( ) { trace ( "second success" ) ; } )
. error ( function ( ) { trace ( "error" ) ; } )
. complete ( function ( ) { trace ( "complete" ) ; } ) ;
}
@ -1591,8 +1586,6 @@ if (typeof VMM == 'undefined') {
// VMM.ExternalAPI.twitter.getTweetSearch(search string);
getTweetSearch : function ( tweets , number _of _tweets ) {
var _number _of _tweets = 40 ;
if ( number _of _tweets != null && number _of _tweets != "" ) {
_number _of _tweets = number _of _tweets ;
@ -1607,9 +1600,7 @@ if (typeof VMM == 'undefined') {
for ( var i = 0 ; i < d . results . length ; i ++ ) {
var tweet = { }
var twit = "<div class='twitter'><blockquote><p>" ;
var td = VMM . Util . linkify ( d . results [ i ] . text ) ;
td = td . replace ( /(@([\w]+))/g , "<a href='http://twitter.com/$2'>$1</a>" ) ;
td = td . replace ( /(#([\w]+))/g , "<a href='http://twitter.com/#search?q=%23$2'>$1</a>" ) ;
var td = VMM . Util . linkify _with _twitter ( d . results [ i ] . text , "_blank" ) ;
twit += td ;
twit += "</p>" ;
twit += "— " + d . results [ i ] . from _user _name + " (<a href='https://twitter.com/" + d . results [ i ] . from _user + "'>@" + d . results [ i ] . from _user + "</a>) <a href='https://twitter.com/" + d . results [ i ] . from _user + "/status/" + d . id + "'>" + VMM . ExternalAPI . twitter . prettyParseTwitterDate ( d . results [ i ] . created _at ) + " </a></blockquote></div>" ;
@ -1624,32 +1615,51 @@ if (typeof VMM == 'undefined') {
} ,
// VMM.ExternalAPI.twitter.prettyHTML(id);
prettyHTML : function ( id ) {
// https://api.twitter.com/1/statuses/show.json?id=164165553810976768&include_entities=true&callback=?
var id = id . toString ( ) ;
var error _obj = {
twitterid : id
} ;
var the _url = "http://api.twitter.com/1/statuses/show.json?id=" + id + "&include_entities=true&callback=?" ;
VMM . getJSON ( the _url , VMM . ExternalAPI . twitter . formatJSON ) ;
trace ( "id " + id ) ;
var twitter _timeout = setTimeout ( VMM . ExternalAPI . twitter . notFoundError , 4000 , id ) ;
VMM . getJSON ( the _url , VMM . ExternalAPI . twitter . formatJSON )
. error ( function ( jqXHR , textStatus , errorThrown ) {
trace ( "TWITTER error" ) ;
trace ( "TWITTER ERROR: " + textStatus + " " + qXHR . responseText ) ;
VMM . attachElement ( "#twitter_" + id , "<p>ERROR LOADING TWEET " + id + "</p>" ) ;
} )
. success ( function ( ) {
clearTimeout ( twitter _timeout ) ;
} ) ;
} ,
notFoundError : function ( id ) {
trace ( "TWITTER JSON ERROR TIMEOUT " + id ) ;
VMM . attachElement ( "#twitter_" + id , "<p>TWEET NOT FOUND " + id + "</p>" ) ;
} ,
formatJSON : function ( d ) {
trace ( "TWITTER JSON LOADED F" ) ;
trace ( d ) ;
var id = d . id _str ;
var twit = "<blockquote><p>" ;
var td = VMM . Util . linkify ( d . text ) ;
td = td . replace ( /(@([\w]+))/g , "<a href='http://twitter.com/$2'>$1</a>" ) ;
td = td . replace ( /(#([\w]+))/g , "<a href='http://twitter.com/#search?q=%23$2'>$1</a>" ) ;
var td = VMM . Util . linkify _with _twitter ( d . text , "_blank" ) ;
//td = td.replace(/(@([\w]+))/g,"<a href='http://twitter.com/$2' target='_blank'>$1</a>");
//td = td.replace(/(#([\w]+))/g, "<a href='http://twitter.com/#search?q=%23$2' target='_blank' >$1</a>");
twit += td ;
twit += "</p></blockquote>" ;
twit += " <a href='https://twitter.com/" + d . user . screen _name + "/status/" + d . id + "' alt='link to original tweet' title='link to original tweet'>" + "<span class='created-at'></span>" + " </a>" ;
twit += " <a href='https://twitter.com/" + d . user . screen _name + "/status/" + d . id + "' target='_blank' alt='link to original tweet' title='link to original tweet'>" + "<span class='created-at'></span>" + " </a>" ;
twit += "<div class='vcard author'>" ;
twit += "<a class='screen-name url' href='https://twitter.com/" + d . user . screen _name + "' data-screen-name='" + d . user . screen _name + "'>" ;
twit += "<a class='screen-name url' href='https://twitter.com/" + d . user . screen _name + "' data-screen-name='" + d . user . screen _name + "' target='_blank' >" ;
twit += "<span class='avatar'><img src=' " + d . user . profile _image _url + "' alt=''></span>" ;
twit += "<span class='fn'>" + d . user . name + "</span>" ;
twit += "<span class='nickname'>@" + d . user . screen _name + "</span>" ;
twit += "</a>" ;
twit += "</div>" ;
VMM . attachElement ( "#" + id , twit ) ;
VMM . attachElement ( "#twitter_ " + id . toString ( ) , twit ) ;
}
@ -3238,25 +3248,45 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
// VMM.Util.linkify();
linkify : function ( text , targets , is _touch ) {
if ( ! text ) return text ;
// http://, https://, ftp://
var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|]/gim ;
// www. sans http:// or https://
var pseudoUrlPattern = /(^|[^\/])(www\.[\S]+(\b|$))/gim ;
// Email addresses
var emailAddressPattern = /(([a-zA-Z0-9_\-\.]+)@[a-zA-Z_]+?(?:\.[a-zA-Z]{2,6}))+/gim ;
text = text . replace ( /((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi , function ( url ) {
var nice = url ;
var _touch = "" ;
if ( url . search ( '^https?:\/\/' ) < 0 ) url = 'http://' + url ;
_touch = "onclick = 'void(0)'" ;
if ( is _touch ) {
_touch = "onclick = 'void(0)'" ;
}
onclick = "void(0)" ;
if ( targets === null || targets === "" ) return '<a href="' + url + " " + _touch + '">' + url + '</a>' ;
else return "<a href='" + url + " " + _touch + " target='" + targets + "'>'" + url + "</a>" ;
} ) ;
return text
. replace ( urlPattern , "<a target='_blank' href='$&' onclick='void(0)'>$&</a>" )
. replace ( pseudoUrlPattern , "$1<a target='_blank' onclick='void(0)' href='http://$2'>$2</a>" )
. replace ( emailAddressPattern , "<a target='_blank' onclick='void(0)' href='mailto:$1'>$1</a>" ) ;
} ,
linkify _with _twitter : function ( text , targets , is _touch ) {
return text ;
// http://, https://, ftp://
var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|]/gim ;
// www. sans http:// or https://
var pseudoUrlPattern = /(^|[^\/])(www\.[\S]+(\b|$))/gim ;
// Email addresses
var emailAddressPattern = /(([a-zA-Z0-9_\-\.]+)@[a-zA-Z_]+?(?:\.[a-zA-Z]{2,6}))+/gim ;
var twitterHandlePattern = /(@([\w]+))/g ;
var twitterSearchPattern = /(#([\w]+))/g ;
return text
. replace ( urlPattern , "<a target='_blank' href='$&' onclick='void(0)'>$&</a>" )
. replace ( pseudoUrlPattern , "$1<a target='_blank' onclick='void(0)' href='http://$2'>$2</a>" )
. replace ( emailAddressPattern , "<a target='_blank' onclick='void(0)' href='mailto:$1'>$1</a>" )
. replace ( twitterHandlePattern , "<a href='http://twitter.com/$2' target='_blank' onclick='void(0)'>$1</a>" )
. replace ( twitterSearchPattern , "<a href='http://twitter.com/#search?q=%23$2' target='_blank' 'void(0)'>$1</a>" ) ;
} ,
/ * T u r n s p l a i n t e x t l i n k s i n t o r e a l l i n k s
=== === === === === === === === === === === === === === === === == * /
// VMM.Util.unlinkify();
@ -3449,6 +3479,32 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
} ) . init ( ) ;
//'string'.linkify();
if ( ! String . linkify ) {
String . prototype . linkify = function ( ) {
// http://, https://, ftp://
var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|]/gim ;
// www. sans http:// or https://
var pseudoUrlPattern = /(^|[^\/])(www\.[\S]+(\b|$))/gim ;
// Email addresses
var emailAddressPattern = /(([a-zA-Z0-9_\-\.]+)@[a-zA-Z_]+?(?:\.[a-zA-Z]{2,6}))+/gim ;
var twitterHandlePattern = /(@([\w]+))/g ;
var twitterSearchPattern = /(#([\w]+))/g ;
return this
. replace ( urlPattern , '<a target="_blank" href="$&">$&</a>' )
. replace ( pseudoUrlPattern , '$1<a target="_blank" href="http://$2">$2</a>' )
. replace ( emailAddressPattern , '<a target="_blank" href="mailto:$1">$1</a>' )
. replace ( twitterHandlePattern , "<a href='http://twitter.com/$2' target='_blank'>$1</a>" )
. replace ( twitterSearchPattern , "<a href='http://twitter.com/#search?q=%23$2' target='_blank'>$1</a>" ) ;
} ;
}
}
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@ -3984,7 +4040,7 @@ if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') {
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/ * !
Verite Timeline 0.88
Open Timeline 0.88
Designed and built by Zach Wise digitalartwork . net
Date : April 8 , 2012
@ -4025,7 +4081,7 @@ if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') {
// @codekit-prepend "VMM.LoadLib.js";
// @codekit-prepend "bootstrap-tooltip.js";
/ * T i m e l i n e C l a s s c o n t a i n e d i n V M M ( v e r i t e ) n a m e s p a c e
/ * O p e n T i m e l i n e C l a s s c o n t a i n e d i n V M M ( v e r i t e ) n a m e s p a c e
=== === === === === === === === === === === === === === === === == * /
if ( typeof VMM != 'undefined' && typeof VMM . Timeline == 'undefined' ) {
@ -4318,14 +4374,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
if ( d . type == "tweets" ) {
} else if ( dd . type == "start" ) {
c . _text += VMM . createElement ( "h2" , d . headline , "start" ) ;
c . _text += VMM . createElement ( "h2" , VMM . Util . linkify _with _twitter ( d . headline , "_blank" ) , "start" ) ;
} else {
c . _text += VMM . createElement ( "h3" , d . headline ) ;
c . _text += VMM . createElement ( "h3" , VMM . Util . linkify _with _twitter ( d . headline , "_blank" ) ) ;
}
}
if ( d . text != null && d . text != "" ) {
_hastext = true ;
c . _text += VMM . createElement ( "p" , d . text ) ;
c . _text += VMM . createElement ( "p" , VMM . Util . linkify _with _twitter ( d . text , "_blank" ) ) ;
}
c . _text = VMM . createElement ( "div" , c . _text , "container" ) ;