From b876505f2266409ced1d88e7105c2917fd2bd61d Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 25 Feb 2017 06:15:00 +0100 Subject: [PATCH] Delete doubtable.js --- cps/static/js/douban_meta.js | 87 ------------------------------------ 1 file changed, 87 deletions(-) delete mode 100644 cps/static/js/douban_meta.js diff --git a/cps/static/js/douban_meta.js b/cps/static/js/douban_meta.js deleted file mode 100644 index 773939f9..00000000 --- a/cps/static/js/douban_meta.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Get Metadata from Douban api - * Created by idalin - */ - -$(document).ready(function () { - var get_meta_btn = '
  • ' + - '' + - '获取Meta
  • '; - $('#main-nav').prepend(get_meta_btn); - var douban = 'https://api.douban.com'; - var search = '/v2/book/search'; - var get_info = '/v2/book/'; - var get_info_by_isbn = '/v2/book/isbn/ '; - - $.ajaxSetup({ - type: "GET", - dataType: "jsonp", - jsonp: 'callback', - async: false - }); - - get_meta = function (id) { - var url = douban + get_info + id; - console.log('getting book meta:' + id); - $.ajax({ - url: url, - success: function (meta) { - console.log(meta); - //$('#metaModal').modal('hide'); - $('#description').val(meta.summary); - $('#bookAuthor').val(meta.author.join(' & ')); - $('#book_title').val(meta.title); - var tags = ''; - for (var i = 0; i < meta.tags.length; i++) { - tags = tags + meta.tags[i].title + ','; - } - $('#tags').val(tags); - $('#rating').val(Math.round(meta.rating.average / 4)); - } - }); - } - - get_meta_by_isbn = function (isbn) { - var url = douban + get_info_by_isbn + isbn; - } - - search_book = function (title) { - var url = douban + search + '?q=' + title + '&fields=id,title,author,publisher,isbn13,image,summary'; - $.ajax({ - url: url, - success: function (data) { - if (data.books.length < 1) { - $('#meta-info').html('

    搜索不到对应的书籍

    '); - } else { - $('#meta-info').html(''); - for (var i = 0; i < data.books.length; i++) { - var book = '
  • ' + - 'Cover' + - '
    ' + - '

    ' + data.books[i].title + '

    ' + - '

    作者:' + data.books[i].author + '

    ' + - '

    出版社:' + data.books[i].publisher + '

    ' + - '

    简介:' + data.books[i].summary + '

    ' + - '
    ' + - '
  • '; - $("#book-list").append(book); - } - } - }, - error: function () { - $('#meta-info').html('

    搜索出错

    '); - } - }); - } - - $('#get_meta').click(function () { - var book_title = $('#book_title').val(); - if (book_title) { - // console.log(book_title); - search_book(book_title); - } - }); -}); \ No newline at end of file