|
|
@ -2123,28 +2123,34 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') { |
|
|
|
|
|
|
|
|
|
|
|
var the_url = "http://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles=" + api_obj.url + "&format=json&exintro=1&callback=?"; |
|
|
|
var the_url = "http://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles=" + api_obj.url + "&format=json&exintro=1&callback=?"; |
|
|
|
VMM.getJSON(the_url, function(d) { |
|
|
|
VMM.getJSON(the_url, function(d) { |
|
|
|
var wiki_extract = VMM.Util.getObjectAttributeByIndex(d.query.pages, 0).extract; |
|
|
|
trace(d); |
|
|
|
var wiki_title = VMM.Util.getObjectAttributeByIndex(d.query.pages, 0).title; |
|
|
|
if ( VMM.Browser.browser == "Explorer" && parseInt(VMM.Browser.version, 10) >= 7 && window.XDomainRequest) { |
|
|
|
var _wiki = ""; |
|
|
|
VMM.attachElement("#"+api_obj.id, "<p>Wikipedia entry unable to load using Internet Explorer.</p>" ); |
|
|
|
var wiki_text = ""; |
|
|
|
} else { |
|
|
|
var wiki_text_array = wiki_extract.split("<p>"); |
|
|
|
var wiki_extract = VMM.Util.getObjectAttributeByIndex(d.query.pages, 0).extract; |
|
|
|
var wiki_number_of_paragraphs = 1; |
|
|
|
var wiki_title = VMM.Util.getObjectAttributeByIndex(d.query.pages, 0).title; |
|
|
|
|
|
|
|
var _wiki = ""; |
|
|
|
|
|
|
|
var wiki_text = ""; |
|
|
|
|
|
|
|
var wiki_text_array = wiki_extract.split("<p>"); |
|
|
|
|
|
|
|
var wiki_number_of_paragraphs = 1; |
|
|
|
|
|
|
|
|
|
|
|
for(var i = 0; i < wiki_text_array.length; i++) { |
|
|
|
for(var i = 0; i < wiki_text_array.length; i++) { |
|
|
|
if (i+1 <= wiki_number_of_paragraphs && i+1 < wiki_text_array.length) { |
|
|
|
if (i+1 <= wiki_number_of_paragraphs && i+1 < wiki_text_array.length) { |
|
|
|
wiki_text += "<p>" + wiki_text_array[i+1]; |
|
|
|
wiki_text += "<p>" + wiki_text_array[i+1]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_wiki = "<h4><a href='http://en.wikipedia.org/wiki/" + wiki_title + "' target='_blank'>" + wiki_title + "</a></h4>"; |
|
|
|
_wiki = "<h4><a href='http://en.wikipedia.org/wiki/" + wiki_title + "' target='_blank'>" + wiki_title + "</a></h4>"; |
|
|
|
_wiki += "<div class='wiki-source'>From Wikipedia, the free encyclopedia</span>"; |
|
|
|
_wiki += "<div class='wiki-source'>From Wikipedia, the free encyclopedia</span>"; |
|
|
|
_wiki += VMM.Util.linkify_wikipedia(wiki_text); |
|
|
|
_wiki += VMM.Util.linkify_wikipedia(wiki_text); |
|
|
|
|
|
|
|
|
|
|
|
if (wiki_extract.match("REDIRECT")) { |
|
|
|
if (wiki_extract.match("REDIRECT")) { |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
VMM.attachElement("#"+api_obj.id, _wiki ); |
|
|
|
VMM.attachElement("#"+api_obj.id, _wiki ); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
@ -3516,14 +3522,19 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') { |
|
|
|
/* GET OBJECT ATTRIBUTE BY INDEX |
|
|
|
/* GET OBJECT ATTRIBUTE BY INDEX |
|
|
|
================================================== */ |
|
|
|
================================================== */ |
|
|
|
getObjectAttributeByIndex: function(obj, index) { |
|
|
|
getObjectAttributeByIndex: function(obj, index) { |
|
|
|
var i = 0; |
|
|
|
if(typeof obj != 'undefined') { |
|
|
|
for (var attr in obj){ |
|
|
|
var i = 0; |
|
|
|
if (index === i){ |
|
|
|
for (var attr in obj){ |
|
|
|
return obj[attr]; |
|
|
|
if (index === i){ |
|
|
|
|
|
|
|
return obj[attr]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
i++; |
|
|
|
return ""; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
/* RANDOM BETWEEN |
|
|
|
/* RANDOM BETWEEN |
|
|
|
================================================== */ |
|
|
|
================================================== */ |
|
|
@ -3910,7 +3921,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') { |
|
|
|
return text |
|
|
|
return text |
|
|
|
.replace(urlPattern, "<a target='_blank' href='http://en.wikipedia.org/wiki/$&' onclick='void(0)'>$&</a>") |
|
|
|
.replace(urlPattern, "<a target='_blank' href='http://en.wikipedia.org/wiki/$&' onclick='void(0)'>$&</a>") |
|
|
|
.replace(/<i\b[^>]*>/gim, "") |
|
|
|
.replace(/<i\b[^>]*>/gim, "") |
|
|
|
.replace(/<\/i>/gim, ""); |
|
|
|
.replace(/<\/i>/gim, "") |
|
|
|
|
|
|
|
.replace(/<b\b[^>]*>/gim, "") |
|
|
|
|
|
|
|
.replace(/<\/b>/gim, ""); |
|
|
|
}, |
|
|
|
}, |
|
|
|
/* Turns plain text links into real links |
|
|
|
/* Turns plain text links into real links |
|
|
|
================================================== */ |
|
|
|
================================================== */ |
|
|
@ -4098,8 +4111,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') { |
|
|
|
|
|
|
|
|
|
|
|
__firstToUpperCase: function (w) { |
|
|
|
__firstToUpperCase: function (w) { |
|
|
|
var split = w.split(/(^[^a-zA-Z0-9]*[a-zA-Z0-9])(.*)$/); |
|
|
|
var split = w.split(/(^[^a-zA-Z0-9]*[a-zA-Z0-9])(.*)$/); |
|
|
|
split[1] = split[1].toUpperCase(); |
|
|
|
if (split[1]){ |
|
|
|
return split.join(''); |
|
|
|
split[1] = split[1].toUpperCase(); |
|
|
|
|
|
|
|
return split.join(''); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return ""; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -6083,7 +6102,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { |
|
|
|
_date.fulldate = _date.startdate.getTime(); |
|
|
|
_date.fulldate = _date.startdate.getTime(); |
|
|
|
|
|
|
|
|
|
|
|
if (config.embed) { |
|
|
|
if (config.embed) { |
|
|
|
document.title = _date.headline; |
|
|
|
//document.title = _date.headline;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_dates.push(_date); |
|
|
|
_dates.push(_date); |
|
|
|