PageSourceSearch

https://www.gbiota.com/wp-content/plugins/page-views-count/assets/js/pvc.backbone.js?ver=2.9.2

js gbiota.com collected 2026-10-09 18:14:38 UTC 3,474 bytes, 123 lines download raw bytes

1jQuery( function( $ ) {
2	var call_url = typeof pvc_vars.ajax_load_type != 'undefined' && pvc_vars.ajax_load_type == 'admin_ajax' ? pvc_vars.ajax_url : pvc_vars.rest_api_url;
3
4	pvc = { apps: {}, models: {}, collections: {}, views: {} };
5
6	_.templateSettings = {
7  		evaluate: /[<{][%{](.+?)[%}][}>]/g,
8    	interpolate: /[<{][%{]=(.+?)[%}][}>]/g,
9    	escape: /[<{][%{]-(.+?)[%}][}>]/g
10	}
11	
12	pvc.models.State = Backbone.Model.extend({
13		defaults: {
14			post_id: 0,
15			total_view: 1,
16			today_view: 1
17		}
18	});
19	
20	pvc.collections.Stats = Backbone.Collection.extend({
21		model: pvc.models.State,
22		
23		url: call_url
24		
25	});
26	
27	pvc.views.State = Backbone.View.extend({
28		model: pvc.models.State,
29				
30		tagName: 'span',
31		
32		template: _.template( $('#pvc-stats-view-template').html() ),
33		
34		initialize: function() {
35			
36		},
37		
38		render: function() {
39			//console.log('Rendering Page View Count of ID #' + this.model.get('post_id') + ' - Today: #' + this.model.get('today_view') + ' - Total: #' + this.model.get('total_view'));
40			this.$el.html( this.template( this.model.toJSON() ) );
41			
42			return this;
43		}
44		
45	});
46	
47	pvc.views.AppView = Backbone.View.extend({
48		
49		initialize: function() {
50			this.listenTo( this.collection, 'add', this.addOne );
51				
52		},
53		addOne: function( state_model ) {
54			var state_view = new pvc.views.State( { model: state_model } );
55			this.$el.html( state_view.render().el );
56		}
57	});
58	
59	pvc.apps.app = {
60		initialize: function( pvc_ids ) {
61			this.call_url = call_url;
62			//console.log('Load Page View Count of ' + JSON.stringify(pvc_ids) );
63
64			view_pvc_ids = [];
65			increase_pvc_ids = [];
66
67			$.each( pvc_ids, function (index, data) {
68				if ( data.ask_update ) {
69					increase_pvc_ids.push( data.post_id );
70				} else {
71					view_pvc_ids.push( data.post_id );
72				}
73			});
74
75			if ( increase_pvc_ids.length ) {
76				action = typeof pvc_vars.ajax_load_type != 'undefined' && pvc_vars.ajax_load_type == 'admin_ajax' ? '?action=pvc_increase&security=' + pvc_vars.security + '&ids=' : '/increase/';
77				$.get( this.call_url + action + increase_pvc_ids.join(','), function( data_pvc ) {
78					//console.log(data_pvc);
79					if ( data_pvc.success ) {
80						$.each( data_pvc.items, function (index, data) {
81							collection = new pvc.collections.Stats;
82							new pvc.views.AppView( { collection: collection, el : $('#pvc_stats_' + index ) } );
83							collection.add( data );
84							
85						});
86					}
87				});
88			}
89
90			if ( view_pvc_ids.length ) {
91				action = typeof pvc_vars.ajax_load_type != 'undefined' && pvc_vars.ajax_load_type == 'admin_ajax' ? '?action=pvc_view&security=' + pvc_vars.security + '&ids=' : '/view/';
92				$.get( this.call_url + action + view_pvc_ids.join(','), function( data_pvc ) {
93					//console.log(data_pvc);
94					if ( data_pvc.success ) {
95						$.each( data_pvc.items , function (index, data) {
96							collection = new pvc.collections.Stats;
97							new pvc.views.AppView( { collection: collection, el : $('#pvc_stats_' + index ) } );
98							collection.add( data );
99							
100						});
101					}
102				});
103			}
104		}
105
106	}
107		
108});
109
110jQuery( document ).ready( function( $ ) {
111	var pvc_stats = $( '.pvc_stats' );
112	if ( pvc_stats.length ) {
113		var pvc_ids = {};
114		$(".pvc_stats").each( function() {
115			post_id = $(this).data('element-id');
116			update_status = $(this).hasClass('pvc_load_by_ajax_update');
117			pvc_ids[post_id] = { post_id: post_id, ask_update : update_status };
118		});
119		
120		var app = pvc.apps.app;
121		app.initialize( pvc_ids );
122	}
123});

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.