Welcome to the Invelos forums. Please read the forum rules before posting.

Read access to our public forums is open to everyone. To post messages, a free registration is required.

If you have an Invelos account, sign in to post.

    Invelos Forums->General: General Discussion Page: 1... 7 8 9  Previous   Next
Movie Trivia for HTML Window
Author Message
DVD Profiler Unlimited RegistrantAntares
Registered: May 26, 2007
Reputation: High Rating
United States Posts: 599
Posted:
PM this userView this user's DVD collectionEdit postDirect link to this postReply with quote
bump

Is there anyone here who might want to take a look at Muckl's coding for this HTML window and try to get it working again? This was a great addition, and I really miss it.


Quote:

<HTML>

<!--

@name              Trivia
@description      DVD Profiler HTML Window, that shows trivia saved in Notes.
@author            Muckl (http://www.invelos.com/UserProfile.aspx?alias=Muckl)
@license            (CC) Attribution-Noncommercial-Share Alike 3.0 Unported (http://www.creativecommons.org/licenses/by-nc-sa/3.0/)
@version            0.3.1
@date                2010-08-05
@dependencies  DVD Profiler 3.5+, IE 6.0+ [IE 7.0+ for features imdbData, versionCheck & triviaCheck]
@thanks            - Addicted2DVD for the window request, valuable feedback, language advice and his trivia thread (http://www.invelos.com/Forums.aspx?task=viewtopic&topicID=432352)
                          - DJ Doena for his Cast/Crew Edit 2 with trivia support (http://doena-journal.net/en/dvd-profiler-tools#CastCrewEdit2)
@readme            Please see ReadMe.html, download here: http://www.mediafire.com/?sharekey=b185e4953a43cddfd9d5c56d04dfa8b0b7bb6ffd384adbee6d217c73094ddc3b

//-->

    <title>Trivia v0.3.1</title>

<HEAD>

<SCRIPT TYPE="text/javascript">
<!--
<DP NAME="HEADER_VARS" Language="JavaScript" Comments="True" IncludeCast="True" IncludeCrew="True">
//-->
</SCRIPT>

<script type="text/javascript">

/***************************************\
|********* START CONFIG BLOCK ***********|
\***************************************/

// IMDb
var imdbData          = 2;        // Check IMDb for available trivia or load it directly into the window [0 (do nothing) OR 1 (only check) OR 2 (load data)]
var imdbSpoiler      = 2;        // Show IMDb trivia marked as "SPOILER" [0 (never) OR 1 (if movie hasn't been watched by any user) OR 2 (always)]
var loadingIcon      =true;  // Use icon loading.gif instead of text message; has to be installed first (see @readme above) [true OR false]

// Notes
var notesMsg          = false;  // Show a message, if no trivia items are found in the profile notes [true OR false]

// Additional tasks
var versionCheck    = true;  // Check trivia thread for new Trivia HTML window version [true OR false]
var triviaCheck        = true;  // Check trivia thread for available trivia items [true OR false]

// Links
var linkCast              = true;  // Add links to DVD Profiler cast popups [true OR false]
var linkCrew            = true;  // Add links to DVD Profiler crew popups [true OR false]
var useIcons            =true;  // Use icons imdb.gif and external.gif instead of text links; have to be installed first (see @readme above) [true OR false]
var newWindow      = true;  // Open new browser window/tab for external links [true OR false]

// Item list format
//      'hline'          --> separated with horizontal lines (see also lineColor underneath)
//      'bullets'        --> as bulleted list
//      'paragraph'  --> separated with new paragraphs
//      'blank'          --> separated with blank lines
var listStyle              = 'hline';

// Colours
//      transparent, black, gray, maroon, red, green, lime, olive, yellow, navy, blue, purple, fuchsia, teal, aqua, silver, white, ...
//      More colour names and info about hexadecimal notation --> http://en.wikipedia.org/wiki/Web_colors
//      For imitation of the DVD Profiler panel style set the values to 'black', 'teal', 'gradient', 'transparent', 'black', 'black'.
var textColor            = '#2E0854';
var linkColor              = '#EE7600';
var bgColor              = '#ECE0F8';  // 'gradient' --> display window background as gradient like in standard panel
var noteBgColor        = 'silver';
var noteBorderColor = 'grey';
var lineColor              = 'silver';

// Text formatting
var textStyle            = 'normal';                              // Font style ['normal' OR 'italic' OR 'oblique']
var textWeight          = 'normal';                              // Font weight ['normal' OR 'bold' OR 'bolder' OR 'lighter']
var textSize              = 22;                                      // Font size in pixel [integer]
var textFont              = "Cardiff";  // Font family [font name(s)] --> http://en.wikipedia.org/wiki/Font_family_(HTML)

// Language
//      'auto'  --> auto-detect
//      'en'      --> English
//      'de'      --> German
// If your preferred language isn't listed, see @readme above for further instructions
var langCode              = 'auto';


/***************************************\
|********** END CONFIG BLOCK ************|
\***************************************/

// globals
var g_threadUrl = 'http://www.invelos.com/Forums.aspx?task=viewtopic&topicID=432352&PageNum=1';
var g_downloadUrl = 'http://www.mediafire.com/?sharekey=b185e4953a43cddfd9d5c56d04dfa8b0b7bb6ffd384adbee6d217c73094ddc3b';

// test some user-defined values
if (!testColor(textColor)) textColor = 'black';
if (!testColor(linkColor)) linkColor = 'teal';
if (!testColor(bgColor)) bgColor = 'white';
bgColor = (bgColor === 'gradient' && testColor(DP_Color_BackgroundSolid) && testColor(DP_Color_PanelGradBottom)) ? 'filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff' + DP_Color_BackgroundSolid.slice(1, 7) + ', endColorstr=#ff' + DP_Color_PanelGradBottom.slice(1, 7) + ')' : 'background-color: ' + bgColor;
if (!testColor(noteBgColor)) noteBgColor = 'silver';
if (!testColor(noteBorderColor)) noteBorderColor = 'grey';
if (!testColor(lineColor)) lineColor = 'silver';
if (!/^[a-zA-Z]{6,}$/.test(textStyle)) textStyle = 'normal';
if (!/^[a-zA-Z]{4,}$/.test(textWeight)) textWeight = 'normal';
textSize = (isFinite(textSize)) ? Math.round(parseFloat(textSize, 10)) + 'px' : '12px';
if (!/^[\w\-,' ]+$/.test(textFont)) textFont = 'Cardiff';

// localization
var lang = {
    en:["object is not available!", "Status", "Trivia items might be available on the Invelos Forums", "A new version of the Trivia HTML window is available for download", "Couldn't find a valid IMDb link. Please", "submit a profile link on www.invelos.com", "or", "add the IMDb id for this profile to the notes (e.g.", "LOADING DATA", "Trivia is available in the IMDb", "The Trivia section for this film has no entries on its page at IMDb", "There are no trivia items stored in the notes", "One or more activated features require Internet Explorer version 7.0 or above!", "Open cast/crew window for"],
    de:["Objekt ist nicht verfügbar!", "Status", "Es könnten Hintergrundinfos im Invelos-Forum verfügbar sein", "Eine neue Version des Trivia HTML-Fensters ist zum Download verfügbar", "Es konnte kein gültiger IMDb-Link gefunden werden. Bitte", "tragen Sie einen Profil-Link auf www.invelos.com ein", "oder", "fügen Sie die IMDb-ID für dieses Profil zu den Notizen hinzu (z.B.", "DATEN WERDEN GELADEN", "Es sind Hintergrundinfos auf IMDb verfügbar", "Es sind keine Hintergrundinfos auf IMDb verfügbar", "Es sind keine Hintergrundinfos in den Notizen gespeichert", "Ein oder mehrere aktiviere Funktionen benötigen Internet Explorer Version 7.0 oder höher!", "Öffne Darsteller-/Crew-Fenster für"],
    nl:["object is niet beschikbaar", "Status", "Trivia items mogelijk beschikbaar op de Invelos Forums", "Er is een nieuwe versie van de Trivia HTML window beschikbaar voor download", "Kon geen geldige IMDb link vinden. Alstublieft", "stuur een profiel link naar invelos.com", "of", "voeg een IMDb id aan de notities (bv.", "OPHALEN VAN DATA", "Trivia beschikbaar op IMDb", "Er is geen trivia beschikbaar op IMDb", "Er is geen trivia beschikbaar in de notities", "De Trivia HTML window heeft Internet Explorer 7 (of beter) nodig", "Open cast/crew window for"]
};
if (langCode === 'auto' && navigator.userLanguage) {
    langCode = navigator.userLanguage.slice(0, 2).toLowerCase();
}
if (typeOf(lang[langCode]) !== 'array') {
    langCode = 'en';
}
lang = lang[langCode];

// helper functions
function sendRequest(url, data, method, contentType, handler) {
    var http = new XMLHttpRequest(), requestBody = [], key;
    if (typeOf(http) !== 'object') {
        alert('XMLHttpRequest ' + lang[0]);
        return false;
    }
    if (typeOf(data) === 'object') {
        for (key in data) {
            requestBody.push(key + '=' + encodeURIComponent(data[key]));
        }
        requestBody = requestBody.join('&');
    } else {
        requestBody = data;
    }
    method = method.toUpperCase();
    if (method === 'POST') {
        http.open(method, url, true);
        http.setRequestHeader('Method', 'POST ' + url + ' HTTP/1.1');
        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    } else {
        if (requestBody) {
            url += (url.indexOf('?') < 0 ? '?' : '&') + requestBody;
        }
        requestBody = '';
        http.open(method, url, true);
        if (!isEmpty(contentType)) {
            http.setRequestHeader('Content-Type', contentType);
        }
    }
    if (handler) {
        http.onreadystatechange = function () {
            if (http.readyState === 4) {
                http.onreadystatechange = function () {};
                handler(http);
            }
        };
    }
    http.send(requestBody);
    return http;
}
function addStyle(rules) {
    var css = document.createStyleSheet(), style = css.owningElement || css.ownerNode,
        rule = rules.replace(/\s+/g, ' ').replace(/\/\*.+?\*\//g, '').split('}'), i, j;
    style.type = 'text/css';
    for (i = 0; i < rule.length; i += 1) {
        p = rule[i].indexOf('{');
        selector = rule[i].substring(0,p).trim();
        text = rule[i].substring(p + 1).trim() || ' ';
        if (selector) {
            if (selector.indexOf(',')) {
                singleSelector = selector.split(',');
            } else {
                singleSelector = new Array(selector);
            }
            for (j = 0; j < singleSelector.length; j += 1) {
                css.addRule(singleSelector[j].trim(), text);
            }
        }
    }
    return style;
}
function $(id) {
    return document.getElementById(id);
}
function typeOf(v) {
    var s = typeof v;
    if (s === 'object') {
        if (v) {
            if (v instanceof Array) {
                s = 'array';
            }
        } else {
            s = 'null';
        }
    }
    return s;
}
function isEmpty(v) {
    if (v) {
        return (v === '' || v === null || v.length === 0);
    } else {
        return true;
    }
}
String.prototype.mask = function () {
    var arrSpecials = ['\\', '^', '[', ']', '(', ')', '$', '.', '|', '?', '*', '+', '{', '}', '/'],
        res = this, i;
    for (i = 0; i < arrSpecials.length; i += 1) {
        res = res.replace(eval('/\\' + arrSpecials[i] + '/g'), '\\' + arrSpecials[i]);
    }
    return res;
}
String.prototype.trim = function (m) {
    var l = '^[\\s\\n\\r\\t]+', r = '[\\s\\n\\r\\t]+$', rx;
    m = (m || '');
    switch (m.toUpperCase()) {
        case 'L': m = l; break;
        case 'R': m = r; break;
        default : m = l + '|' + r;
    }
    rx = new RegExp(m, 'g');
    return this.replace(rx, '');
}
function alertErr(err, msg) {
    var nr = err.number, desc = err.description;
    if (isEmpty(desc)) {
        desc = 'Error ' + nr + ' (0x' + ((nr < 0) ? (nr + 0xFFFFFFFF + 1).toString(16) : nr) + ')';
    }
    msg = (typeOf(msg) === 'string' && !isEmpty(msg)) ? '\n\n[ ' + msg + ' ]' : '';
    alert(desc + msg);
    return false;
}
function alertStatus(fn, http) {
    alert(fn + '() HTTP ' + lang[1] + ':\n\n' + http.status + ' - ' + http.statusText);
    return false;
}
function addNote(note) {
    document.body.innerHTML = '<div class="note">' + note + '</div>' + document.body.innerHTML;
    return false;
}
function testColor(color) {
    return /^[a-zA-Z]{3,}$|^#[a-zA-Z0-9]{6}$/.test(color);
}

// check thread for trivia items and new version
function checkTrivia(text, inNotes) {
    var offset = 0, rx = new RegExp('href="', 'gi'), res = [], c = 0;
    if (text.match(/Trivia Index.*?)<\/TD>/i) !== null) {
        text = RegExp.$1;
        try {
            offset = text.search(new RegExp('\\b' + (DP_OriginalTitle || DP_Title).mask() + '\\b', 'i'));
            if (offset > -1) {
                text = text.substr(offset);
                text = text.slice(0, text.search(/<FONT SIZE="4"><b><u>/im));
                while ((res = rx.exec(text)) !== null) {
                    c++;
                }
                if (c > inNotes) {
                    addNote(lang[2] + ':<br><a href="' + g_threadUrl + '"' + ((newWindow) ? ' target="_blank"' : '') + '>Movie Trivia for HTML Window</a>');
                }
            }
        } catch (e) {
            return alertErr(e, 'checkTrivia()');
        }
    }
}
function checkVersion(text) {
    var latest = latestDate = current = '';
    if (text.match(/Trivia v(\d\.\d\.\d).+?\((\d{4}-\d{2}-\d{2})\)/i) !== null) {
        latest = RegExp.$1;
        latestDate = RegExp.$2;
        if (document.title.match(/Trivia v(\d\.\d\.\d)/i) !== null) {
            current = RegExp.$1;
            if (parseInt(current.replace(/\./g, ''), 10) < parseInt(latest.replace(/\./g, ''), 10)) {
                addNote(lang[3] + ':<br><a href="' + g_downloadUrl + '"' + ((newWindow) ? ' target="_blank"' : '') + '>Trivia v' + latest + ' (' + latestDate + ')</a>');
            }
        }
    }
}
function getThread(inNotes) {
    sendRequest(g_threadUrl, 'ignoreMe=' + new Date().getTime(), 'GET', '', function (http) {
        if (http.status === 200) {
            if (triviaCheck) {
                checkTrivia(http.responseText, inNotes);
            }
            if (versionCheck) {
                checkVersion(http.responseText);
            }
        } else {
            alertStatus('getThread', http);
        }
    });
}

// get imdb id and check imdb for trivia
function processIMDb(triviaUrl) {
    sendRequest(triviaUrl, '', 'GET', '', function (http) {
        if (http.status === 200) {
            formatList(new RegExp('<a name=#tr\\d{7,} ></a>\n<div class="sodatext">    \n((.|\n)+?)<br>', 'gi'), http.responseText, triviaUrl);
        } else {
            alertStatus('processIMDb', http);
        }
    });
}
function getIMDb() {
    if (DP_Notes !== undefined && DP_Notes.match(/(?:<imdb>[^<]*?|<imdb=(?:\/(?!>)|[^\/])*?)(tt\d{7,})(??:\/(?!>)|[^\/])*?\/>|[^<]*?<\/imdb>)/i) !== null) {
        processIMDb('http://www.imdb.com/title/' + RegExp.$1 + '/trivia');
    } else if (DP_WebLink_ProfileLinksPage !== undefined && !isEmpty(DP_WebLink_ProfileLinksPage)) {
        sendRequest(DP_WebLink_ProfileLinksPage, 'ignoreMe=' + new Date().getTime(), 'GET', '', function (http) {
            if (http.status === 200) {
                if (http.responseText.match(/imdb\.com\/title\/(tt\d{7,})/) !== null) {
                    processIMDb('http://www.imdb.com/title/' + RegExp.$1 + '/trivia');
                } else {
                    loading(0);
                    addNote(lang[4] + ((!/^M\d+/.test(DP_UPC)) ? ' <a href="http://www.invelos.com/Database.aspx?task=' + ((DP_UPC) ? 'links&upc=' + DP_UPC : 'linklist') + '"' + ((newWindow) ? ' target="_blank"' : '') + '>' + lang[5] + '</a> ' + lang[6] : '') + ' ' + lang[7] + ' <i>&lt;imdb=tt0123456/&gt;</i> ' + lang[6] + ' <i>&lt;imdb&gt;tt0123456&lt;/imdb&gt;</i>).');
                }
            } else {
                alertStatus('getIMDb', http);
            }
        });
    }
}

// build and format output
function loading(action) {
    var loaded = $('loading'), css, text;
    if (action === 0) {
        if (typeOf(loaded) === 'object') {
            document.body.removeChild(loaded);
        }
    } else {
        if (loadingIcon) {
            css = 'class="loading"';
            text = ' ';
        } else {
            css = 'style="text-align: center"';
            text = lang[8] + ' . . .';
        }
        document.body.innerHTML += '<div id="loading" ' + css + '>' + text + '</div>';
    }
}
function linkCredits(code, credits) {
    var type = (credits[0].voice === undefined) ? 'crew' : 'cast',
        add = middleName = lastName = '', rx, i;
    try {
        for (i = 0; i < credits.length; i += 1) {
            if (credits[i].id > -1) {
                if (type === 'crew') {
                    switch (credits[i].creditType) {
                        case 'Direction': add = ',0'; break;
                        case 'Writing': add = ',1'; break;
                        case 'Production': add = ',2'; break;
                        case 'Cinematography': add = ',3'; break;
                        case 'Film Editing': add = ',4'; break;
                        case 'Music': add = ',5'; break;
                        case 'Sound': add = ',6'; break;
                        case 'Art': add = ',7'; break;
                    }
                }
                middleName = (credits[i].middleName === '') ? '' : ' ' + credits[i].middleName;
                lastName = (credits[i].lastName === '') ? '' : ' ' + credits[i].lastName;
                rx = new RegExp('(<a[^>]+?href="([^"]*?)"[^>]*?>|)(?:' + credits[i].firstName.mask() + middleName.mask() + lastName.mask() + ((credits[i].creditedAs === '') ? '' : '|' + credits[i].creditedAs.mask()) + ')(?:<\\/a>|)', 'gi');
                code = code.replace(rx, function (str, p1, p2, offset, s) {
                    var newCode = classImg = classText = text = credit = '';
                    if (p1 !== '') {
                        if (p2.indexOf('imdb.com') > -1) {
                            classImg = 'imgimdb';
                            classText = 'ext imdb';
                            text = 'IMDb';
                        } else {
                            classImg = 'imgext';
                            classText = 'ext';
                            text = '[INFO]';
                        }
                        newCode += '<a href="' + p2 + '"' + ((useIcons) ? ' class="' + classImg + '">' : ' class="nu ' + classText + '">' + text) + '</a> ';
                    }
                    credit = '<span class="fn">' + credits[i].firstName + '</span> <span class="mn">' + credits[i].middleName + '</span> <span class="ln">' + credits[i].lastName + '</span>';
                    newCode += '<a href="_dp' + type + '_' + credits[i].id + add + '" class="nu">' + credit + '</a>';
                    return newCode;
                });
            }
        }
        return code;
    } catch (e) {
        return alertErr(e, 'linkCredits() - ' + type);
    }
}
function formatList(rx, text, triviaUrl) {
    var pre = suf = code = '', res = links = [], c = 0, j, imdb = !isEmpty(triviaUrl),
        watched = ((DP_LastWatched || new Date(1899,11,30)).getTime() === -2209165200000) ? false : true;
    switch (listStyle) {
        case 'bullets':
            pre = '<li>'; suf = '</li>'; break;
        case 'paragraph':
            pre = '<p>'; suf = '</p>'; break;
        case 'blank':
            suf = '<br><br>'; break;
        default:
            suf = '<hr />';
    }
    try {
        while ((res = rx.exec(text)) !== null) {
            if (imdb && res[1].indexOf('SPOILER') > -1 && (imdbSpoiler === 0 || imdbSpoiler === 1 && !watched)) {
                continue;
            }
            code += pre + res[1].trim().replace(/href="\//gim, 'href="http://www.imdb.com/') + suf;
            c++;
        }
    } catch (e) {
        return alertErr(e, 'formatList() - build list code');
    }
    if (c > 0) {
        if (!imdb || (imdb && imdbData === 2)) {
            if (pre === '' && (imdb || (!imdb && imdbData < 2))) {
                code = code.slice(0, -suf.length);
            } else if (pre === '<li>') {
                code = '<ul>' + code + '</ul>';
            }
            if (linkCast && DP_CastEntries !== undefined && !isEmpty(DP_CastEntries)) {
                code = linkCredits(code, DP_CastEntries);
            }
            if (linkCrew && DP_CrewEntries !== undefined && !isEmpty(DP_CrewEntries)) {
                code = linkCredits(code, DP_CrewEntries);
            }
            document.body.innerHTML += code;
            try {
                links = document.getElementsByTagName('a');
                for (j = 0; j < links.length; j += 1) {
                    if (links[j].href.indexOf('_dp') < 0) {
                        if (newWindow) {
                            links[j].target = '_blank';
                        }
                        links[j].style.color = linkColor;
                        links[j].title = links[j].href;
                    } else {
                        links[j].title = lang[13] + ' ' + links[j].innerText;
                    }
                }
            } catch (e) {
                return alertErr(e, 'formatList() - modify links');
            }
        } else if (imdb && imdbData === 1) {
            addNote(lang[9] + ': <a href="' + triviaUrl + '"' + ((newWindow) ? ' target="_blank"' : '') + '>' + triviaUrl + '</a>');
        }
    } else {
        if (imdb) {
            addNote(lang[10] + ' ...');
        } else if (notesMsg) {
            addNote(lang[11] + ' ...');
        }
    }
    if (imdbData > 0) {
        loading(0);
    }
    return c;
}

// initiate script
window.onload = function () {
    var listItems = 0, rx = new RegExp('<trivia=(([^\\/]|\\/(?!>' + '))*?)\\/>', 'gi'),
        ie7plus = (window.XMLHttpRequest && document.all) ? true : false;
    addStyle('body { ' + bgColor + '; color: ' + textColor + '; font: ' + textStyle + ' ' + textWeight + ' ' + textSize + ' ' + textFont + '; } hr { color: ' + lineColor + '; } .note { background-color: ' + noteBgColor + '; border: 1px solid ' + noteBorderColor + '; } .note a { color: ' + linkColor + '; font-weight: bold; }');
    if (DP_Notes !== undefined && !isEmpty(DP_Notes)) {
        listItems = formatList(rx, DP_Notes);
    } else if (notesMsg) {
        addNote(lang[11]);
    }
    if (ie7plus) {
        if (imdbData > 0) {
            loading();
            getIMDb();
        }
        if (triviaCheck || versionCheck) {
            getThread(listItems);
        }
    } else {
        addNote('<b>' + lang[12] + '</b>');
    }
};

</script>

<style type="text/css">
body { margin: 10px 10px 20px 10px; overflow: auto; }
hr { width: 90%; height: 1px; margin: 8px 0px; }
ul { margin: 15px; }
li { margin-bottom: 15px; }
.ext, #loading { font-weight: bold; font-size: 75%; }
.imdb { background-color: #FFCC00; color: black !important; padding: 1px 2px 0px 2px; }
.imgext { width: 11px; background: url($DPIMAGES.external.gif) no-repeat center; margin-right: 4px; }
.imgimdb { width: 16px; background: url($DPIMAGES.imdb.gif) no-repeat center; margin-right: 4px; }
.loading { height: 18px; background: url($DPIMAGES.loading.gif) no-repeat center; }
.nu { text-decoration: none; }
.fn { color: #000080; }
.mn { color: #800000; }
.ln { color: #008000; }
.note { margin-bottom: 15px; padding: 3px; }
</style>

</HEAD>
<BODY>

</BODY>
</HTML>
DVD Profiler Unlimited RegistrantStar ContributorAddicted2DVD
Registered: March 13, 2007
Reputation: Highest Rating
United States Posts: 17,334
Posted:
PM this userEmail this userView this user's DVD collectionEdit postDirect link to this postReply with quote
I would love to see this as well!
Pete
DVD Profiler Unlimited RegistrantMatze00
300++ HD-DVD's
Registered: March 2, 2008
Germany Posts: 33
Posted:
PM this userView this user's DVD collectionEdit postDirect link to this postReply with quote
for me the following seems to be working...



changing
Quote:


// get imdb id and check imdb for trivia
function processIMDb(triviaUrl) {
    sendRequest(triviaUrl, '', 'GET', '', function (http) {
        if (http.status === 200) {
            formatList(new RegExp('<a name=#tr\\d{7,} ></a>\n<div class="sodatext">    \n((.|\n)+?)<br>', 'gi'), http.responseText, triviaUrl);
        } else {
            alertStatus('processIMDb', http);
        }
    });
}


into
Quote:


// get imdb id and check imdb for trivia
function processIMDb(triviaUrl) {
    sendRequest(triviaUrl, '', 'GET', '', function (http) {
        if (http.status === 200) {
            formatList(new RegExp('<a name="tr\\d{7,}"></a>\n  <div class="sodatext">\n((.|\n)+?)<br />', 'gi'), http.responseText, triviaUrl);
        } else {
            alertStatus('processIMDb', http);
        }
    });
}
Matze

"There are only two tragedies in life: one is not getting what one
wants, and the other is getting it."
- Oscar Wilde (1854-1900)
DVD Profiler Unlimited RegistrantStar ContributorAddicted2DVD
Registered: March 13, 2007
Reputation: Highest Rating
United States Posts: 17,334
Posted:
PM this userEmail this userView this user's DVD collectionEdit postDirect link to this postReply with quote
Thank You... I really appreciate some working on this again. Unfortunately this don't seem to work for me. All I get now is a constant "working" icon. No matter the wait time it doesn't pull any info.
Pete
DVD Profiler Unlimited RegistrantMatze00
300++ HD-DVD's
Registered: March 2, 2008
Germany Posts: 33
Posted:
PM this userView this user's DVD collectionEdit postDirect link to this postReply with quote
Pete, thx for your feedback.

First of all, I am not an expert, but as far as I understood , is the IMDb trivia page parsed for following "tags/ sections".

Quote:

<a name=#tr1363674 ></a>
<div class="sodatext">


An early draft of the screenplay was written by <a href="/name/nm0232776/">Thomas Dean Donnelly</a> and <a href="/name/nm0649191/">Joshua Oppenheimer</a>.    <br>


But due to a layout change?! is the new IMDb trivia page format we are looking for:

Quote:


<a name="tr1363674"></a>
  <div class="sodatext">


An early draft of the screenplay was written by <a href="/name/nm0232776/">Thomas Dean Donnelly</a> and <a href="/name/nm0649191/">Joshua Oppenheimer</a>.    <br />



which means, the correct quotation marks, count of blanks (space characters) and newlines in the "parsing string" are very important.

therefore again the old and the new "search string", which is working for me, in comparison. 

formatList(new RegExp('<a name=#tr\\d{7,} ></a>\n<div class="sodatext">    \n((.|\n)+?)<br>', 'gi'), http.responseText, triviaUrl);
formatList(new RegExp('<a name="tr\\d{7,}"></a>\n  <div class="sodatext">\n((.|\n)+?)<br />', 'gi'), http.responseText, triviaUrl);

so maybe there is anyone, who is good in this regular expression thing...

Matthias
Matze

"There are only two tragedies in life: one is not getting what one
wants, and the other is getting it."
- Oscar Wilde (1854-1900)
 Last edited: by Matze00
DVD Profiler Desktop and Mobile Registrantmediadogg
Aim high. Ride the wind.
Registered: March 18, 2007
Reputation: Highest Rating
United States Posts: 6,461
Posted:
PM this userVisit this user's homepageEdit postDirect link to this postReply with quote
@Matze00

While the details of this code are beyond my skills, I applied your changes and confirmed that they work for me.

Good job. 

@Addicted - make sure you reply with quote and then copy code from within the quote block directly, not from the screen, in order to avod errors caused by screen formatting. But maybe you knew that already.
Thanks for your support.
Free Plugins available here.
Advanced plugins available here.
Hey, new product!!! BDPFrog.
 Last edited: by mediadogg
DVD Profiler Desktop and Mobile RegistrantStar ContributorTheMadMartian
Alien with an attitude
Registered: March 13, 2007
Reputation: Highest Rating
United States Posts: 13,202
Posted:
PM this userEmail this userView this user's DVD collectionEdit postDirect link to this postReply with quote
Quoting mediadogg:
Quote:
@Matze00

While the details of this code are beyond my skills, I applied your changes and confirmed that they work for me.

Good job. 

Just tested and they work for me as well. 
No dictator, no invader can hold an imprisoned population by force of arms forever.
There is no greater power in the universe than the need for freedom.
Against this power, governments and tyrants and armies cannot stand.
The Centauri learned this lesson once.
We will teach it to them again.
Though it take a thousand years, we will be free.
- Citizen G'Kar
DVD Profiler Unlimited RegistrantStar ContributorAddicted2DVD
Registered: March 13, 2007
Reputation: Highest Rating
United States Posts: 17,334
Posted:
PM this userEmail this userView this user's DVD collectionEdit postDirect link to this postReply with quote
OK... I seemed to mess something up.... I tried to do again... and must of copied over too much by accident or something. Could someone that has it working again post the entire code for me? I would appreciate it. Thanks!

Edit:
All I am getting is a plane white box now.
Pete
 Last edited: by Addicted2DVD
DVD Profiler Desktop and Mobile Registrantmediadogg
Aim high. Ride the wind.
Registered: March 18, 2007
Reputation: Highest Rating
United States Posts: 6,461
Posted:
PM this userVisit this user's homepageEdit postDirect link to this postReply with quote
Quoting Addicted2DVD:
Quote:
OK... I seemed to mess something up.... I tried to do again... and must of copied over too much by accident or something. Could someone that has it working again post the entire code for me? I would appreciate it. Thanks!

It is only a one line change. Just go back to your original and copy / paste that one one bolded line that Matze00 posted. I think your problem is that you are trying to copy from the formatted screen. You need to "reply quote" and copy the code from the actual post, so that the line breaks don't get messed up. You will have the same problem, even if somebody reposts the whole thing. I didn't have anything before - I just used what was in this thread (original + fix one line), and it worked.
Thanks for your support.
Free Plugins available here.
Advanced plugins available here.
Hey, new product!!! BDPFrog.
 Last edited: by mediadogg
DVD Profiler Unlimited RegistrantStar ContributorAddicted2DVD
Registered: March 13, 2007
Reputation: Highest Rating
United States Posts: 17,334
Posted:
PM this userEmail this userView this user's DVD collectionEdit postDirect link to this postReply with quote
Thank You mediadogg!
I was actually copying from a quote... but what I didn't notice (guess my eyes are worse then I thought!) is that he put the line in bold... and I ended up copying the bold tags right with it! 

All is working now.

Thanks Again!
Pete
DVD Profiler Desktop and Mobile Registrantmediadogg
Aim high. Ride the wind.
Registered: March 18, 2007
Reputation: Highest Rating
United States Posts: 6,461
Posted:
PM this userVisit this user's homepageEdit postDirect link to this postReply with quote
Quoting Addicted2DVD:
Quote:
Thank You mediadogg!
I was actually copying from a quote... but what I didn't notice (guess my eyes are worse then I thought!) is that he put the line in bold... and I ended up copying the bold tags right with it! 

All is working now.

Thanks Again!

Yaaay!!!! 
Thanks for your support.
Free Plugins available here.
Advanced plugins available here.
Hey, new product!!! BDPFrog.
DVD Profiler Unlimited RegistrantMatze00
300++ HD-DVD's
Registered: March 2, 2008
Germany Posts: 33
Posted:
PM this userView this user's DVD collectionEdit postDirect link to this postReply with quote
Matze

"There are only two tragedies in life: one is not getting what one
wants, and the other is getting it."
- Oscar Wilde (1854-1900)
DVD Profiler Unlimited RegistrantAntares
Registered: May 26, 2007
Reputation: High Rating
United States Posts: 599
Posted:
PM this userView this user's DVD collectionEdit postDirect link to this postReply with quote
Quoting Matze00:
Quote:
for me the following seems to be working...



changing
Quote:


// get imdb id and check imdb for trivia
function processIMDb(triviaUrl) {
    sendRequest(triviaUrl, '', 'GET', '', function (http) {
        if (http.status === 200) {
            formatList(new RegExp('<a name=#tr\\d{7,} ></a>\n<div class="sodatext">    \n((.|\n)+?)<br>', 'gi'), http.responseText, triviaUrl);
        } else {
            alertStatus('processIMDb', http);
        }
    });
}


into
Quote:


// get imdb id and check imdb for trivia
function processIMDb(triviaUrl) {
    sendRequest(triviaUrl, '', 'GET', '', function (http) {
        if (http.status === 200) {
            formatList(new RegExp('<a name="tr\\d{7,}"></a>\n  <div class="sodatext">\n((.|\n)+?)<br />', 'gi'), http.responseText, triviaUrl);
        } else {
            alertStatus('processIMDb', http);
        }
    });
}




Thanks for your help, it's good to have this back!
DVD Profiler Unlimited RegistrantStar ContributorAddicted2DVD
Registered: March 13, 2007
Reputation: Highest Rating
United States Posts: 17,334
Posted:
PM this userEmail this userView this user's DVD collectionEdit postDirect link to this postReply with quote
For manual profiles... the current Trivia window pulls the IMDB number from the notes field.

I was wondering if anyone here that still uses this html window knows an adjustment that could be made so that if you have the IMDB link added to "My Links" that the html window could automatically pull it from there instead of having to have it both in My Links as well as the notes section.

I know absolutely noting about writing code... so any help would be greatly appreciated. 
Pete
DVD Profiler Desktop and Mobile Registrantmediadogg
Aim high. Ride the wind.
Registered: March 18, 2007
Reputation: Highest Rating
United States Posts: 6,461
Posted:
PM this userVisit this user's homepageEdit postDirect link to this postReply with quote
Hey I am way late to this party, but I just checked and I don't see My Links available in the HTML Section data variables. So, a good idea, but not possible without some development work.
Thanks for your support.
Free Plugins available here.
Advanced plugins available here.
Hey, new product!!! BDPFrog.
 Last edited: by mediadogg
    Invelos Forums->General: General Discussion Page: 1... 7 8 9  Previous   Next