PageSourceSearch

https://ringdomstory.com/js/origCommon/bookshelf.js?v=1739866371160

js ringdomstory.com collected 2026-09-28 08:00:36 UTC 2,446 bytes, 82 lines download raw bytes

1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2'use strict';
3
4/**
5 * 提供与书架相关的服务
6 * */
7window.Bookshelf = function ($) {
8    // 添加一本新书到书架
9    function add(bookIds, callback) {
10        $.ajax({
11            url: '/book/add',
12            data: {
13                books: bookIds
14            },
15            dataType: 'jsonp',
16            success: callback,
17            error: callback
18        });
19    }
20
21    // 删除
22    function remove(bookId, callback) {
23        $.ajax({
24            url: '/book/remove',
25            data: {
26                readingid: bookId,
27                type: 1
28            },
29            dataType: 'jsonp',
30            success: callback,
31            error: callback
32        });
33    }
34
35    // 检查单本书是否存在书架中
36    function isExist(bookId, callback) {
37        $.ajax({
38            url: '/book/exist',
39            data: {
40                readingid: bookId,
41                type: 1
42            },
43            dataType: 'jsonp',
44            success: callback,
45            error: callback
46        });
47    }
48
49    // 提示 已加入书架
50    function toastAdded(time) {
51        Toast('Book successfully added to library. ');
52    }
53
54    function isInBookshelf($booksDom, callback) {
55        for (var i = 0, len = $booksDom.length; i < len; i++) {
56            (function (index) {
57                var $bookBtn = $($booksDom[index]),
58                    bookId = $bookBtn.attr('data-bookid');
59
60                isExist(bookId, function (ret) {
61                    if (ret == 1) {
62                        $bookBtn.attr('disabled', true).text('Added');
63
64                        if (callback) {
65                            callback($bookBtn);
66                        }
67                    }
68                });
69            })(i);
70        }
71    }
72
73    return {
74        add: add,
75        remove: remove,
76        isExist: isExist,
77        isInBookshelf: isInBookshelf,
78        toastAdded: toastAdded
79    };
80}(jQuery);
81
82},{}]},{},[1]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.