View Single Post
  #215  
Old 02-04-2007, 05:13 AM
Kungfu Kungfu is offline
 
Join Date: Dec 2005
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok i modified this to a better way of doing this. Adding this code 3 or 4 times is not efficient enough for me and can get complicated. For those of you who want an easy way to do this follow this step.

in clientscript/vbulletin_textedit.js find
Code:
			case 'PHP':
			{
				this.apply_format('removeformat');
			}
Add right below that
Code:
			case 'VIDEO':
			{
			var	video = this.get_selection();

			if((video=="") || (video==null)){
				var video=prompt("MySpace, YouTube, Google video, eBaum's World or Metacafe URL","");
      }
           if (video.match("youtube.com")) 
                {
                    var col_array=video.split("?v=");
                    var part_num=1;
                    if(col_array[part_num] == null || col_array[part_num] == ""){
                    	alert("Please Highlight the Full URL!");
                    	return false;
                    }
                    return this.insert_text("[youtube]" + col_array[part_num] + "[/youtube]");
                }
           else if (video.match("myspace.com"))
                {
                    if (video.match("videoID="))
                    {
                        var col_array=video.split("videoID=");
                    }
                    else
                    {
                        var col_array=video.split("videoid=");
                    }
                    var part_num=1;
                    if(col_array[part_num] == null || col_array[part_num] == ""){
                    	alert("Please Highlight the Full URL!");
                    	return false;
                    }
                    return this.insert_text("[myspace]" + col_array[part_num] + "[/myspace]");
                } 
           else if (video.match("video.google.")) 
                {
                    var col_array=video.split("docid=");
                    var part_num=1;
                    if(col_array[part_num] == null || col_array[part_num] == ""){
                    	alert("Please Highlight the Full URL!");
                    	return false;
                    }
                    return this.insert_text("[googlevideo]" + col_array[part_num] + "[/googlevideo]");
                }
					else if (video.match("ebaumsworld.com")) {
		    						var video = video.replace(".html","");
                    var col_array = video.split("ebaumsworld.com/");
                    if(col_array[part_num] == null || col_array[part_num] == ""){
                    	alert("Please Highlight the Full URL!");
                    	return false;
                    }
                    return this.insert_text("[ebaumsvideo]" + col_array[1] + "[/ebaumsvideo]");
                }
          else if (video.match("metacafe.com")) 
                {
		    						var video = video.replace(new RegExp(/\/$/),"");
                    var col_array = video.split(new RegExp(/\/watch\//g));
                    if(col_array[part_num] == null || col_array[part_num] == ""){
                    	alert("Please Highlight the Full URL!");
                    	return false;
                    }
                    return this.insert_text("[metacafe]" + col_array[1] + "[/metacafe]");
                }
           else{
           	alert("Please Enter The Full URL!");
            return false;
           }


			return false;
		}

now in the templates editor_toolbar_on and postbit_quickedit and showthread_quickreply
find:
Code:
            <if condition="$show['img_bbcode']">
                <td><div class="imagebutton" id="{$editorid}_cmd_insertimage"><img src="$stylevar[imgdir_editor]/insertimage.gif" width="21" height="20" alt="$vbphrase[insert_image]" /></div></td>
            </if>
and add below

Code:
<td><div class="imagebutton" id="{$editorid}_cmd_wrap0_VIDEO"><img src="http://wwwstagemc.nhmccd.edu/resources/images/live/locations/mc/general/MC_video_icon.gif" width="21" height="20" alt="$vbphrase[insert_link]" /></div></td>

Install the product file and thats it. Also if they highlight the URL it will add tags, if they highlight it but it doesnt have any type of video url it will tell them to select the entire url. if they dont highlight anything it will prompt them for something.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01438 seconds
  • Memory Usage 1,792KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete