| |
| | |

CodersClub

 Forgot password?
 Register
Search
View: 6843|Reply: 3
Collapse the left

Editor add youtube button

[Copy link]

 Taiwan

Post time: 2012-02-01 12:13
| Show all posts |Read mode
本帖最後由 ken 於 2012-2-1 13:24 編輯


post after...

Intelligent analysis of youtube url address.
Applicable to www.youtube.com and youtu.be

I only translate three languages.
as Simplified Chinese, Traditional Chinese and English.

Step.1
Add this...


Step.2
Modify file /static/js/editor.js     Line:1017
Add

  1. //Youtube Code by Ken
  2.                         case 'youtube' :
  3.                             selection = null ;
  4.                             var haveSel = selection == null || selection == false || in_array(trim(selection), ['', 'null', 'undefined', 'false' ]) ? 0 : 1;
  5.                             if(params == 1 && haveSel) {
  6.                                 return insertText((opentag + selection + closetag), strlen(opentag), strlen(closetag), true, sel);
  7.                             }
  8.                             var promptlang = custombbcodes[tag]['prompt'].split("\t");
  9.                             for(var i = 1; i <= params; i++) {
  10.                                 if(i != params || !haveSel) {
  11.                                     str += lng['youtube_url'] + '<br /><br/><input type="text" id="' + ctrlid + '_param_' + i + '" style="width: 98%" value="" class="px" />' + (i < params ? '<br />' : '');
  12.                                 }
  13.                             }
  14.                                 break;
Copy the Code
or download attachment and overwrite.

Step.3
Modify file /language/??/lang_js.js     Line: 293
Add

  1. //Youtube Code by Ken
  2.         'youtube_url'        : 'Please input youtube video url address.<br/><font color=red>include http:// </font><br/>',
  3.         'youtube_url_1'        : 'Url address must include http://',
  4.         'youtube_url_2'        : 'Url address is not youtube provide, Please re-paste again, Thanks',
  5.         'youtube_url_3'        : 'Youtube url address format error!',
Copy the Code
or download attachment and overwrite.

Step.4

Save as youtube.gif upload to u /static/image/

Step.5
Add this...


Step.6
In Details...

Replacement content:

  1. <iframe width="640" height="360" src="http://www.youtube.com/embed/{1}?hd=1&wmode=transparent" frameborder="0" allowfullscreen  wmode="Opaque"></iframe>
Copy the Code
and given the appropriate permissions.

All done! now you can input youtube url address in editor!
attachment is modify in Rev.332
hope any one can help translate it.

This post contains more resources

You have to Login for download or view attachment(s). No Account? Register

x

 Russia

Post time: 2012-02-01 16:14
| Show all posts
Media test 2:

 Russia

Post time: 2012-02-01 16:17
| Show all posts
ken,
WHY you are not satisfied with the existing solution: using [media] tag???
It allready supports youtube and other video-sites.
See my previous test posting.

The code used:
  1. [media=x,500,375]http://www.youtube.com/watch?v=ip6OBdOnSLU&feature=g-vrec&context=G246ec1eRVAAAAAAAAAw[/media]
Copy the Code
Screenshot:




I have prepared a Tutorial:
How to add Youtube Video

This post contains more resources

You have to Login for download or view attachment(s). No Account? Register

x

 Taiwan

 Author| Post time: 2012-02-06 11:37
| Show all posts
Oh, I see!
Because I found this in the chinese forum.
This code seems presence Discuz 7.2 before.
I don't know why needed this codes? if have media codes after.
You have to log in before you can reply Login | Register

Points Rules

Archive|Mobile|Dark room|CodersClub

Top.Mail.Ru
Top.Mail.Ru

2024-05-18 01:36 GMT+3 , Processed in 0.054724 sec., 9 queries .

Powered by Discuz! X3.4 Release 20230520

© 2001-2024 Discuz! Team.

MultiLingual version, Rev. 4301, © codersclub.org

Quick Reply To Top Return to the list