Page 1 of 3

Htm source editor with preview

Posted: Tue Nov 29, 2005 10:11 pm
by utopiomania
Here's another program I wrote for my own use. I mainly use notepad for editing simple html for things like the webgadget,
but wrote this to replace it. It's basically the same, but has two tabs, one for for the htm source and
one for preview.
It has a few extra items in the menus, and particularly in the context menu. With Explore and ftp in My Network places you
could easily use it to tweak your site and upload for example. :)

Code: Select all

code is in the last two posts ->

Posted: Tue Nov 29, 2005 10:37 pm
by rsts
looks interesting - right now I have to resolve a library conflict (or maybe more) before I can test.

cheers,

Posted: Tue Nov 29, 2005 10:56 pm
by utopiomania
There an [url=http://www.utopiomania.com\gate\htmeditor.exe]exe (42Kb) available here[/url], so that you can check out if the conflicts are worth resolving. :)

And heres some source to load in tab2 to check it out. Save as source.htm, rclick open. Credit to the man in line one.

Code: Select all

<html><head><meta name="Author" content="Gerard Ferrandez at http://www.dhteumeuleu.com">
<meta http-equiv="imagetoolbar" content="no">
<style type="text/css">
	body {cursor:crosshair;margin:0; padding:0; position:absolute; overflow:hidden; background:#000; left:0; top:0; width:100%; height:100%;}
	span {position: absolute; font-family: verdana; text-align: center; font-weight: bold;}
</style>

<script type="text/javascript"><!--
window.onerror = new Function("return true");
document.onselectstart = new Function("return false");
screen.bufferDepth = 16; object = new Array();

function zOOm(){
	with (this) {
		k += .1;
		for(i=0;i<obj.length;i++){
			t = mini + maxi + Math.cos(k + i / amp) * maxi;
			with(obj[i].style){
				zIndex = Math.round(t*10); top = Math.round(-t/chu); fontSize = Math.round(t);
				c = t*200/(2*maxi+mini);
				if(inv)c = 255-c;
				color = "RGB("+Math.round(c*cR)+","+Math.round(c*cG)+","+Math.round(c*cB)+")";
			}
		}
		setTimeout(sto,16);
	}
}

function CObj(N,obj,txt,amp,mini,maxi,cR,cG,cB,inv,chu){
	this.N = N;
	for(i=0;i<txt.length;i++){
		c = txt.charAt(i);
		o = document.createElement("span"); o.onmousedown = new Function("return false");
		o.style.left = Math.round(mini * i * 1.5); b = document.createElement("div");
		b.innerHTML = c; b.style.position = "absolute"; b.style.left = -250;
		b.style.width = 300; o.appendChild(b); obj.appendChild(o);
	}
	this.obj  = obj.getElementsByTagName("span");
	this.k    = 0; this.cR   = cR; this.cG   = cG; this.cB   = cB; this.inv  = inv; this.amp  = amp;
	this.mini = mini;	this.maxi = maxi;	this.chu  = chu; this.sto  = "object["+N+"].zOOm();";
	this.zOOm = zOOm;	setTimeout(this.sto,32);
}

onload = function() {
	object[0] = new CObj(0,document.getElementById("T1"),"P*U*R*E*B*A*S*I*C",1.2,25,50,2,0,2,1,0.8);
	object[1] = new CObj(1,document.getElementById("T2"),"H*T*M*E*D*I*T*O*R",1.2,25,50,3,1,0,1,6.4);
}
//-->
</script></head>

<body><span style="position:absolute;left:50%;top:50%">
	<span id="T1" style="position: absolute; top: 0px; left:-200px; width: 400px"></span>
	<span id="T2" style="position: absolute; top: 0px; left:-200px; width: 400px"></span>
</span></body></html>

Posted: Tue Nov 29, 2005 11:34 pm
by rsts
Many thanks.

definately worth resolving the conflict(s).

That source is WILD 8)

cheers


Hmm - may need some way to stop the preview - it's eating my cpu :D

Posted: Wed Nov 30, 2005 12:15 am
by thefool
cant download..
:/

Posted: Wed Nov 30, 2005 12:21 am
by utopiomania
:?: Try again, there should be PLENTY of bandwith available, I can dl it everytime.

Posted: Wed Nov 30, 2005 12:23 am
by thefool
cant.. dunno why

Posted: Wed Nov 30, 2005 12:25 am
by traumatic

Posted: Wed Nov 30, 2005 4:39 am
by dagcrack
why HTM when it's HTML? :lol:
Anyway, let the user see a preview with out having to save the script (dont ask for any input, if its not saved, save a temp one then erase when the preview has finished)..

Posted: Wed Nov 30, 2005 4:57 am
by rsts
dagcrack wrote:why HTM when it's HTML? :lol:
For additional discussion try
http://jeremy.zawodny.com/blog/archives/000481.html

let's not turn this forum into a debate area :)


"Kim said:
File extensions?

Do some work and stop wasting time.

;) "

cheers

Posted: Wed Nov 30, 2005 5:13 am
by dagcrack
Uh I'm sure the "lol" emoticon was placed in there for some reason...
In my case I use .fck ;) http://www.gushh.com.ar/hit/hello.fck

Posted: Wed Nov 30, 2005 8:43 am
by utopiomania
@dagcrack, it recognises both htm and html extensions. If you save a new file without an extension, it will
use .htm for 8.3 compatibility and to save one byte. :?

As for save preview, saving to a temp file can mess up page navigation, and since it was written to replace
Notepad and the Ctrl-s, Exit, click IExplorer, refresh sequence I think this is ok.

Posted: Wed Nov 30, 2005 10:24 pm
by utopiomania
Hmm - may need some way to stop the preview - it's eating my cpu
Fixed.

Posted: Fri Dec 02, 2005 6:44 pm
by dell_jockey
Perhaps code editors shouldn't default to a proportional font, in my case it's Times Roman that gets used. Otherwise, great work!

Thanks!

Posted: Fri Dec 02, 2005 10:09 pm
by rsts
Hmm - line 1019 closegadgetlist() without opengadgetlist() :?

Clean 3.94 install.

Any ideas what I've done wrong?

cheers