Author |
Topic |
|
JDommi
Administrator
Germany
4638 Posts |
Posted - 21 Mar 2011 : 16:04:05
|
Well, the function seems to work - except an or-statement. Sometimes the AKA contains " - Germany" and sometimes " - West Germany". When I change case (srcLang="de"): srcTerm = '.-.Germany'; break; to case (srcLang="de"): srcTerm = '.-.Germany|.-.West.Germany'; break; and var lng = new RegExp("^.*"+srcTerm+".*$","m"); to var lng = new RegExp("^.*("+srcTerm+").*$","m"); then the result shows a doubled (West) Germany.
<script type="text/javascript">
var srcLang = window.navigator.systemLanguage;
var srcTerm = null;
switch (srcLang) {
case (srcLang="de"): srcTerm = '.-.Germany'; break;
case (srcLang="it"): srcTerm = '.-.Italy'; break;
case (srcLang="es-ar"): srcTerm = '.-.Argentina'; break;
case (srcLang="es"): srcTerm = '.-.Spain'; break;
case (srcLang="fr"): srcTerm = '.-.France'; break;
case (srcLang="pl"): srcTerm = '.-.Poland'; break;
default: srcTerm = '';
}
if (srcTerm != '') {
var Custom9 = '_MOVIE_CUSTOMFIELD9_';
var lng = new RegExp("^.*"+srcTerm+".*$","m");
Custom9 = Custom9.replace(/\<br\>/g, "\n");
Custom9 = Custom9.match(lng);
if (Custom9 != null) {
document.write("AKA: " + Custom9);
}
}
</script> |
In order to achieve what is possible, you have to try the impossible over and over again. Hermann Hesse |
|
|
Prinz
Senior Member
Germany
1522 Posts |
Posted - 21 Mar 2011 : 16:29:01
|
Those search terms won't work in many cases anyway.
Only 2 Examples for German titles (Movies from my Database):
- Austria / Germany - Argentina / Canada (French title) / Denmark / Finland / France / Germany / Greece (imdb display title) / Norway / Poland (imdb display title) / Portugal / Spain / Turkey (Turkish title)
It's not always only one Country behind the - |
Edited by - Prinz on 21 Mar 2011 16:29:25 |
|
|
JDommi
Administrator
Germany
4638 Posts |
Posted - 21 Mar 2011 : 16:39:04
|
I know, because of this I wanted to use the | in the regexp. But I don't get the OR to work :( |
In order to achieve what is possible, you have to try the impossible over and over again. Hermann Hesse |
|
|
Prinz
Senior Member
Germany
1522 Posts |
Posted - 21 Mar 2011 : 16:52:39
|
This should work:
<a style="display:none;" id='MCustom9'>_MOVIE_CUSTOMFIELD9_</a>
<script type="text/javascript">
var srcLang = window.navigator.systemLanguage;
var srcTerm = null;
switch (srcLang) {
case (srcLang="de"): srcTerm = '.-.[^-]*Germany'; break;
case (srcLang="it"): srcTerm = '.-.[^-]*Italy'; break;
case (srcLang="es-ar"): srcTerm = '.-.[^-]*Argentina'; break;
case (srcLang="es"): srcTerm = '.-.[^-]*Spain'; break;
case (srcLang="fr"): srcTerm = '.-.[^-]*France'; break;
case (srcLang="pl"): srcTerm = '.-.[^-]*Poland'; break;
default: srcTerm = '';
}
if (srcTerm != '') {
var Custom9 = $('#MCustom9').html();
var reldate = Custom9.indexOf('Release Dates:');
if (reldate != -1) {Custom9=Custom9.substring(0,reldate)}
var lng = new RegExp("^.*"+srcTerm+".*$","m");
Custom9 = Custom9.replace(/\<BR\>/g, "\n");
Custom9 = Custom9.match(lng);
if (Custom9 != null) {
document.write("AKA: " + Custom9);
}
}
</script> |
Edited by - Prinz on 21 Mar 2011 17:10:14 |
|
|
JDommi
Administrator
Germany
4638 Posts |
Posted - 21 Mar 2011 : 17:14:03
|
Great! Now it works for all. Only thing still is needed: a beforelast "-" for very much countries or for this example: Capricorn One AKA: Unternehmen Capricorn - West Germany Release Dates: 2 June 1978 (USA) 26 July 1978 (France) 27 July 1978 (Australia) 3 August 1978 (West Germany)
*EDIT* *lol* you was one time more faster ;) But still missing beforelast "-" and the comparison if the AKA is identical to title or original title... then it would be perfect! |
In order to achieve what is possible, you have to try the impossible over and over again. Hermann Hesse |
Edited by - JDommi on 21 Mar 2011 17:21:18 |
|
|
Prinz
Senior Member
Germany
1522 Posts |
Posted - 21 Mar 2011 : 17:27:41
|
quote: Originally posted by JDommi But still missing beforelast "-"
Don't know what you mean.
quote: and the comparison if the AKA is identical to title or original title... then it would be perfect!
And what should happen if it is?
Now i have to take a little break, will be back in 2-3 hours. |
|
|
JDommi
Administrator
Germany
4638 Posts |
Posted - 21 Mar 2011 : 17:45:55
|
Allow yourself the break !!!
I meant: AKAtitle = Beforelast(AKAtitle," - ") => keep string before last occurence of " - " like strrpos in php if (AKAtitle != MovieTitle) or (AKAtitle != OriginalTitle) {document.write}
*EDIT* Why do these code snippets do not work??? Custom9 = Custom9.match(lng); var reldate = Custom9.lastIndexOf(' - '); if (reldate != -1) {Custom9=Custom9.substring(0,reldate)}
var Custom9 = Custom9.match(lng); Custom9 = Custom9.match(/.*.-./g);
|
In order to achieve what is possible, you have to try the impossible over and over again. Hermann Hesse |
Edited by - JDommi on 21 Mar 2011 18:28:18 |
|
|
Prinz
Senior Member
Germany
1522 Posts |
Posted - 21 Mar 2011 : 19:09:46
|
As a Result you get back a Array of Strings. So you have to search the first result only [0].
<a style="display:none;" id='MCustom9'>_MOVIE_CUSTOMFIELD9_</a>
<script type="text/javascript">
var srcLang = window.navigator.systemLanguage;
var srcTerm = null;
switch (srcLang) {
case (srcLang="de"): srcTerm = '.-.[^-]*Germany'; break;
case (srcLang="it"): srcTerm = '.-.[^-]*Italy'; break;
case (srcLang="es-ar"): srcTerm = '.-.[^-]*Argentina'; break;
case (srcLang="es"): srcTerm = '.-.[^-]*Spain'; break;
case (srcLang="fr"): srcTerm = '.-.[^-]*France'; break;
case (srcLang="pl"): srcTerm = '.-.[^-]*Poland'; break;
default: srcTerm = '';
}
if (srcTerm != '') {
var Custom9 = $('#MCustom9').html();
var reldate = Custom9.indexOf('Release Dates:');
if (reldate != -1) {Custom9=Custom9.substring(0,reldate)}
var lng = new RegExp("^.*"+srcTerm+".*$","m");
Custom9 = Custom9.replace(/\<BR\>/g, "\n");
Custom9 = Custom9.match(lng);
var reldate = Custom9[0].lastIndexOf(' - ');
if (reldate != -1) {Custom9[0]=Custom9[0].substring(0,reldate)}
if (Custom9 != null) {
document.write("AKA: " + Custom9[0]);
}
}
</script> |
|
|
Prinz
Senior Member
Germany
1522 Posts |
Posted - 21 Mar 2011 : 19:17:42
|
Were on the Movie Card should i add the AKA Title? |
|
|
JDommi
Administrator
Germany
4638 Posts |
Posted - 21 Mar 2011 : 19:23:17
|
aargh, I'm really too stupid! I haven't remembered that the match result returns an array. I really need "delphi for html" *ggg* |
In order to achieve what is possible, you have to try the impossible over and over again. Hermann Hesse |
|
|
JDommi
Administrator
Germany
4638 Posts |
Posted - 21 Mar 2011 : 19:26:21
|
I would place it right behind or under the original title
Must it not be: if (Custom9[0] != null) { document.write("AKA: " + Custom9[0]); } } </script> |
In order to achieve what is possible, you have to try the impossible over and over again. Hermann Hesse |
Edited by - JDommi on 21 Mar 2011 19:28:08 |
|
|
Prinz
Senior Member
Germany
1522 Posts |
|
JDommi
Administrator
Germany
4638 Posts |
Posted - 21 Mar 2011 : 20:18:08
|
If you were a Prinzessin I would give you a big :-* |
In order to achieve what is possible, you have to try the impossible over and over again. Hermann Hesse |
|
|
Prinz
Senior Member
Germany
1522 Posts |
|
JDommi
Administrator
Germany
4638 Posts |
Posted - 21 Mar 2011 : 21:29:31
|
Yes, but fortunately not all have to be used. The list is already on my desktop... but we have to compare which codes are really as important as Afrikaans |
In order to achieve what is possible, you have to try the impossible over and over again. Hermann Hesse |
|
|
Prinz
Senior Member
Germany
1522 Posts |
Posted - 22 Mar 2011 : 11:41:57
|
- Added JDommi's Studio pics to the zip - Added a protection against wrong Data to the AKA Title Function (AKA Titles with 150 and more chars will be ignored as wrong Data. I don't think that any Title is that long.)
http://www.mediafire.com/download.php?ccrhy1bv4a9s3rc |
|
|
JDommi
Administrator
Germany
4638 Posts |
|
Prinz
Senior Member
Germany
1522 Posts |
Posted - 23 Mar 2011 : 22:34:12
|
Found another Bug in the Awards Display (Movie Card). Sometimes the Tooltip is wrong. I'm trying to fix it. |
|
|
Prinz
Senior Member
Germany
1522 Posts |
|
Prinz
Senior Member
Germany
1522 Posts |
|
Topic |
|
|