Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="ibacordotcom-content">
			<div class="ibacordotcom-unit ibacordotcom-vid-kenca">
				<div class="ibacordotcom_vid_play"></div>
			</div>
			<div class = "ibacordotcom-unit ibacordotcom-vid-katuhu">
				<div class="ibacordotcom_youtube_channels"></div>
			</div>
		</div>

		<a href="https://github.com/bachors/jQuery-Youtube-Channels-Playlist" target="_BLANK"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a>

              
            
!

CSS

              
                /* Custom your style */

html, body {
	padding: 0;
	margin: 0;
}

body {
	background: #ebebeb;
	font-family: Arial,sans-serif;
	font-size: 16px;
	color: #444;
	position: relative;
	-webkit-text-size-adjust: none;
}

i.fa span {
	font-size: 16px;
}

body * {
	text-shadow: none;
}

#ibacordotcom-content {
	padding: 0 100px;
}

iframe,input,textarea,button{border:0}

h1{
	line-height: 34px;
	font-weight: bold;
	margin: 10px 0 10px 0;
	font-size: 34px;
}

span.ibacordotcom-nav-title {
	font-size: 20px;
}

p {
	margin-bottom: 20px;
}

hr {
	border: 0;
	height: 0;
	border-top: 1px solid rgba(0, 0, 0, 0.1);
	border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.ibacordotcom-vid-top hr {
	border: 0;
	height: 0;
	border-top: 2px solid rgba(0, 0, 0, 0.7);
	border-bottom: 1px solid rgba(150, 150, 150, 0.3);
}

a  {
	text-decoration: none;
}

a img {
	border: 0;
}

.ibacordotcom-unit {
	display: inline-block;
	*display: inline;
	*zoom: 1;
	vertical-align: top;
	overflow: hidden;
	*overflow: visible;
}

.ibacordotcom-vid-katuhu {
	width:33.45%;
	float:right
}

.fa a, a i.fa, a span.ibacordotcom-uploader {
	color: #444;
}

.ibacordotcom-vid-kenca {
	width:66.50%;
}

.ibacordotcom_youtube_thumb{float:left;margin-right:10px;}

.ibacordotcom_youtube_thumb {
    position: relative;
}

.ibacordotcom_youtube_thumb span {
    position: absolute;
    right: 1px;
    bottom: 10px;
	padding:0 5px 0 5px;
	background: #000;
}

.ibacordotcom-vid-box {
	background:#fff;
	border:1px solid #e0e0e0;
	margin-bottom:10px;
	padding:20px;
	display:block;
	overflow:hidden;
	*overflow:visible;
}

.ibacordotcom-vid-box-user {
	margin-bottom: 35px;
}

#ibacordotcom-user-img {
	float:left;
	margin-right:10px
}

.ibacordotcom-play {
	margin:0;
	padding:10px;
	display:block;
	overflow:hidden;
	*overflow:visible;
}

div.ibacordotcom-vid-top {
	color: #c0c0c0;
	background:#1a1a1a;
	padding:20px;
	display:block;
	overflow:hidden;
	*overflow:visible;
}

div.ibacordotcom-vid-bottom {
	color: #c0c0c0;
	background:#222222;
	display:block;
}

span.ibacordotcom-vid-by a {
	color: #878787;
}

.ibacordotcom_youtube_thumb img {
	width: 100px;
}

div.ibacordotcom-play:hover {
	background:#525252;
}

.ibacordotcom-vid-active {
	background:#3a3a3a;
}

.ibacordotcom-vid-active img{
	border :2px solid #e42b28;
}

.ibacordotcom_vid_prev,.ibacordotcom_vid_next,.ibacordotcom-play{
	cursor:pointer
}

iframe.ibacordotcom-vid-iframe {
	width: 100%;
	height: 500px
}
@media only screen and (min-width: 960px) and (max-width: 1045px) {
	h1{font-size: 26px;line-height: 24px;}
	#ibacordotcom-content {padding:50px}
	.ibacordotcom-vid-katuhu {width:35%}
	.ibacordotcom-vid-kenca {width:65%}
}

@media only screen and (min-width: 768px) and (max-width: 959px) {
	body {font-size: 14px;line-height: 24px}
	h1 {font-size: 20px;line-height: 20px;}
	#ibacordotcom-content {padding:10px}
	.ibacordotcom-vid-katuhu {width:35%}
	.ibacordotcom-vid-kenca {width:65%}
}

@media only screen and (min-width: 480px) and (max-width: 767px) {
	body {font-size: 14px;line-height: 24px}
	h1 {font-size: 18px;line-height: 20px;}
	#ibacordotcom-content {padding:5px}
	.ibacordotcom-vid-katuhu {width:100%}
	.ibacordotcom-vid-kenca {width:100%;margin-bottom:20px}
	iframe.ibacordotcom-vid-iframe {height: 450px;}
}

@media screen and (max-width:479px){
	body {font-size: 12px;line-height: 22px}
	#ibacordotcom-content {padding:0}
	h1 {font-size: 16px;line-height: 18px;}
	.ibacordotcom-vid-box{padding:5px}
	.ibacordotcom-vid-katuhu{margin:0}
	.ibacordotcom-vid-kenca {margin:0 0 20px 0}
	.ibacordotcom-unit{width:auto;margin-left:0;display:block;margin-top:0}
	iframe.ibacordotcom-vid-iframe {height: 350px;}
}

              
            
!

JS

              
                /***********************************************
* #### jQuery-Youtube-Channels-Playlist ####
* Coded by Ican Bachors 2014.
* http://ibacor.com/labs/jquery-youtube-channels-playlist/
* Updates will be posted to this site.
***********************************************/

var channels_name='vevouk', //example
channels_title='jQuery plugin by @bachors',
apikey='AIzaSyCj2GrDSBy6ISeGg3aWUM4mn3izlA1wgt0'; //YOUR GOOGLE API KEY

$.ajax({
    url: 'https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=' + channels_name + '&key=' + apikey,
    crossDomain: true,
    dataType: 'json'
}).done(function(a) {
    var b = a.items[0].contentDetails.relatedPlaylists.uploads,
        chid = a.items[0].id,
        nekpag = '';
    youtube_video_list(b, apikey, nekpag, channels_title, chid, channels_name)
});

function youtube_video_list(f, g, h, j, k, l) {
    $.ajax({
        url: 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=' + f + '&key=' + g + '&pageToken=' + h,
        dataType: 'json'
    }).done(function(c) {
        var d = '';
        d += '<div class="ibacordotcom-vid-top"><span class="ibacordotcom-nav-title">' + j + '</span><br><span class="ibacordotcom-vid-by">by <a href="https://www.youtube.com/user/' + l + '" target="_BLANK">' + l + '</a></span><hr>';
        d += '<i class="fa fa-fast-backward ibacordotcom_vid_prev" title="Previous videos"></i> ';
        d += '<i class="fa fa-fast-forward ibacordotcom_vid_next" title="Next videos"></i></div><div class="ibacordotcom-vid-bottom">';
        $.each(c.items, function(i, a) {
            var b = c.items[i].snippet.resourceId.videoId;
            getwaktu(b, i, g);
            d += '<div class="ibacordotcom-play" data-vvv="' + b + '"><div class="ibacordotcom_youtube_thumb"><img src="' + c.items[i].snippet.thumbnails.default.url + '" alt="ibacor"><span class="ibacordotcom-vid-tm' + i + '"></span></div>';
            d += c.items[i].snippet.title + '</div>'
        });
        d += '</div>';
        $('.ibacordotcom_youtube_channels').html(d);
        if (c.prevPageToken == null) {
            var e = $(".ibacordotcom-play").attr("data-vvv");
            youtube_det(e, k, l, g)
        }
        if (c.prevPageToken != null) {
            $('.ibacordotcom_vid_prev').click(function() {
                var a = c.prevPageToken;
                youtube_video_list(f, g, a, j, k, l);
                return false
            })
        }
        $('.ibacordotcom_vid_next').click(function() {
            var a = c.nextPageToken;
            youtube_video_list(f, g, a, j, k, l);
            return false
        });
        $(".ibacordotcom-play").each(function() {
            $(this).click(function() {
                var a = $(this).attr("data-vvv");
                $('div').removeClass('ibacordotcom-vid-active');
                $(this).addClass('ibacordotcom-vid-active');
                youtube_det(a, k, l, g);
                return false
            })
        })
    })
}

function youtube_det(c, d, e, g) {
    $.ajax({
        url: 'https://www.googleapis.com/youtube/v3/videos?id=' + c + '&key=' + g + '&part=snippet,statistics',
        dataType: 'json'
    }).done(function(a) {
        var b = '',
            viewc = a.items[0].statistics.viewCount,
            likc = a.items[0].statistics.likeCount,
            likd = a.items[0].statistics.dislikeCount,
            category = '',
            judul = a.items[0].snippet.localized.title,
            desc = a.items[0].snippet.localized.description;
        b += '<iframe src="https://www.youtube.com/embed/' + c + '" allowfullscreen="" frameborder="0" class="ibacordotcom-vid-iframe"></iframe>';
        b += '<div class="ibacordotcom-vid-box"><h1>' + judul + '</h1><hr>';
        b += '<div class="ibacordotcom-vid-box-user"><a href="https://www.youtube.com/channel/' + d + '" target="_BLANK"><span id="ibacordotcom-user-img"></span> <span class="ibacordotcom-uploader">' + a.items[0].snippet.channelTitle + '</span></a><h4 class="pull-right"> ' + addCommas(viewc) + '</h4></div></div>';
        b += '<div class="ibacordotcom-vid-box"><i class="fa fa-clock-o"> <span>' + _timeSince(new Date(a.items[0].snippet.publishedAt).getTime()) + '</span></i><i class="fa fa-thumbs-down pull-right"> ' + addCommas(likd) + '</i><i class="fa fa-thumbs-up pull-right"> ' + addCommas(likc) + '</i><hr>' + urlify(desc).replace(/\n/g, '<br>') + '<br></div>';
        gplus(e, g);
        $('.ibacordotcom_vid_play').html(b)
    })
}

function getwaktu(c, i, g) {
    $.ajax({
        url: 'https://www.googleapis.com/youtube/v3/videos?id=' + c + '&key=' + g + '&part=contentDetails',
        dataType: 'json'
    }).done(function(a) {
        var b = a.items[0].contentDetails.duration,
            dataw = '',
            menit = '',
            detik = '';
		if(b.match(/M/g)){
            dataw = b.split('M');
            menit = dataw[0].replace('PT','');
			if(dataw[1] != ''){
				detik = dataw[1].replace('S','');
			}else{
				detik = '00';
			}
		}else{
            dataw = b.split('PT');
			menit = '00';
			detik = dataw[1].replace('S','');
		}
        $('.ibacordotcom-vid-tm' + i).html(menit + ':' + detik)
    })
}

function urlify(b) {
    var c = /(https?:\/\/[^\s]+)/g;
    return b.replace(c, function(a) {
        return '<a href="' + a + '" rel="nofollow" target="_BLANK">' + a + '</a>'
    })
}

function gplus(c, g) {
    var d = 'https://www.googleapis.com/plus/v1/people/',
        apiend = '/activities/public',
        fields = 'items(actor(image(url)))';
    $.ajax({
        url: d + '+' + c + apiend + '?key=' + g + '&fields=' + fields + '&maxResults=1',
        crossDomain: true,
        dataType: 'jsonp'
    }).done(function(a) {
        var b = a.items,
            i = 0,
            html = '';
        for (i = 0; i < b.length; i += 1) {
            html += '<img src="' + b[i].actor.image.url + '" alt="" />'
        }
        $('#ibacordotcom-user-img').html(html)
    })
}

function _timeSince(a) {
    var s = Math.floor((new Date() - a) / 1000),
        i = Math.floor(s / 31536000);
    if (i > 1) {
        return i + " years ago"
    }
    i = Math.floor(s / 2592000);
    if (i > 1) {
        return i + " months ago"
    }
    i = Math.floor(s / 86400);
    if (i > 1) {
        return i + " days ago"
    }
    i = Math.floor(s / 3600);
    if (i > 1) {
        return i + " hours ago"
    }
    i = Math.floor(s / 60);
    if (i > 1) {
        return i + " minutes ago"
    }
    return Math.floor(s) + " seconds ago"
}

function addCommas(nStr){
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

              
            
!
999px

Console