// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//

//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
//= require jquery.tokeninput

// bootstrap tooltip
$(function(){
  $("a[rel='tooltip']").tooltip();
})


// <%= javascript_include_tag "application" %>

//$(document).ready(function() 
//    { 
//        $("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} ); 
//    } 
//);

//$(function () {  
//  $('#posts th a').live('click', function () {  
//    $.getScript(this.href);  
//    return false;  
//  });  
//})


function remove_fields(link) {
        $(link).prev("input[type=hidden]").val("1");
        $(link).closest(".fields").hide();
}

function add_fields(link, association, content) {
        var new_id = new Date().getTime();
        var regexp = new RegExp("new_" + association, "g");
        $(link).parent().before(content.replace(regexp, new_id));
}


    // tokeninput
    $(function () {  
      $('#post_tag_tokens').tokenInput('/tags.json', {
        //crossDomain: false,
        preventDuplicates: true,
        prePopulate: $(this).data('pre'),
        theme: 'facebook',
        hintText: 'search for tags ...',
        noResultsText: 'no tag found',
        searchingText: 'searching for tags ...'
      });  
    });  


$(function () {  
  // sorting and pagination
  $('#posts th a, #posts .pagination a').live('click', function () {  
    $.getScript(this.href);  
    return false;  
  });
  // search
  $('#posts_search input').keyup(function () {  
    $.get($('#posts_search').attr('action'),
    $('#posts_search').serialize(), null, 'script');  
  return false;  
});
})

@@ -778,318 +778,22 @@
 %0A// 
-%3C%25= javascript_include_tag %22application%22 %25%3E%0A%0A//$(document).ready(function() %0A//    %7B %0A//        $(%22#myTable%22).tablesorter( %7BsortList: %5B%5B0,0%5D, %5B1,0%5D%5D%7D ); %0A//    %7D %0A//);%0A%0A//$(function () %7B  %0A//  $('#posts th a').live('click', function () %7B  %0A//    $.getScript(this.href);  %0A//    return false;  %0A//  %7D);  %0A//%7D)%0A%0A
+remove new tag
 %0Afun
@@ -820,22 +820,16 @@
 link) %7B%0A
-      
   $(link
@@ -863,30 +863,24 @@
 ).val(%221%22);%0A
-      
   $(link).cl
@@ -907,16 +907,32 @@
 e();%0A%7D%0A%0A
+//  add new tag%0A
 function
@@ -973,22 +973,16 @@
 tent) %7B%0A
-      
   var ne
@@ -1010,22 +1010,16 @@
 Time();%0A
-      
   var re
@@ -1064,22 +1064,16 @@
 , %22g%22);%0A
-      
   $(link
@@ -1128,20 +1128,16 @@
 ));%0A%7D%0A%0A%0A
-    
 // token
@@ -1142,20 +1142,16 @@
 eninput%0A
-    
 $(functi
@@ -1160,20 +1160,16 @@
  () %7B  %0A
-    
   $('#po
@@ -1211,20 +1211,16 @@
 son', %7B%0A
-    
     //cr
@@ -1241,20 +1241,16 @@
 se,%0A    
-   
- 
 preventD
@@ -1266,20 +1266,16 @@
 : true,%0A
-    
     preP
@@ -1308,20 +1308,16 @@
 '),%0A    
-  
-  
 theme: '
@@ -1327,20 +1327,16 @@
 ebook',%0A
-    
     hint
@@ -1364,20 +1364,16 @@
 s ...',%0A
-    
     noRe
@@ -1403,20 +1403,16 @@
 d',%0A    
-   
- 
 searchin
@@ -1447,20 +1447,16 @@
 ..'%0A
-    
   %7D);  %0A
     
@@ -1455,20 +1455,16 @@
 ;  %0A
-    
 %7D);  %0A%0A%0A
 $(fu
@@ -1459,16 +1459,39 @@
 %7D);  %0A%0A%0A
+// pager on post/index%0A
 $(functi
@@ -1655,18 +1655,17 @@
  %0A  %7D);%0A
-  
+%0A
 // searc
@@ -1666,18 +1666,16 @@
  search%0A
-  
 $('#post
@@ -1709,26 +1709,24 @@
 tion () %7B  %0A
-  
   $.get($('#
@@ -1756,18 +1756,16 @@
 tion'),%0A
-  
   $('#po

clean up application.js