Skip to Content

JavaScript File

URL: http://xlib.info/js/article.js?v=11
HTTP Status: 200 OK
MIME Type: application/javascript
Last Modified: Sat, 11 Apr 2020 05:54:59 GMT
Download Time: Less than a second
Cookies: None
Size: 5 KB
HTTP Headers:  10 headers
Links In:  1 pages
Links Out:  0 links
Images:  0 images
CSS:  0 files
JavaScript:  0 files
OK Issues: No issues found

1var bookmarkButton = new Vue({

2 el: '#bookmarkButton',

3 data() {

4 return {

5 bookmark: false,

6 articleId: window.article_id,

7 };

8 },

9 mounted() {

10 ids = [];

11 let cooks = Cookies.get('favourites_ids');

12 if(typeof cooks == 'undefined') {

13 Cookies.set('favourites_ids', JSON.stringify(ids));

14 } else {

15 ids = JSON.parse(cooks);

16 }

17 if(ids.indexOf(this.articleId) !== -1) {

18 this.bookmark = true;

19 }

20 },

21 methods: {

22 toggle() {

23 ids = [];

24 let cooks = Cookies.get('favourites_ids');

25 if(typeof cooks == 'undefined') {

26 Cookies.set('favourites_ids', JSON.stringify(ids));

27 } else {

28 ids = JSON.parse(cooks);

29 }

30 if(ids.indexOf(this.articleId) !== -1) {

31 let ids = JSON.parse(cooks);

32 var index = ids.indexOf(this.articleId);

33 ids.splice(index, 1);

34 Cookies.set('favourites_ids', JSON.stringify(ids));

35 window.vHeader.favouritesCount = ids.length;

36 this.bookmark = false;

37 } else {

38 ids.push(this.articleId);

39 Cookies.set('favourites_ids', JSON.stringify(ids));

40 window.vHeader.favouritesCount = ids.length;

...

</html>