//PIN Function //highlight pins jQuery(document).ready(function($) { // buttons $('#btn_pindel').click(function() { // removes all LI with class="cls" in OL $('ul li.ui-state-default').remove(); }); }); addAnother = function() { var ul = this.document.getElementById("sortable"); var li = this.document.createElement("li")//.show( "fold", 1000 ); var children = ul.children.length + 1 li.setAttribute("id", "ui-state-default"+children);//.show( "fold", 1000 ); li.appendChild(document.createTextNode("Pin "+ children));// + document.innerHTML(Delete image)); ul.appendChild(li) } var $ =jQuery.noConflict(); //Creating the pin sorting option $(document).ready(function () { // map the classes for each item into a new array var classes = $("#ui-state-default ").map(function(){ return $(this).data("type").split(' '); }); // create list of distinct items only $('#item-filter-select').on('change', function () { if (this.value == 'all') { $('.ui-state-default').show(); }else if (this.value == 'views'){ var elems = $('.ui-state-default[data-views="'+this.value+'"]'); $('.ui-state-default').not(elems).hide(); elems.show(); }else{ var elems = $('.ui-state-default[data-type="'+this.value+'"]'); $('.ui-state-default').not(elems).hide(); elems.show(); } }); }); //Sort by colors function pinsort_colors() { $("#sortable li").sort(sort_li).appendTo('#sortable'); function sort_li(a, b){ return ($(b).data('color')) > ($(a).data('color')) ? 1 : -1; }} //sort by views function pinsort_views() { $("#sortable li").sort(sort_li).appendTo('#sortable'); function sort_li(a, b){ return ($(b).data('views')) > ($(a).data('views')) ? 1 : -1; } }; //sort by views function pinsort_date() { $("#sortable li").sort(function(a,b){ return new Date($(a).attr("data-date")) > new Date($(b).attr("data-date")); }).each(function(){ $("#sortable").prepend(this); }); } /* var data = { 'action': 'card_color', 'color': '#0000' }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php jQuery.post(ajaxurl, data, function(response) { alert('Got this from the server: ' + response); }); }); /* $('.target').click(function () { $.post(ajax_object.ajaxurl, { action: 'ajax_action', post_id: $(this).find('input.post_id').attr('value') }, function(data) { alert(data); // alerts 'ajax submitted' }); });*/ /* Ajax response pins function myAjax() { $.ajax({ type: "POST", url: 'your_url/ajax.php', data:{action:'call_this'}, success:function(html) { alert(html); } }); }*/ //END of file