PageSourceSearch

https://www.iransporter.com/core/codeprocess-database.js?ver=7.2.2

js iransporter.com collected 2026-10-02 23:03:59 UTC 3,847 bytes, 154 lines download raw bytes

1var database = (function() {
2    var DB_NAME = 'codeprocess-db';
3    var DB_VERSION = 2;
4    var DATA_TABLES = [
5        "SyncServer",
6        "Slider",
7        "Post",
8        "Banner"
9    ];
10
11    var dbPromise = idb.open(DB_NAME, DB_VERSION, function(db) {
12        for (var item in DATA_TABLES) {
13            if (!db.objectStoreNames.contains(DATA_TABLES[item])) {
14                db.createObjectStore(DATA_TABLES[item], { keyPath: 'Id' });
15            }
16        }
17    });
18
19    var get = function(TABLE_NAME, id) {
20        return dbPromise.then(function(db) {
21            var tx = db.transaction(TABLE_NAME, "readonly");
22            return tx.objectStore(TABLE_NAME).get(id);
23        });
24    };
25
26
27    var getAll = function(TABLE_NAME) {
28        return dbPromise.then(function(db) {
29            var tx = db.transaction(TABLE_NAME, "readonly");
30            return tx.objectStore(TABLE_NAME).getAll();
31        });
32    }
33
34    var upsert = function(TABLE_NAME, data) {
35        return dbPromise.then(function(db) {
36            var tx = db.transaction(TABLE_NAME, 'readwrite');
37            var store = tx.objectStore(TABLE_NAME);
38            store.put(data);
39            return tx.complete;
40        });
41    }
42
43    var upsertAll = function(TABLE_NAME, data) {
44        return dbPromise.then(function(db) {
45            var tx = db.transaction(TABLE_NAME, 'readwrite');
46            var store = tx.objectStore(TABLE_NAME);
47            for (var item in data) {
48                store.put(data[item]);
49            }
50            return tx.complete;
51        });
52    }
53
54    var remove = function(TABLE_NAME, id) {
55        return dbPromise.then(function(db) {
56            var tx = db.transaction(TABLE_NAME, "readwrite");
57            tx.objectStore(TABLE_NAME).delete(id);
58            return tx.complete;
59        })
60    }
61
62    var removeAll = function(TABLE_NAME) {
63        return dbPromise.then(function(db) {
64            var tx = db.transaction(TABLE_NAME, "readwrite");
65            tx.objectStore(TABLE_NAME).clear();
66            return tx.complete;
67        })
68    }
69
70    var tables = function() {
71        return DATA_TABLES;
72    }
73
74    return {
75        get: get,
76        getAll: getAll,
77        upsert: upsert,
78        upsertAll: upsertAll,
79        remove: remove,
80        removeAll: removeAll,
81        tables: tables
82    }
83})();
84
85
86
87//removeSlider(1041);
88
89/*
90getSlider(1041)
91    .then()
92    .then((data) => {
93        console.log(data);
94    });
95*/
96
97/*
98getAll()
99    .then()
100    .then((data) => {
101        console.log(data);
102    })
103*/
104
105/*
106fetch('http://localhost/api/cpr/slider', {
107        headers: {
108            'Content-Type': 'application/json',
109            'Accept': 'application/json',
110            'WEB_TOKEN': '2CBA70FE-EAFD-482D-89CC-453660D489C0'
111        }
112    })
113    .then(function(response) {
114        return response.json();
115    }).then(function(result) {
116        if (result.Code === 1) {
117
118            //console.log(result.Value);
119            for (var key in result.Value) {
120                insertSliders(result.Value[key])
121                    .then(function() {
122                        //console.log('add slider done!', key);
123                    })
124                    .catch(console.error);
125            }
126
127
128        } else {
129            console.log(result.Message);
130        }
131    }).catch(function(err) {
132        console.log(err);
133    });
134*/
135
136// fetch('notes.json')
137// .then(function (res) {
138//     return res.json();
139// })
140// .then(function (data) {
141//    for(var key in data)
142//    {
143//        writeNote(data[key])
144//        .then(function () {
145//           console.log('write Note Done !',key);
146//        })
147//        .catch(console.error);
148//    } 
149// });
150
151// if('indexedDB' in window)
152// {
153
154// }

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.