Snippets

Create an account or login to be able to add, comment and rate snippets.

Navigation

Refine Tags

Snippets tagged "jquery" Snippets tagged "jquery"

JQuery Code to help handle attaching an embedded video/audio list to a post

<textarea id="comment" style="height:35px;max-height:100px; line-height:12px; font-size:12px;" class="span-24 last"></textarea>
 
    <div id="b" class="span-24 last">
        <button id="vid">Vid</button> <button id="pic">Pic</button> 
    </div>
 
 
 
 
[javascript]
<script type="text/javascript"> 
$(document).ready(function() {
    var vidIndex = 0;
    var vidList = new Array();
    $('#vid').click(function() {
        $('#vidContainer').slideDown();
    });
    $('#closeVid').click(function() {
        $('#vidContainer').slideUp();
    });
    $('#addVid').click(function() {
        $('#vidList').append('<div id="vid'+vidIndex+'"><span class="video">' + $('#vidUrl').val() + '</span> <button title="'+vidIndex+'" class="removeVid">Remove</button></div>');
        ++vidIndex;
 
        var chosen = '';
        $('.video').each(function () {
            chosen += $(this).text() + ',';
        });
        $('#params').html(chosen);
    });
    $('.removeVid').live("click", function(){
        var index = $(this).attr('title');
        $('#vid'+index).remove();
        --vidIndex;
 
        var chosen = '';
        $('.video').each(function () {
            chosen += $(this).text() + ',';
        });
        $('#params').html(chosen);
    });
</script>
 
by Willie T on 2010-02-05, tagged jquery 

jQuery AdminDoubleList replacements

jQuery AdminDouble List

These two js functions do the job while using jQuery with admin double list

function double_list_move(src, dest)
{
    var L = $(src).children();
    $(L).each(function(i){
        if(L[i].selected){
            $(dest).append('<option value="'+$(L[i]).val()+'">'+ $(L[i]).text()+'</option>');
            $(L[i]).remove();
        }
    });
 
}
 
function double_list_submit()
{
    var sel = $("form").find("select.sf_admin_multiple-selected");
    var C = $(sel).children();
    $(C).each(
        function(i){
            if(!C[i].selected)
                C[i].selected=true;
        }
    );
 
}
 

Enjoy it.

by Thomas Schäfer on 2008-03-19, tagged helper  javascript  jquery