Page 1 of 1

Remove text

Posted: 2007-10-17 23:54:59
by sweborn
How do i remove the text between <i style=" display: none;"> and </i> when i grab from the website discshop.se.
It is always a diffrent textstring so StringReplace dosn't works.
Is there a way to hide it in description?
I'm using the discshop.se script.

Posted: 2007-10-18 06:03:16
by bad4u
It should be possible to use "TextBetween" in a "StringReplace" function, so you don't need to know the exact string you want to replace.

Code: Select all

Value := StringReplace(Value, TextBetween(Value, '<i style=" display: none;">', '</i>'),'');
But I do not find the code you mentioned in your posting on the films' details page.. can you give an example URL ? Or are you talking about the

Code: Select all

    <SCRIPT language="javascript" type="text/javascript">
		disableSelection(document.getElementById("text_handling"));
	</script>
part, that is imported into description field ?

Posted: 2007-10-18 12:12:10
by sweborn
I got it to work. The website actual generate different codes on every updates. They really don't want anyone to copy it even if it's for private use.
Here is the code i use for "description":

Code: Select all

if CanSetField(fieldDescription) then
  begin
    Value := TextBetween(PageText,'Filmens handling:', '<BR>');
    if Value = '' then Value := TextBetween(PageText, 'Beskrivning:', '<BR>');
    Value := TextAfter(Value, '<br>');
    Value := StringReplace(Value, '    ', '');
    Value := StringReplace(Value, 'disableSelection(document.getElementById("text_handling"));', '');
    Value := StringReplace(Value, TextBetween(Value, '<span style="display: none;">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style=" display: none;">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style=" display: none">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style="display: none">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style="display: none;">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style=" display: none;">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style=" display: none">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style="display: none">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style="display: none;">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style=" display: none;">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style=" display: none">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style="display: none">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span class="infoText1234">', '</span>'),'');
    Value := StringReplace(Value, '<FONT COLOR="white">i</FONT>', ' ');
    Value := StringReplace(Value, #13#10,'');
    Value := StringReplace(Value, #09,'');
    Value := StringReplace(Value, '<br>', #13#10);
    HTMLRemoveTags(Value);
    HTMLDecode(Value);
    SetField(fieldDescription, Value);
  end;
Thanks for your help bad4u