View Single Post
Old 02-23-2007, 05:44 PM  
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
this will sav you time indeed , takes a few moments to setup but once it is you wont need to setup multiplle code for diff filetypes of videos. this will cover flash or wmv or asx or anything and it wont show that stupid <click here to activate this control" in ie and you dont need to even post code . all you gotta do is surround your videos in simple bbcode type tags..

ok heres how its done.

Code:
window.onload = function(){
changeVid('div','extra');
}
function changeVid(strTag,strClass) {
	for (i=0;i<document.getElementsByTagName(strTag).length; i++) {
		if (document.getElementsByTagName(strTag).item(i).className == strClass){
kk = document.getElementsByTagName(strTag).item(i).innerHTML ;

gfyt = kk;

thid = document.getElementsByTagName(strTag).item(i).idName;

var stb1 = "stbvidw-";
var stb2 = "stbvidf-";
var stb3 = "stbvida-";
var stb4 = "-etbvid";


mpo = gfyt.search(stb1);
if(mpo != -1){
rkw = "<embed width=800 height=600 src=http://";
gfyt = replace(gfyt,stb1,rkw);
}

mpo = gfyt.search(stb2);
if(mpo != -1){
rkw = "<embed width=800 height=600 src=http://";
gfyt = replace(gfyt,stb2,rkw);
}

mpo = gfyt.search(stb3);
if(mpo != -1){
rkw = "<embed width=800 height=600 src=http://";
gfyt = replace(gfyt,stb3,rkw);
}

mpo = gfyt.search(stb4);
if(mpo != -1){
rkw = "></embed>.";
gfyt = replace(gfyt,stb4,rkw);
}

bj = document.getElementsByTagName(strTag).item(i).id;
document.getElementsByTagName(strTag).item(i).innerHTML = gfyt ;



		}
	}

}


function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}
save that as video.js add a script tag in your wordpress header like
<script src='pathto/video.js'></script>

Then edit your post template to include <div class=extra> * depending on your template this may vary just try to wrap your "xtra" div inside the post wrapper

ok now all you gotta do is post your videos like this

stbvidw-brandibelle.bangbros1.com/102/vids/01.wmv-etbvid

notice A) the video url is missing the http:// dont worry about that
B) notice the video is surround by the tags stbvidw- and end with -etbvid

this is now your simple embed code. all videos will end with the same tag -etbvid , depending on the video type you can specify the embed code to use

stbvidw- for windows media like wmv
stbvids- for flash videos
stbvida- for asx files. you can add more varities and customize the setting like width and height in the js file so you dont have to do it every time.
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote