Thứ Hai, 2 tháng 3, 2015

Easy MP3 HTML5 Playlist

Include: css, html, script
<style>
#Audio_Container {
    width: 320px;
    position:relative;
}
.Audio_inner {
    background: none repeat scroll 0 0 #333;
    border-radius: 5px;
    display: inline-block;
    width:100%;
}
audio{   
    border-radius:5px;
    height:30px;
    width:250px;
}
#playlist{
    background:#333;
    display:none;
    margin: 1px 0;
    padding: 0;   
    position: absolute;
    width: 100%;
}
#playlist .active a {
    color:#5DB0E6;   
}
#playlist li a {
    color:#eeeedd;
    background:#333;
    padding:5px;
    display:block;
    text-decoration:none;
}
#playlist li{
    padding-left:15px;
}
.playlist_button{
    float:left;
    color:#FFF;
    cursor:pointer;   
    padding:5px 10px;   
}
.playlist_button:hover{
    color:#cecece;
}
</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

<!--HTML-->
<div id="Audio_Container">
    <div class="Audio_inner">
        <div class="playlist_button" href="#">Playlist</div>
        <audio id="audio" preload="auto" tabindex="0" controls="" type="audio/mpeg">   
            <source type="audio/mp3" src="http://www.archive.org/download/bolero_69/Bolero.mp3">Sorry, your browser does not support HTML5 audio.
        </audio>
    </div>   
    <ul id="playlist">
        <li class="active">
            <a href="http://www.archive.org/download/bolero_69/Bolero.mp3">Ravel Bolero</a>
        </li>
        <li>
            <a href="http://www.archive.org/download/MoonlightSonata_755/Beethoven-MoonlightSonata.mp3">Moonlight Sonata - Beethoven</a>
        </li>
        <li>
            <a href="http://www.archive.org/download/CanonInD_261/CanoninD.mp3">Canon in D Pachabel</a>
        </li>
    </ul>
</div>
<!--EndHTML-->


<!--SCRIPT_AUDIO-->
<script type="text/javascript">
var audio;
var playlist;
var tracks;
var current;

Audio_init();

function Audio_init() {
    current = 0;
    audio = $('audio');
    playlist = $('#playlist');
    tracks = playlist.find('li a');
    len = tracks.length - 1;
    audio[0].volume = .10;
    audio[0].play();
    playlist.find('a').click(function (e) {
        e.preventDefault();
        link = $(this);
        current = link.parent().index();
        run(link, audio[0]);
    });
    audio[0].addEventListener('ended', function (e) {
        current++;
        if (current == len) {
            current = 0;
            link = playlist.find('a')[0];
        } else {
            link = playlist.find('a')[current];
        }
        run($(link), audio[0]);
    });
    /*PlayListClick*/
    $('.playlist_button').click(function() {            
        /*Hidden*/       
        if ($(this).hasClass('active')){
            $(this).removeClass('active');
            $(playlist).slideUp();
        }
        /*View*/
        else{
            $(this).addClass('active');
            $(playlist).slideDown();
        }       
    });   
}

function run(link, player) {
    player.src = link.attr('href');
    par = link.parent();
    par.addClass('active').siblings().removeClass('active');
    audio[0].load();
    audio[0].play();
}
</script>
<!--END_SCRIPT_AUDIO-->


Link download https://drive.google.com/file/d/0B785Epf6q5XlTHA5bFNrMnc5azQ/view?usp=sharing

Thứ Tư, 11 tháng 2, 2015

Joomla3.x Overwrite new Layout mod_menu

1. Create file overwrite layout + sub files overwrite


2. In file filter.php edit line to specify new sub files
At file new.php : replace default_ to new_
Detail: this mean new layout use sub new_ files.
Edit line: 79-85
        case 'heading':
            require JModuleHelper::getLayoutPath('mod_menu', 'default_' . $item->type);
            break;

        default:
            require JModuleHelper::getLayoutPath('mod_menu', 'default_url');
            break;

Replace this:
        case 'heading':
            require JModuleHelper::getLayoutPath('mod_menu', 'new_' . $item->type);
            break;

        default:
            require JModuleHelper::getLayoutPath('mod_menu', 'new_url');
            break;

3. At Administrator>Modules Manager>Menu choose new layout

Thứ Sáu, 16 tháng 1, 2015

Recreate k2 thumnails items cache

Description:
K2 recreate all thumnails media/k2/item/cache 
Recreate all pictures thumnail with new options.
Default k2 not funtion rereate thumnail

Solution:
1) Copy this file as rebuild.php into "JPATH_ROOT/media/k2/items"
2) Check Variables, use a size of 0 for not processing this image size - Variable in file rebuild.php
3) run rebuild.php (it overwrites existing files without notice)
 
File download:
https://drive.google.com/file/d/0B785Epf6q5Xldks2eHlRX1Nla1U/view?usp=sharing

This guide get from: https://github.com/rdeutz/rebuildK2imageCache

CHECKED recreate thumnails >100 images in <5 minutes
Note: InCase so much images can have time execution -> download all images at localhost, run rebuild at local,  then upload to host.

Maximum execution time of 120 seconds XAMPP localhost

Description: Localhost XAMPP joomla Fatal error: Maximum execution time of 120 seconds exceeded
Solution: Localhost: xampp\php\php.ini
max_execution_time = 5000

Chủ Nhật, 11 tháng 1, 2015

Iframe auto height content inner

Iframe.Load inner height.

$('iframe').load(function () {
    $('iframe').height($('iframe').contents().height());
});

Thứ Sáu, 26 tháng 12, 2014

Joomla Cache Image issue by AdminTool

Detail: Joomla Cache Image not view when using Admin Tool .htaccess
Reason: Admin tool create .htaccess file prevent view image at cache folder
Solution: Administrator->Component->Admin tool->.htaccess Maker-> Front End directory->Add item cache
Screen guide:

Chủ Nhật, 7 tháng 12, 2014

RSFirewall clear IFRAME

Mô tả: Bài viết sau khi lưu mất iframe.
Lưu ý: ở đây không giống như editor clear iframe. Ở đây là do RSFirewall. Giống như là thêm 1 cấp clear nữa.

Cách xử lý: Vào RSFirewall->BlackList/WhiteList->New->Get current Ip->Set WhiteList ok
Nguyên nhân: Vì tăng cường bảo vệ site RSFirewall clear nội dung. Khi nhận thấy IP trong whitelist sẽ cho phép mà không clear-> giữ được iframe.