in site/js/ponymail.js [3991:4224]
function getListInfo(list, xdomain, nopush) {
current_query = ""
current_retention = DEFAULT_RETENTION
var dealtwithit = false
if (xdomain && xdomain.search("utm_source=opensearch") != -1) {
var strs = xdomain.split(/&/)
for (var i in strs) {
var kv = strs[i].split(/=/)
if (kv[0] == "websearch") {
current_query = kv[1]
}
if (kv[0] == "domain") {
xdomain = kv[1]
xlist = "*@" + xdomain;
list = xlist;
if (document.getElementById('checkall')) {
document.getElementById('checkall').checked = true
}
}
}
nopush = true
dealtwithit = true
search(current_query, DEFAULT_RETENTION, true, true)
}
else if (xdomain && xdomain != "") {
if (xdomain.length <= 1) {
xdomain = null
} else {
if (xdomain.search(/:/) != -1) {
var arr = xdomain.split(/:/)
xdomain = arr[0]
current_query = unescape(arr[2] || '')
xlist = xdomain
// ensure query is not ignored
if (current_query == "" && arr[1].match(/-/) && !arr[1].match(/\|/)) {
var ya = arr[1].split(/-/)
toggleEmail(ya[0], ya[1], nopush)
current_retention = arr[1]
dealtwithit = true
} else {
current_retention = parseInt(arr[1])
if (("x"+current_retention) != ("x"+arr[1])) {
current_retention = arr[1]
nopush = true
}
}
}
if (xdomain.search(/@/) != -1) {
list = xdomain;
xlist = list
xdomain = xdomain.replace(/^.*?@/, "")
}
}
}
if ((xdomain == undefined || xdomain == "") && list) {
xdomain = list.replace(/^.*?@/, "")
}
// If invalid address passed, complain and exit - no need to attempt fetching stats
// N.B. Only check list and xdomain if they are defined
if ((list && ! valid_address(list)) || (xdomain && ! valid_address(xdomain))) {
alert("Invalid mailing list address supplied!");
return
}
// Sort lists by usage before we enter here...
var listnames = []
if (all_lists[xdomain]) {
for (var key in all_lists[xdomain]) {
listnames.push(key)
}
var overlaps = []
listnames = listnames.sort(function(a, b) {
return all_lists[xdomain][b] - all_lists[xdomain][a]
})
}
if (!list || list.length <= 1) {
// List may be private...who knows?
if ((list && list.length > 1) && (!login || !login.credentials)) {
popup("List not found!", "Looks like this list is either not here or private.<br>You can try <a href='" + URL_BASE + "/oauth.html'>Logging in</a> to resolve the situation.")
}
else {
if (listnames.length > 0 && xdomain) {
for (var i in listnames) {
// do we have a dev list? :3
if (listnames[i] == 'dev') {
window.location.search = 'dev@' + xdomain
return
}
}
// no dev list, find the busiest one!
window.location.search = listnames[0] + '@' + xdomain
}
}
}
if (!firstVisit && !nopush) {
window.history.pushState({}, "", "list.html?" + xlist);
firstVisit = false
}
//buildCalendar()
// Bail if no list is still found - search.html probably
if (!list) {
return
}
mbox_month = null;
var dp = document.getElementById('d')
dp.value = datePickerValue(current_retention)
dp.setAttribute("data", current_retention)
if (current_retention.toString().search(/^\d+-\d+$/)) {
mbox_month = current_retention
}
document.getElementById('q').value = unescape(current_query)
document.getElementById('aq').value = unescape(current_query)
xlist = list;
var arr = list.split('@', 2)
var listname = arr[0]
var domain = arr[1]
var lc = document.getElementById('lc_dropdown');
lc.innerHTML = ""
var dom_sorted = []
for (var dom in all_lists) {
dom_sorted.push(dom)
}
// Sort out available domains with MLs
for (var i in dom_sorted.sort()) {
var dom = dom_sorted[i]
var li = document.createElement("li")
var a = document.createElement("a")
var t = document.createTextNode(dom)
a.setAttribute("href", URL_BASE + "/list.html?" + dom)
a.appendChild(t)
li.appendChild(a)
lc.appendChild(li)
}
// If we have a domain ML listing, sort out the nav bar
if (all_lists[xdomain]) {
var ll = document.getElementById('listslist')
ll.innerHTML = ""
for (var i in listnames) {
var key = listnames[i]
var collapse = ''
if (listnames.length > 5 && i >= 4) {
collapse = 'hidden-xs hidden-sm hidden-md hidden-lg'
overlaps.push(key)
}
var ln = key + '@' + xdomain
//alert("adding" + ln)
var li = document.createElement("li")
var a = document.createElement("a")
var t = document.createTextNode(key + '@')
a.setAttribute("href", "javascript:void(0);")
a.setAttribute("onclick", "getListInfo(this.getAttribute('id'))")
a.setAttribute("id", ln)
a.appendChild(t)
li.appendChild(a)
ll.appendChild(li)
if (typeof all_lists[xdomain][listname] == 'undefined') {
if (list && list.length > 1) {
popup("List not found!", "Looks like this list is either not here or private.<br>You can try <a href='" + URL_BASE + "/oauth.html'>Logging in</a> to resolve the situation.")
} else {
listname = key
list = ln
xlist = ln
}
}
if (list == ln) {
li.setAttribute("class", "active " + collapse)
} else {
li.setAttribute("class", collapse)
}
}
if (overlaps.length > 0) {
overlaps.sort()
ll.innerHTML += '<li class="dropdown navbar-right" id="otherlists"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Other lists:<span class="caret"></span></a><ul class="dropdown-menu" style="overflow: auto; max-height: 500px;" id="otherlists_dropdown"></ul></li>'
var ul = document.getElementById('otherlists_dropdown')
for (var i in overlaps) {
var key = overlaps[i]
var ln = key + '@' + xdomain
var li = document.createElement("li")
var a = document.createElement("a")
var t = document.createTextNode(key + '@')
a.setAttribute("href", "javascript:void(0);")
a.setAttribute("onclick", "getListInfo(this.getAttribute('id'))")
a.setAttribute("id", ln)
a.appendChild(t)
li.appendChild(a)
ul.appendChild(li)
if (list == ln) {
li.setAttribute("class", "active")
} else {
li.setAttribute("class", "")
}
}
}
} else {
// no such domain, report this as a missing list
popup("List not found!", "Looks like this list is either not here or private.<br>You can try <a href='" + URL_BASE + "/oauth.html'>Logging in</a> to resolve the situation.")
}
gxdomain = xdomain
addSearchBar();
if (!dealtwithit) {
kiddos = []
traverseThread(document.getElementById('datepicker'), 'calmonth', 'LABEL')
for (var n in kiddos) {
kiddos[n].setAttribute("class", "label label-default label-hover")
}
document.getElementById('listtitle').innerHTML = list + ", last month <a href='api/atom.lua?list=" + list + "'><img src='images/atom.png'></a>"
if (current_query == "" && (current_retention == "" || current_retention == DEFAULT_RETENTION)) {
global_deep = false
current_query = ""
GetAsync("/api/stats.lua?list=" + listname + "&domain=" + domain, null, buildPage)
if (!nopush) {
window.history.pushState({}, "", "list.html?" + xlist);
}
} else {
search(current_query, current_retention, nopush)
}
}
}