-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
2.6 Added AMP Support.
- Loading branch information
Showing
7 changed files
with
219 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* The File contains AMP specific CSS | ||
*/ | ||
.youtubefancybox-amp-lightbox { | ||
background: rgba(0,0,0,0.8); | ||
width: 80%; | ||
height: 80%; | ||
position: fixed; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
left: 10%; | ||
top:10%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
jQuery(document).ready(function(){ | ||
jQuery(".youtube").colorbox( | ||
{ | ||
iframe:true, | ||
width:"80%", | ||
height:"80%" | ||
} | ||
); | ||
|
||
jQuery(".vimeo").colorbox( | ||
{ | ||
iframe:true, | ||
width:"80%", | ||
height:"80%" | ||
} | ||
); | ||
}); | ||
jQuery(document).ready(function( $ ){ | ||
$ ('.youtube').colorbox( { | ||
iframe:true, | ||
width:'80%', | ||
height:'80%' | ||
} ); | ||
|
||
$ ('.vimeo').colorbox( { | ||
iframe:true, | ||
width:'80%', | ||
height:'80%' | ||
} ); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,89 @@ | ||
jQuery( document ).ready( function () { | ||
/** | ||
* Generate shortcode for Youtube | ||
*/ | ||
jQuery( "#genrate" ).click( function () { | ||
var url = jQuery( "#youtubeurl" ).val(); | ||
var height = jQuery( "#t_height" ).val(); | ||
var width = jQuery( "#t_width" ).val(); | ||
if ( url ) { | ||
var videoid = youtube_parser( url ); | ||
var str = '[youtube videoid="' + videoid + '"'; | ||
|
||
if ( height ) { | ||
str += ' height="' + height + '"'; | ||
} | ||
if ( width ) { | ||
str += ' width="' + width + '"'; | ||
} | ||
str += ']'; | ||
} | ||
if ( videoid ) { | ||
jQuery( "#shortcode" ).val( str ); | ||
jQuery( "#shortcode" ).select(); | ||
} | ||
} ); | ||
/** | ||
* Select Shortcode on click | ||
**/ | ||
jQuery( "#shortcode" ).click( function () { | ||
jQuery( "#shortcode" ).select(); | ||
} ); | ||
|
||
/** | ||
* Genrate shortcode for Viemo videos | ||
**/ | ||
jQuery( "#genratevimeo" ).click( function () { | ||
var url = jQuery( "#vimeourl" ).val(); | ||
var height = jQuery( "#t_height" ).val(); | ||
var width = jQuery( "#t_width" ).val(); | ||
if ( url ) { | ||
var videoid = vimeo_parser( url ); | ||
var str = '[vimeo videoid="' + videoid + '"'; | ||
|
||
if ( height ) { | ||
str += ' height="' + height + '"'; | ||
} | ||
if ( width ) { | ||
str += ' width="' + width + '"'; | ||
} | ||
str += ']'; | ||
} | ||
if ( videoid ) { | ||
jQuery( "#shortcode" ).val( str ); | ||
jQuery( "#shortcode" ).select(); | ||
} | ||
} ); | ||
} ); | ||
/** | ||
* function for gets youtube id from url | ||
**/ | ||
function youtube_parser( url ) { | ||
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; | ||
var match = url.match( regExp ); | ||
if ( match && match[7].length == 11 ) { | ||
return match[7]; | ||
} else { | ||
alert( fancybox_admin_obj.youtube_alert ); | ||
} | ||
} | ||
/** | ||
* Functin gets viemo id from url | ||
* @returns {undefined} | ||
*/ | ||
function vimeo_parser( url ) { | ||
var regExp = /^.*(www\.)?vimeo.com\/(\d+)($|\/)/; | ||
var match = url.match( regExp ); | ||
if ( match ) { | ||
return match[2]; | ||
} else { | ||
alert( fancybox_admin_obj.viemo_alert ); | ||
} | ||
} | ||
/** | ||
* Admin Scripts for Youtube Fancybox. | ||
*/ | ||
|
||
jQuery( document ).ready( function ( $ ) { | ||
/** | ||
* Generate shortcode for Youtube | ||
*/ | ||
$( document ).on( 'click', '#genrate', function () { | ||
var url = $( '#youtubeurl' ).val(); | ||
var height = $( '#t_height' ).val(); | ||
var width = $( '#t_width' ).val(); | ||
if ( url ) { | ||
var videoid = youtube_parser( url ); | ||
var str = '[youtube videoid="' + videoid + '"'; | ||
|
||
if ( height ) { | ||
str += ' height="' + height + '"'; | ||
} | ||
if ( width ) { | ||
str += ' width="' + width + '"'; | ||
} | ||
str += ']'; | ||
} | ||
if ( videoid ) { | ||
$( '#shortcode' ).val( str ); | ||
$( '#shortcode' ).trigger( 'select' ); | ||
} | ||
} ); | ||
|
||
/** | ||
* Select Shortcode on click | ||
**/ | ||
$( document ).on( 'click', '#shortcode', function () { | ||
$( "#shortcode" ).trigger( 'select' ); | ||
} ); | ||
|
||
/** | ||
* Genrate shortcode for Viemo videos | ||
**/ | ||
$( document ).on( 'click', '#genratevimeo', function () { | ||
var url = $( '#vimeourl' ).val(); | ||
var height = $( '#t_height' ).val(); | ||
var width = $( '#t_width' ).val(); | ||
if ( url ) { | ||
var videoid = vimeo_parser( url ); | ||
var str = '[vimeo videoid="' + videoid + '"'; | ||
|
||
if ( height ) { | ||
str += ' height="' + height + '"'; | ||
} | ||
if ( width ) { | ||
str += ' width="' + width + '"'; | ||
} | ||
str += ']'; | ||
} | ||
if ( videoid ) { | ||
$( '#shortcode' ).val( str ); | ||
$( '#shortcode' ).trigger( 'select' ); | ||
} | ||
} ); | ||
} ); | ||
|
||
/** | ||
* function for gets youtube id from url | ||
**/ | ||
function youtube_parser( url ) { | ||
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; | ||
var match = url.match( regExp ); | ||
if ( match && match[7].length == 11 ) { | ||
return match[7]; | ||
} else { | ||
alert( fancybox_admin_obj.youtube_alert ); | ||
} | ||
} | ||
|
||
/** | ||
* Functin gets viemo id from url | ||
* @returns {undefined} | ||
*/ | ||
function vimeo_parser( url ) { | ||
var regExp = /^.*(www\.)?vimeo.com\/(\d+)($|\/)/; | ||
var match = url.match( regExp ); | ||
if ( match ) { | ||
return match[2]; | ||
} else { | ||
alert( fancybox_admin_obj.viemo_alert ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.