The Best Cyprus Community

Skip to content


Create your own HTML menu of your favorite YouTube videos.

Anything related to the Internet, computers and technology in general.

Re: Create your own HTML menu of your favorite YouTube video

Postby Get Real! » Sat Oct 20, 2012 3:35 pm

FragnaticDeath wrote:Nice GetReal :)

You’re welcome Fraggy…
User avatar
Get Real!
Forum Addict
Forum Addict
 
Posts: 48333
Joined: Mon Feb 26, 2007 12:25 am
Location: Nicosia

Re: Create your own HTML menu of your favorite YouTube video

Postby Get Real! » Mon Oct 22, 2012 3:54 am

Ok, we now have 3D buttons with shadowed labels in triple scrolling columns and a fancy program title so here’s the latest version followed by an image.

{$A+,B-,D-,E-,F-,G+,I-,K-,L-,N+,O-,P-,Q-,R-,S-,T-,V-,W-,X-,Y-}
{$M 8192,0,0}

PROGRAM YouTubeMaker; {Takes a list of song titles & links to create a HTML menu}
USES Dos;
{---------------------------------------------------------}
PROCEDURE DeleteFile(CONST S:String);
VAR F:File;
BEGIN Assign(F,S); SetFAttr(F,$20); Erase(F); END;
{---------------------------------------------------------}
PROCEDURE ReplaceStr(VAR S1:String; S2:String; CONST S3:String);
VAR P:Byte; Ch:Char;
BEGIN
IF S2<>S3 THEN
BEGIN
IF Pos(S2,S3)>0 THEN
BEGIN
Ch:=#0;
WHILE (Pos(Ch,S1)>0) OR (Pos(Ch,S2)>0) DO Inc(Ch);
ReplaceStr(S1,S2,Ch); S2:=Ch;
END;
P:=0;
WHILE Pos(S2,S1)>0 DO
BEGIN
P:=Pos(S2,S1);
Delete(S1,P,Length(S2));
Insert(S3,S1,P);
END;
END;
END;
{---------------------------------------------------------}
VAR F1,F2,F3,F4:Text; S1,S2,S:String; N:Integer;
BEGIN
N:=0;
Assign(F3,'Titles.txt'); Rewrite(F3);
Assign(F4,'Links.txt'); Rewrite(F4);
Assign(F1,'Mylist.txt'); Reset(F1);
WHILE NOT EOF(F1) DO
BEGIN
Readln(F1,S);
IF S<>'' THEN
BEGIN
Inc(N);
IF Odd(N) THEN
BEGIN
ReplaceStr(S,'''','\''');
ReplaceStr(S,'"','');
Writeln(F3,''''+S+''',');
END ELSE
BEGIN
Writeln(F4,''''+S+''',');
END;
END ELSE;
END;
Close(F1); Close(F3); Close(F4);
N:=N SHR 1;
Assign(F2,'Mylist.html'); Rewrite(F2);

Writeln(F2,'<!DOCTYPE html>');
Writeln(F2,'<html>');
Writeln(F2,'<body bgcolor="#0B2F3A"></body>');
Writeln(F2,'');
Writeln(F2,'<style type="text/css">');
Writeln(F2,'.Message {');
Writeln(F2,'Font-family: Comic Sans MS;');
Writeln(F2,'Font-size: 12px;');
Writeln(F2,'Font-weight: Normal;');
Writeln(F2,'Font-style: Normal;');
Writeln(F2,'Text-decoration: None;');
Writeln(F2,'Text-align: Center;');
Writeln(F2,'Color: #FFFFFF;');
Writeln(F2,'Text-shadow: 1px 1px 2px #000;');
Writeln(F2,'Filter:Shadow(Color=#000000 ,Strength=1);');
Writeln(F2,'Height:0;}');
Writeln(F2,'');
Writeln(F2,'.WinButton {');
Writeln(F2,'-moz-box-shadow: 3px 3px 4px #000;');
Writeln(F2,'-webkit-box-shadow: 3px 3px 4px #000;');
Writeln(F2,'box-shadow: 3px 3px 4px #000;');
Writeln(F2,'/* For IE 8 */');
Writeln(F2,'-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=90, Color='#000000')";');
Writeln(F2,'/* For IE 5.5 - 7 */');
Writeln(F2,'filter: progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=90, Color='#000000');');
Writeln(F2,'Cursor: Hand;');
Writeln(F2,'Padding: 0px;');
Writeln(F2,'Font-family: Comic Sans MS;');
Writeln(F2,'Font-size: 13px;');
Writeln(F2,'Font-weight: Normal;');
Writeln(F2,'Font-style: Normal;');
Writeln(F2,'Text-decoration: None;');
Writeln(F2,'Text-align: Center;');
Writeln(F2,'Color: #FFFFFF;');
Writeln(F2,'Background-color: #686868;');
Writeln(F2,'Border-style: ;');
Writeln(F2,'Border-color: #A0A0A0;');
Writeln(F2,'Border-width: 1px;');
Writeln(F2,'Text-shadow: 1px 1px 2px #000;');
Writeln(F2,'Filter:Shadow(Color=#000000 ,Strength=1);');
Writeln(F2,'Height:0;}');
Writeln(F2,'</style>');
Writeln(F2,'');
Writeln(F2,'<img src="YourTube.png"; style="position:absolute; top:15px; left:10px;">');
Write(F2,'<a href="javascript:window.scrollTo(0,7000);"; style="position:absolute; Top:10px; left:930px;" ');
Writeln(F2,'Title="Go to the end"; Class="Message";>[Bottom]</a>');
Writeln(F2,'');
Writeln(F2,'<script type="text/javascript">');
Writeln(F2,'function RunURL(URL,Name) {');
Writeln(F2,'window.open (URL,Name,');
Writeln(F2,'"Width=1010,\');
Writeln(F2,'Height=800,\');
Writeln(F2,'Top=0,\');
Writeln(F2,'Left=0,\');
Writeln(F2,'Channelmode=0,\');
Writeln(F2,'Titlebar=0,\');
Writeln(F2,'Menubar=0,\');
Writeln(F2,'Toolbar=0,\');
Writeln(F2,'Directories=0,\');
Writeln(F2,'Location=0,\');
Writeln(F2,'Status=0,\');
Writeln(F2,'Scrollbars=1,\');
Writeln(F2,'Resizable=1,\');
Writeln(F2,'Fullscreen=0");');
Writeln(F2,'}');

Writeln(F2,'document.write(''<form>'');');
Writeln(F2,'');
Writeln(F2,'var Titles = new Array(');

Assign(F3,'Titles.txt'); Reset(F3);
WHILE NOT EOF(F3) DO
BEGIN
Readln(F3,S);
Writeln(F2,S);
END;
Close(F3);
DeleteFile('Titles.txt');

Writeln(F2,''''');');
Writeln(F2,'');
Writeln(F2,'var Links = new Array(');

Assign(F4,'Links.txt'); Reset(F4);
WHILE NOT EOF(F4) DO
BEGIN
Readln(F4,S);
Writeln(F2,S);
END;
Close(F4);
DeleteFile('Links.txt');

Writeln(F2,''''');');
Writeln(F2,'');

Writeln(F2,'var X=0; var Y=80;');
Writeln(F2,'for (i=0; i<',N,'; i++){');
Write(F2,'document.write(''<input Type="button" Class="WinButton" Title="''+Titles[i]+''"; ');
Write(F2,'Style="Position:Absolute; Width:320px; Height:24px; Left:''+(X*330+10)+''px; Top:''+Y+''px;"; ');
Writeln(F2,'Value="''+Titles[i]+''"; OnClick="RunURL(\''''+Links[i]+''\'')";/>'');');
Writeln(F2,'X++; if (X>2) {X=0; Y=Y+32;}}');

Writeln(F2,'document.write("<br>");');

Writeln(F2,'document.write(''</form>'');');
Writeln(F2,'</script>');

Writeln(F2,'</html>');
Close(F2);
END.


So what does the finished product look like? A lot better than this image… :wink:
YourTube.jpg
User avatar
Get Real!
Forum Addict
Forum Addict
 
Posts: 48333
Joined: Mon Feb 26, 2007 12:25 am
Location: Nicosia

Re: Create your own HTML menu of your favorite YouTube video

Postby yialousa1971 » Mon Oct 22, 2012 4:22 am

^^^^^^^^^^^
:lol: :lol: :lol: :lol: :lol: :lol:
User avatar
yialousa1971
Main Contributor
Main Contributor
 
Posts: 6257
Joined: Sat Aug 30, 2008 2:55 pm
Location: With my friends on the Cyprus forum

Re: Create your own HTML menu of your favorite YouTube video

Postby kurupetos » Mon Oct 22, 2012 12:14 pm

yialousa1971 wrote:^^^^^^^^^^^
:lol: :lol: :lol: :lol: :lol: :lol:

GR! also created GayTube. :mrgreen:
User avatar
kurupetos
Leading Contributor
Leading Contributor
 
Posts: 18855
Joined: Tue Jul 31, 2007 7:46 pm
Location: Cyprus

Re: Create your own HTML menu of your favorite YouTube video

Postby wyoming cowboy » Mon Oct 22, 2012 4:47 pm

Ok, we now have 3D buttons with shadowed labels in triple scrolling columns and a fancy program title so here’s the latest version followed by an image.


one of the more interesting threads ive seen in a very long time.. it kind of touches the edges of insanity when you read through it. :idea:
User avatar
wyoming cowboy
Regular Contributor
Regular Contributor
 
Posts: 1756
Joined: Thu Dec 11, 2008 2:15 am

Re: Create your own HTML menu of your favorite YouTube video

Postby Get Real! » Mon Oct 22, 2012 7:01 pm

wyoming cowboy wrote:
Ok, we now have 3D buttons with shadowed labels in triple scrolling columns and a fancy program title so here’s the latest version followed by an image.


one of the more interesting threads ive seen in a very long time.. it kind of touches the edges of insanity when you read through it. :idea:

The thread is like 90% source code so I’m not surprised it touched the edge of insanity for you! :lol:

Have you ever seen a 3GL generating Web script before?
User avatar
Get Real!
Forum Addict
Forum Addict
 
Posts: 48333
Joined: Mon Feb 26, 2007 12:25 am
Location: Nicosia

Re: Create your own HTML menu of your favorite YouTube video

Postby Get Real! » Mon Oct 22, 2012 7:14 pm

Tonight I’ll create the ability for the user to create categories of music such as “80s” or “John Denver”, or “Reggae” etc. To do this I’ll utilize an old technique we call “string parsing” which is basically the technique of reading through a text file or block of text and extracting information from it without anything being left to chance.

To create a category all the user will have to do is add a “---“ and followed by some text for the category name in his song list. The song list would now look like this…


Gloria Gaynor - Can't take my eyes off you
http://www.youtube.com/watch?v=uuvPvUmEzoE
10 CC - I'm Not In Love
http://www.youtube.com/watch?v=Y2BavhwpIJg
Promises - Baby It's You
http://www.youtube.com/watch?v=-pJVdIKHO8o
---Miscellaneous
Evanescence - My Immortal
http://www.youtube.com/watch?v=5anLPw0Efmo
Boney M - Kalimba De Luna
http://www.youtube.com/watch?v=8JEjMW-Frqc



Note that we now have a new category called “Miscellaneous” to take into consideration so string parsing will enable us to differentiate between a …

1. URL
2. Song Title
3. Category

…and each of these have to be handled differently as we read them in. Ok that’s all I’m gonna bore you with for now and onto happy programming to see this through.
User avatar
Get Real!
Forum Addict
Forum Addict
 
Posts: 48333
Joined: Mon Feb 26, 2007 12:25 am
Location: Nicosia

Re: Create your own HTML menu of your favorite YouTube video

Postby Get Real! » Mon Oct 22, 2012 7:45 pm

At its most primitive the string parsing could look like this: (inserted dots are to preserve indenting)

.IF Pos('http://',S)=1 THEN {<- Is it an internet address?}
..BEGIN

..END ELSE
...IF Pos('---',S)=1 THEN {<- Is it a song category?}
....BEGIN

....END ELSE {<- Well then it must be a song title!}
.....BEGIN

.....END;

:wink:

NB: We have already trimmed spaces and tabs at both ends of the string so our tests MUST return true at the first position (character) of the string.
User avatar
Get Real!
Forum Addict
Forum Addict
 
Posts: 48333
Joined: Mon Feb 26, 2007 12:25 am
Location: Nicosia

Re: Create your own HTML menu of your favorite YouTube video

Postby Get Real! » Mon Oct 22, 2012 8:24 pm

kurupetos wrote:
yialousa1971 wrote:^^^^^^^^^^^
:lol: :lol: :lol: :lol: :lol: :lol:

GR! also created GayTube. :mrgreen:

Yes, admittedly I was hired by the Greek government to create a database of their patriots and heroes.
User avatar
Get Real!
Forum Addict
Forum Addict
 
Posts: 48333
Joined: Mon Feb 26, 2007 12:25 am
Location: Nicosia

Re: Create your own HTML menu of your favorite YouTube video

Postby Get Real! » Tue Oct 23, 2012 3:23 am

Stage5:

1. Rounded buttons option (I’m not too keen on these!)
2. Easy song categories
3. Very forgiving and auto correcting parsing of the user’s song list.
4. Tested ok in several browsers.
5. Embedded logo.

The parsing section was pretty hard…

{------------------Parsing------------------}
IF Pos('http://',S)=1 THEN {Internet address}
BEGIN
IF Last<>1 THEN Writeln(F3,''''+'Untitled'+''',');
Writeln(F4,''''+S+''','); Last:=2;
END ELSE
BEGIN
ReplaceStr(S,'??','?');
ReplaceStr(S,'\','');
ReplaceStr(S,'=','');
ReplaceStr(S,'''','\''');
ReplaceStr(S,'"','');
IF Pos('---',S)=1 THEN {Category}
BEGIN
IF Last=1 THEN Writeln(F4,''''+'http://www.youtube.com/'+''',');
Z:=Copy(S,4,Length(S)-3);
ReplaceStr(Z,'-','');
IF Z='' THEN Z:='Untitled Category';
Writeln(F3,''''+Z+''',');
Writeln(F4,''''+'-'+''',');
Last:=3;
END ELSE {Song title}
BEGIN
IF Last=1 THEN Writeln(F4,''''+'http://www.youtube.com/'+''',');
Writeln(F3,''''+S+''',');
Last:=1;
END;
END;
{---------------------------------------------}


41842.jpg
User avatar
Get Real!
Forum Addict
Forum Addict
 
Posts: 48333
Joined: Mon Feb 26, 2007 12:25 am
Location: Nicosia

PreviousNext

Return to Internet, Computers and Technology

Who is online

Users browsing this forum: No registered users and 0 guests