// helpers {{{ function htmlEsc(str) { return str.replace(/&/g,"&").replace(/>/g,">").replace(/" + data.tab + "" }; } } ], "movie": [ { urlPattern: /^https?:\/\/www.imdb.com\/title\//, fields: { title: { selector: 'h1', attribute: 'innerText' }, director: { selector: 'a[href^="/name/"]', attribute: 'textContent' }, year: { selector: 'a[href*="/releaseinfo"]', attribute: 'textContent' }, cover: { selector: 'img.ipc-image', attribute: 'src' }, }, workflowyFormat: function(data, tab) { return { name: '' + data.title.trim() + '', description: data.year + " " + data.director + "\n" + "!!" + data.cover }; } } ], "book": [ { urlPattern: /^https?:\/\/www.goodreads.com\/book\/show\//, fields: { title: { selector: 'h1', attribute: 'innerText' }, author: { selector: 'span.ContributorLink__name', attribute: 'textContent' }, year: { selector: 'p[data-testid="publicationInfo"]', attribute: 'textContent' }, cover: { selector: '.BookCover img', attribute: 'src' }, }, workflowyFormat: function(data, tab) { return { name: '' + data.title.trim() + '', description: data.year + " " + data.author + "\n" + "!!" + data.cover }; } } ], }; function initConfigPopup(tab) { // {{{ setPopupMode("config"); var status; if (!localStorage.userid) { status = "Not synchronized"; } else { status = "Synchronized"; } $("#status").html("Status: " + status); // Clear existing buttons $("#content-type-buttons").empty(); // Create a button for each content type Object.keys(contentTypes).forEach(function(type) { var button = $('