Browse Source

Update youtube plugin

jmontoyaa 7 years ago
parent
commit
a634a2c805

BIN
main/inc/lib/javascript/ckeditor/plugins/youtube/images/icon.png


+ 1 - 0
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/ar.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'ar', {
 	chkPrivacy : 'تفعيل وضع تحسين الخصوصية',
 	chkOlderCode : 'استخدم شيفرة التضمين القديمة',
 	chkAutoplay : 'Autoplay',
+	chkControls: 'إظهار عناصر التحكم بالمشغّل',
 	noCode : 'يجب عليك ادخال شيفرة التضمين او الرابط',
 	invalidEmbed : 'شيفرة التضمين التي قمت بإدخالها تبدو غير صحيحة',
 	invalidUrl : 'الرابط الذي قمت بإدخاله يبدو غير صحيح',

+ 1 - 0
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/de.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'de', {
 	chkPrivacy : 'Erweiterten Datenschutzmodus aktivieren',
 	chkOlderCode : 'Benutze alten Embed Code',
 	chkAutoplay : 'Autoplay',
+	chkControls : 'Player-Steuerelemente anzeigen',
 	noCode : 'Sie müssen einen Embed Code oder URL angeben',
 	invalidEmbed : 'Der angegebene Embed Code scheint nicht gültig zu sein.',
 	invalidUrl : 'Die angegebene URL scheint nicht gültig zu sein.',

+ 1 - 0
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/el.js

@@ -10,6 +10,7 @@
     chkPrivacy: 'Ενεργοποίηση λειτουργίας ενισχυμένου απορρήτου',
     chkOlderCode: 'Χρήση παλαιού κώδικα ενσωμάτωσης',
     chkAutoplay: 'Αυτόματη εκκίνηση',
+    chkControls: 'Εμφάνιση στοιχείων ελέγχου προγράμματος αναπαραγωγής',
     noCode: 'Χρειάζεται κώδικας ενσωμάτωσης ή URL',
     invalidEmbed: 'Ο κώδικας ενσωμάτωσης που εισήγατε δεν μοιάζει σωστός',
     invalidUrl: 'Το URL που εισήγατε δεν μοιάζει σωστό',

+ 3 - 1
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/en.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'en', {
 	chkPrivacy : 'Enable privacy-enhanced mode',
 	chkOlderCode : 'Use old embed code',
 	chkAutoplay: 'Autoplay',
+	chkControls: 'Show player controls',
 	noCode : 'You must input an embed code or URL',
 	invalidEmbed : 'The embed code you\'ve entered doesn\'t appear to be valid',
 	invalidUrl : 'The URL you\'ve entered doesn\'t appear to be valid',
@@ -19,5 +20,6 @@ CKEDITOR.plugins.setLang('youtube', 'en', {
 	noHeight : 'You must inform the height',
 	invalidHeight : 'Inform a valid height',
 	invalidTime : 'Inform a valid start time',
-	txtResponsive : 'Make Responsive (ignore width and height, fit to width)'
+	txtResponsive : 'Make Responsive (ignore width and height, fit to width)',
+	txtNoEmbed : 'Video image and link only'
 });

+ 1 - 0
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/fr.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'fr', {
 	chkPrivacy : 'Activer la protection de la vie privée',
 	chkOlderCode : 'Utiliser l\'ancien code embed',
 	chkAutoplay : 'Autoplay',
+	chkControls : 'Afficher les commandes du lecteur',
 	noCode : 'Vous devez entrer un code embed ou une url',
 	invalidEmbed : 'Le code embed est invalide',
 	invalidUrl : 'L\'url est invalide',

+ 1 - 0
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/hu.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'hu', {
 	chkPrivacy : 'Fokozott adatvédelmi mód engedélyezése',
 	chkOlderCode : 'Régi beágyazott kód használata',
 	chkAutoplay : 'Automatikus lejátszás',
+	chkControls : 'Lejátszásvezérlők mutatása',
 	noCode : 'A beágyazott kód, vagy az URL megadása kötelező',
 	invalidEmbed : 'A beágyazott kód érvénytelen',
 	invalidUrl : 'A megadott URL érvénytelen',

+ 1 - 0
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/it.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'it', {
 	chkPrivacy : 'Abilita la protezione della privacy',
 	chkOlderCode : 'Usa il vecchio codice di incorporamento',
 	chkAutoplay : 'Autoplay',
+	chkControls : 'Mostra i controlli del player',
 	noCode : 'Devi inserire un codice di incorporamento o un URL',
 	invalidEmbed : 'Il codice di incorporamento inserito non sembra valido',
 	invalidUrl : 'L\'URL inserito non sembra valido',

+ 4 - 3
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/ja.js

@@ -6,10 +6,11 @@ CKEDITOR.plugins.setLang('youtube', 'ja', {
 	txtWidth : '幅',
 	txtHeight : '高さ',
 	chkRelated : '動画が終わったら関連動画を表示する',
-	txtStartAt : 'Start at',
+	txtStartAt : '開始時間(秒)',
 	chkPrivacy : 'プライバシー強化モードを有効にする',
 	chkOlderCode : '以前の埋め込みコードを使用する',
 	chkAutoplay : '自動再生',
+	chkControls: 'プレーヤーのコントロールを表示する',
 	noCode : '埋め込みコードまたはURLを入力してください',
 	invalidEmbed : '不適切な埋め込みコードが入力されました',
 	invalidUrl : '不適切なURLが入力されました',
@@ -18,6 +19,6 @@ CKEDITOR.plugins.setLang('youtube', 'ja', {
 	invalidWidth : '幅指定に誤りがあります',
 	noHeight : '高さを指定してください',
 	invalidHeight : '高さ指定に誤りがあります',
-	invalidTime : 'Inform a valid start time',
-	txtResponsive : 'Responsive video'
+	invalidTime : '開始時間を正の整数で入力してください',
+	txtResponsive : 'レスポンシブ表示'
 });

+ 3 - 1
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/nl.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'nl', {
 	chkPrivacy : 'Privacy-enhanced mode inschakelen',
 	chkOlderCode : 'Gebruik oude embedcode',
 	chkAutoplay: 'Automatisch starten',
+	chkControls: 'Afspeelbediening weergeven',
 	noCode : 'U moet een embedcode of url ingeven',
 	invalidEmbed : 'De ingegeven embedcode lijkt niet geldig',
 	invalidUrl : 'De ingegeven url lijkt niet geldig',
@@ -19,5 +20,6 @@ CKEDITOR.plugins.setLang('youtube', 'nl', {
 	noHeight : 'U moet een hoogte ingeven',
 	invalidHeight : 'U moet een geldige starttijd ingeven',
 	invalidTime : 'Inform a valid start time',
-	txtResponsive : 'Responsive video'
+	txtResponsive : 'Responsive video',
+	txtNoEmbed : 'Alleen video afbeelding en link'
 });

+ 8 - 7
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/pl.js

@@ -1,8 +1,8 @@
 CKEDITOR.plugins.setLang('youtube', 'pl', {
-	button : 'Załącznik wideo z Youtube',
-	title : 'Załącznik wideo z Youtube',
+	button : 'Załącznik wideo z YouTube',
+	title : 'Załącznik wideo z YouTube',
 	txtEmbed : 'Wklej kod do umieszczenia',
-	txtUrl : 'Wklej link URL do wideo',
+	txtUrl : 'Wklej adres URL do wideo z YouTube',
 	txtWidth : 'Szerokość',
 	txtHeight : 'Wysokość',
 	chkRelated : 'Pokaż sugerowane filmy po zakończeniu odtwarzania',
@@ -10,14 +10,15 @@ CKEDITOR.plugins.setLang('youtube', 'pl', {
 	chkPrivacy : 'Włącz rozszerzony tryb prywatności',
 	chkOlderCode : 'Użyj starego kodu',
 	chkAutoplay: 'Autoodtwarzanie',
-	noCode : 'Musisz wprowadzić kod lub link URL',
+	chkControls: 'Pokaż elementy sterujące odtwarzacza',
+	noCode : 'Musisz wprowadzić kod lub adres URL',
 	invalidEmbed : 'Wprowadzony kod nie jest poprawny',
-	invalidUrl : 'Wprowadzony link URL nie jest poprawny',
+	invalidUrl : 'Wprowadzony adres URL nie jest poprawny',
 	or : 'lub',
 	noWidth : 'Musisz wpisać szerokość',
 	invalidWidth : 'Wprowadzona szerokość nie jest poprawna',
 	noHeight : 'Musisz wprowadzić wysokość',
 	invalidHeight : 'Wprowadzona wysokość nie jest poprawna',
 	invalidTime : 'Musisz wprowadzić poprawny czas rozpoczęcia',
-	txtResponsive : 'Responsive video'
-});
+	txtResponsive : 'El. responsywny (ignoruj szerokość i wysokość, dopasuj do szerokości)'
+});

+ 5 - 3
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/pt.js

@@ -5,11 +5,12 @@ CKEDITOR.plugins.setLang('youtube', 'pt', {
 	txtUrl : 'Cole aqui uma URL de um vídeo do Youtube',
 	txtWidth : 'Largura',
 	txtHeight : 'Altura',
-	chkRelated : 'Mostrar vídeos sugeridos ao final do vídeo',
+	chkRelated : 'Mostrar vídeos sugeridos quando o vídeo terminar',
 	txtStartAt : 'Iniciar em (ss ou mm:ss ou hh:mm:ss)',
-	chkPrivacy : 'Ativar o modo de privacidade aprimorada',
+	chkPrivacy : 'Ativar o modo de privacidade otimizada',
 	chkOlderCode : 'Usar código de incorporação antigo',
 	chkAutoplay : 'Reproduzir automaticamente',
+	chkControls: 'Mostrar controles do player',
 	noCode : 'Você precisa informar um código embed ou uma URL',
 	invalidEmbed : 'O código informado não parece ser válido',
 	invalidUrl : 'A URL informada não parece ser válida',
@@ -19,5 +20,6 @@ CKEDITOR.plugins.setLang('youtube', 'pt', {
 	noHeight : 'Você deve informar a altura do vídeo',
 	invalidHeight : 'Informe uma altura válida',
 	invalidTime : 'O tempo informado é inválido',
-	txtResponsive : 'Vídeo responsivo'
+	txtResponsive : 'Vídeo responsivo',
+	txtNoEmbed : 'Somente imagem e link para o vídeo'
 });

+ 3 - 1
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/ru.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'ru', {
 	chkPrivacy : 'Включить режим повышенной конфиденциальности',
 	chkOlderCode : 'Использовать старый код вставки',
 	chkAutoplay: 'Автозапуск',
+	chkControls: 'Показать панель управления',
 	noCode : 'Вы должны ввести HTML-код или адрес',
 	invalidEmbed : 'Ваш HTML-код не похож на правильный',
 	invalidUrl : 'Ваш адрес видео не похож на правильный',
@@ -19,5 +20,6 @@ CKEDITOR.plugins.setLang('youtube', 'ru', {
 	noHeight : 'Вы должны указать высоту',
 	invalidHeight : 'Укажите правильную высоту',
 	invalidTime : 'Укажите правильное время начала',
-	txtResponsive : 'Responsive video'
+	txtResponsive : 'Растягиваемое видео',
+	txtNoEmbed : 'Не встраивать видео (обложка-ссылка на YouTube)'
 });

+ 1 - 0
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/tr.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'tr', {
 	chkPrivacy : 'Gizlilik modunu etkinleştir',
 	chkOlderCode : 'Eski gömülü kodu (embed) kullan',
 	chkAutoplay: 'Otomatik',
+	chkControls: 'Oynatıcı kontrollerini göster',
 	noCode : 'Gömülü kod (embed) veya url yapıştırmak zorundasınız',
 	invalidEmbed : 'Verdiğiniz gömülü kod (embed) ile video bulunamadı',
 	invalidUrl : 'Verdiğiniz linkte video bulunamadı',

+ 1 - 0
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/vi.js

@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('youtube', 'vi', {
 	chkPrivacy : 'Kích hoạt chế độ bảo mật nâng cao',
 	chkOlderCode : 'Sử dụng mã nhúng cũ',
 	chkAutoplay: 'Tự động chạy video',
+	chkControls: 'Hiển thị các điều khiển trình phát',
 	noCode : 'Bạn phải nhập mã nhúng hoặc URL',
 	invalidEmbed : 'Mã nhúng bạn đã nhập không đúng',
 	invalidUrl : 'URL bạn đã nhập không đúng',

+ 1 - 0
main/inc/lib/javascript/ckeditor/plugins/youtube/lang/zh.js

@@ -11,6 +11,7 @@ CKEDITOR.plugins.setLang('youtube', 'zh', {
     chkPrivacy: '啟用加強隱私模式',
     chkOlderCode: '使用舊的嵌入碼',
     chkAutoplay: '自動播放',
+    chkControls: '显示播放器控件',
     noCode: '必須輸入嵌入碼',
     invalidEmbed: '錯誤的嵌入碼',
     invalidUrl: '錯誤的URL',

+ 185 - 125
main/inc/lib/javascript/ckeditor/plugins/youtube/plugin.js

@@ -1,35 +1,37 @@
 /*
 * Youtube Embed Plugin
 *
-* @author Jonnas Fonini <contato@fonini.net>
-* @version 2.0.0
+* @author Jonnas Fonini <jonnasfonini@gmail.com>
+* @version 2.1.8
 */
-( function() {
-	CKEDITOR.plugins.add( 'youtube',
-	{
-		lang: [ 'en', 'pt', 'ja', 'hu', 'it', 'fr', 'tr', 'ru', 'de', 'ar', 'nl', 'pl', 'vi', 'zh', 'el'],
-		init: function( editor )
-		{
-			editor.addCommand( 'youtube', new CKEDITOR.dialogCommand( 'youtube', {
-				allowedContent: 'iframe[!width,!height,!src,!frameborder,!allowfullscreen]; object param[*]'
+(function () {
+	CKEDITOR.plugins.add('youtube', {
+		lang: [ 'en', 'pt', 'pt-br', 'ja', 'hu', 'it', 'fr', 'tr', 'ru', 'de', 'ar', 'nl', 'pl', 'vi', 'zh', 'el', 'he', 'es', 'nb', 'nn', 'fi', 'et', 'sk', 'cs', 'ko', 'eu' ],
+		init: function (editor) {
+			editor.addCommand('youtube', new CKEDITOR.dialogCommand('youtube', {
+				allowedContent: 'div{*}(*); iframe{*}[!width,!height,!src,!frameborder,!allowfullscreen]; object param[*]; a[*]; img[*]'
 			}));
 
-			editor.ui.addButton( 'Youtube',
-			{
+			editor.ui.addButton('Youtube', {
 				label : editor.lang.youtube.button,
 				toolbar : 'insert',
 				command : 'youtube',
 				icon : this.path + 'images/icon.png'
 			});
 
-			CKEDITOR.dialog.add( 'youtube', function ( instance )
-			{
-				var video;
+			CKEDITOR.dialog.add('youtube', function (instance) {
+				var video,
+					disabled = editor.config.youtube_disabled_fields || [];
 
 				return {
 					title : editor.lang.youtube.title,
-					minWidth : 500,
+					minWidth : 510,
 					minHeight : 200,
+					onShow: function () {
+						for (var i = 0; i < disabled.length; i++) {
+							this.getContentElement('youtubePlugin', disabled[i]).disable();
+						}
+					},
 					contents :
 						[{
 							id : 'youtubePlugin',
@@ -39,28 +41,21 @@
 									id : 'txtEmbed',
 									type : 'textarea',
 									label : editor.lang.youtube.txtEmbed,
-									autofocus : 'autofocus',
-									onChange : function ( api )
-									{
-										handleEmbedChange( this, api );
+									onChange : function (api) {
+										handleEmbedChange(this, api);
 									},
-									onKeyUp : function ( api )
-									{
-										handleEmbedChange( this, api );
+									onKeyUp : function (api) {
+										handleEmbedChange(this, api);
 									},
-									validate : function ()
-									{
-										if ( this.isEnabled() )
-										{
-											if ( !this.getValue() )
-											{
-												alert( editor.lang.youtube.noCode );
+									validate : function () {
+										if (this.isEnabled()) {
+											if (!this.getValue()) {
+												alert(editor.lang.youtube.noCode);
 												return false;
 											}
 											else
-											if ( this.getValue().length === 0 || this.getValue().indexOf( '//' ) === -1 )
-											{
-												alert( editor.lang.youtube.invalidEmbed );
+											if (this.getValue().length === 0 || this.getValue().indexOf('//') === -1) {
+												alert(editor.lang.youtube.invalidEmbed);
 												return false;
 											}
 										}
@@ -79,29 +74,24 @@
 											id : 'txtUrl',
 											type : 'text',
 											label : editor.lang.youtube.txtUrl,
-											onChange : function ( api )
-											{
-												handleLinkChange( this, api );
+											onChange : function (api) {
+												handleLinkChange(this, api);
 											},
-											onKeyUp : function ( api )
-											{
-												handleLinkChange( this, api );
+											onKeyUp : function (api) {
+												handleLinkChange(this, api);
 											},
-											validate : function ()
-											{
-												if ( this.isEnabled() )
-												{
-													if ( !this.getValue() )
-													{
-														alert( editor.lang.youtube.noCode );
+											validate : function () {
+												if (this.isEnabled()) {
+													if (!this.getValue()) {
+														alert(editor.lang.youtube.noCode);
 														return false;
 													}
 													else{
 														video = ytVidId(this.getValue());
 
-														if ( this.getValue().length === 0 ||  video === false)
+														if (this.getValue().length === 0 ||  video === false)
 														{
-															alert( editor.lang.youtube.invalidUrl );
+															alert(editor.lang.youtube.invalidUrl);
 															return false;
 														}
 													}
@@ -114,20 +104,17 @@
 											width : '60px',
 											label : editor.lang.youtube.txtWidth,
 											'default' : editor.config.youtube_width != null ? editor.config.youtube_width : '640',
-											validate : function ()
-											{
-												if ( this.getValue() )
-												{
-													var width = parseInt ( this.getValue() ) || 0;
+											validate : function () {
+												if (this.getValue()) {
+													var width = parseInt (this.getValue()) || 0;
 
-													if ( width === 0 )
-													{
-														alert( editor.lang.youtube.invalidWidth );
+													if (width === 0) {
+														alert(editor.lang.youtube.invalidWidth);
 														return false;
 													}
 												}
 												else {
-													alert( editor.lang.youtube.noWidth );
+													alert(editor.lang.youtube.noWidth);
 													return false;
 												}
 											}
@@ -138,20 +125,17 @@
 											width : '60px',
 											label : editor.lang.youtube.txtHeight,
 											'default' : editor.config.youtube_height != null ? editor.config.youtube_height : '360',
-											validate : function ()
-											{
-												if ( this.getValue() )
-												{
-													var height = parseInt ( this.getValue() ) || 0;
+											validate : function () {
+												if (this.getValue()) {
+													var height = parseInt(this.getValue()) || 0;
 
-													if ( height === 0 )
-													{
-														alert( editor.lang.youtube.invalidHeight );
+													if (height === 0) {
+														alert(editor.lang.youtube.invalidHeight);
 														return false;
 													}
 												}
 												else {
-													alert( editor.lang.youtube.noHeight );
+													alert(editor.lang.youtube.noHeight);
 													return false;
 												}
 											}
@@ -160,7 +144,7 @@
 								},
 								{
 									type : 'hbox',
-									widths : [ '100%' ],
+									widths : [ '55%', '45%' ],
 									children :
 										[
 											{
@@ -168,6 +152,12 @@
 												type : 'checkbox',
 												label : editor.lang.youtube.txtResponsive,
 												'default' : editor.config.youtube_responsive != null ? editor.config.youtube_responsive : false
+											},
+											{
+												id : 'chkNoEmbed',
+												type : 'checkbox',
+												label : editor.lang.youtube.txtNoEmbed,
+												'default' : editor.config.youtube_noembed != null ? editor.config.youtube_noembed : false
 											}
 										]
 								},
@@ -218,24 +208,22 @@
 											id : 'txtStartAt',
 											type : 'text',
 											label : editor.lang.youtube.txtStartAt,
-											validate : function ()
-											{
-												if ( this.getValue() )
-												{
+											validate : function () {
+												if (this.getValue()) {
 													var str = this.getValue();
 
-													if ( !/^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$/i.test( str ) )
-													{
-														alert( editor.lang.youtube.invalidTime );
+													if (!/^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$/i.test(str)) {
+														alert(editor.lang.youtube.invalidTime);
 														return false;
 													}
 												}
 											}
 										},
 										{
-											id: 'empty',
-											type: 'html',
-											html: ''
+											id : 'chkControls',
+											type : 'checkbox',
+											'default' : editor.config.youtube_controls != null ? editor.config.youtube_controls : true,
+											label : editor.lang.youtube.chkControls
 										}
 									]
 								}
@@ -245,19 +233,17 @@
 					onOk: function()
 					{
 						var content = '';
-						var responsiveStyle='';
+						var responsiveStyle = '';
 
-						if ( this.getContentElement( 'youtubePlugin', 'txtEmbed' ).isEnabled() )
-						{
-							content = this.getValueOf( 'youtubePlugin', 'txtEmbed' );
+						if (this.getContentElement('youtubePlugin', 'txtEmbed').isEnabled()) {
+							content = this.getValueOf('youtubePlugin', 'txtEmbed');
 						}
 						else {
-							var url = '//', params = [], startSecs;
-							var width = this.getValueOf( 'youtubePlugin', 'txtWidth' );
-							var height = this.getValueOf( 'youtubePlugin', 'txtHeight' );
+							var url = 'https://', params = [], startSecs;
+							var width = this.getValueOf('youtubePlugin', 'txtWidth');
+							var height = this.getValueOf('youtubePlugin', 'txtHeight');
 
-							if ( this.getContentElement( 'youtubePlugin', 'chkPrivacy' ).getValue() === true )
-							{
+							if (this.getContentElement('youtubePlugin', 'chkPrivacy').getValue() === true) {
 								url += 'www.youtube-nocookie.com/';
 							}
 							else {
@@ -266,40 +252,40 @@
 
 							url += 'embed/' + video;
 
-							if ( this.getContentElement( 'youtubePlugin', 'chkRelated' ).getValue() === false )
-							{
+							if (this.getContentElement('youtubePlugin', 'chkRelated').getValue() === false) {
 								params.push('rel=0');
 							}
 
-							if ( this.getContentElement( 'youtubePlugin', 'chkAutoplay' ).getValue() === true )
-							{
+							if (this.getContentElement('youtubePlugin', 'chkAutoplay').getValue() === true) {
 								params.push('autoplay=1');
 							}
 
-							startSecs = this.getValueOf( 'youtubePlugin', 'txtStartAt' );
-							if ( startSecs ){
-								var seconds = hmsToSeconds( startSecs );
+							if (this.getContentElement('youtubePlugin', 'chkControls').getValue() === false) {
+								params.push('controls=0');
+							}
+
+							startSecs = this.getValueOf('youtubePlugin', 'txtStartAt');
+
+							if (startSecs) {
+								var seconds = hmsToSeconds(startSecs);
 
 								params.push('start=' + seconds);
 							}
 
-							if ( params.length > 0 )
-							{
-								url = url + '?' + params.join( '&' );
+							if (params.length > 0) {
+								url = url + '?' + params.join('&');
 							}
 
-							if ( this.getContentElement( 'youtubePlugin', 'chkResponsive').getValue() === true ) {
-								content += '<div style="position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden;">';
-								responsiveStyle = 'style="position: absolute;top: 0;left: 0;width: 100%;height: 100%;"';
+							if (this.getContentElement('youtubePlugin', 'chkResponsive').getValue() === true) {
+								content += '<div class="youtube-embed-wrapper" style="position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden">';
+								responsiveStyle = 'style="position:absolute;top:0;left:0;width:100%;height:100%"';
 							}
 
-							if ( this.getContentElement( 'youtubePlugin', 'chkOlderCode' ).getValue() === true )
-							{
+							if (this.getContentElement('youtubePlugin', 'chkOlderCode').getValue() === true) {
 								url = url.replace('embed/', 'v/');
 								url = url.replace(/&/g, '&amp;');
 
-								if ( url.indexOf('?') === -1 )
-								{
+								if (url.indexOf('?') === -1) {
 									url += '?';
 								}
 								else {
@@ -316,17 +302,22 @@
 								content += 'allowfullscreen="true"></embed>';
 								content += '</object>';
 							}
+							else
+							if (this.getContentElement('youtubePlugin', 'chkNoEmbed').getValue() === true) {
+								var imgSrc = '//img.youtube.com/vi/' + video + '/sddefault.jpg';
+								content += '<a href="' + url + '" ><img width="' + width + '" height="' + height + '" src="' + imgSrc + '" '  + responsiveStyle + '/></a>';
+							}
 							else {
 								content += '<iframe width="' + width + '" height="' + height + '" src="' + url + '" ' + responsiveStyle;
 								content += 'frameborder="0" allowfullscreen></iframe>';
 							}
 
-							if ( this.getContentElement( 'youtubePlugin', 'chkResponsive').getValue() === true ) {
+							if (this.getContentElement('youtubePlugin', 'chkResponsive').getValue() === true) {
 								content += '</div>';
 							}
 						}
-						
-						var element = CKEDITOR.dom.element.createFromHtml( content );
+
+						var element = CKEDITOR.dom.element.createFromHtml(content);
 						var instance = this.getParentEditor();
 						instance.insertElement(element);
 					}
@@ -336,25 +327,30 @@
 	});
 })();
 
-function handleLinkChange( el, api )
-{
-	if ( el.getValue().length > 0 )
-	{
-		el.getDialog().getContentElement( 'youtubePlugin', 'txtEmbed' ).disable();
+function handleLinkChange(el, api) {
+	var video = ytVidId(el.getValue());
+	var time = ytVidTime(el.getValue());
+
+	if (el.getValue().length > 0) {
+		el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').disable();
 	}
 	else {
-		el.getDialog().getContentElement( 'youtubePlugin', 'txtEmbed' ).enable();
+		el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').enable();
+	}
+
+	if (video && time) {
+		var seconds = timeParamToSeconds(time);
+		var hms = secondsToHms(seconds);
+		el.getDialog().getContentElement('youtubePlugin', 'txtStartAt').setValue(hms);
 	}
 }
 
-function handleEmbedChange( el, api )
-{
-	if ( el.getValue().length > 0 )
-	{
-		el.getDialog().getContentElement( 'youtubePlugin', 'txtUrl' ).disable();
+function handleEmbedChange(el, api) {
+	if (el.getValue().length > 0) {
+		el.getDialog().getContentElement('youtubePlugin', 'txtUrl').disable();
 	}
 	else {
-		el.getDialog().getContentElement( 'youtubePlugin', 'txtUrl' ).enable();
+		el.getDialog().getContentElement('youtubePlugin', 'txtUrl').enable();
 	}
 }
 
@@ -365,24 +361,88 @@ function handleEmbedChange( el, api )
  * @author: Stephan Schmitz <eyecatchup@gmail.com>
  * @url: http://stackoverflow.com/a/10315969/624466
  */
-function ytVidId( url )
-{
+function ytVidId(url) {
 	var p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
-	return ( url.match( p ) ) ? RegExp.$1 : false;
+	return (url.match(p)) ? RegExp.$1 : false;
+}
+
+/**
+ * Matches and returns time param in YouTube Urls.
+ */
+function ytVidTime(url) {
+	var p = /t=([0-9hms]+)/;
+	return (url.match(p)) ? RegExp.$1 : false;
 }
 
 /**
  * Converts time in hms format to seconds only
  */
-function hmsToSeconds( time )
-{
+function hmsToSeconds(time) {
 	var arr = time.split(':'), s = 0, m = 1;
 
-	while (arr.length > 0)
-	{
+	while (arr.length > 0) {
 		s += m * parseInt(arr.pop(), 10);
 		m *= 60;
 	}
 
 	return s;
 }
+
+/**
+ * Converts seconds to hms format
+ */
+function secondsToHms(seconds) {
+	var h = Math.floor(seconds / 3600);
+	var m = Math.floor((seconds / 60) % 60);
+	var s = seconds % 60;
+
+	var pad = function (n) {
+		n = String(n);
+		return n.length >= 2 ? n : "0" + n;
+	};
+
+	if (h > 0) {
+		return pad(h) + ':' + pad(m) + ':' + pad(s);
+	}
+	else {
+		return pad(m) + ':' + pad(s);
+	}
+}
+
+/**
+ * Converts time in youtube t-param format to seconds
+ */
+function timeParamToSeconds(param) {
+	var componentValue = function (si) {
+		var regex = new RegExp('(\\d+)' + si);
+		return param.match(regex) ? parseInt(RegExp.$1, 10) : 0;
+	};
+
+	return componentValue('h') * 3600
+		+ componentValue('m') * 60
+		+ componentValue('s');
+}
+
+/**
+ * Converts seconds into youtube t-param value, e.g. 1h4m30s
+ */
+function secondsToTimeParam(seconds) {
+	var h = Math.floor(seconds / 3600);
+	var m = Math.floor((seconds / 60) % 60);
+	var s = seconds % 60;
+	var param = '';
+
+	if (h > 0) {
+		param += h + 'h';
+	}
+
+	if (m > 0) {
+		param += m + 'm';
+	}
+
+	if (s > 0) {
+		param += s + 's';
+	}
+
+	return param;
+}