1var b2LinkRegister = new Vue({ 2 el:'.links-register', 3 data:{ 4 link_name:'', 5 link_url:'', 6 link_image:'', 7 link_content:'', 8 locked:false, 9 progress:0, 10 disabled:false, 11 login:false 12 }, 13 computed:{ 14 userData(){ 15 return this.$store.state.userData 16 } 17 }, 18 mounted(){ 19 if(this.$refs.registerLink){ 20 this.hasPending() 21 } 22 23 if(b2token){ 24 this.login = true 25 } 26 27 if(document.querySelector('.b2-tab-link-in')){ 28 b2loadScript(b2_global.site_info.site_uri+'/Assets/fontend/library/tocbot.min.js','',()=>{ 29 tocbot.init({ 30 // Where to render the table of contents. 31 tocSelector: '.b2-tab-link-in', 32 // Where to grab the headings to build the table of contents. 33 contentSelector: '.links-home', 34 // Which headings to grab inside of the contentSelector element. 35 headingSelector: '.links-home .link-title h2', 36 hasInnerContainers: true, 37 headingsOffset: 140, 38 scrollSmoothOffset: -140 39 }); 40 41 new StickySidebar('.b2-tab-links', { 42 containerSelector:'.toc-list ', 43 topSpacing: 120, 44 resizeSensor: true, 45 }); 46 }) 47 } 48 49 }, 50 methods:{ 51 hasPending(){ 52 this.$https.get(b2_rest_url+'linkHasPending').then(res=>{ 53 this.disabled = res.data 54 }) 55 }, 56 submit(e){ 57 e.preventDefault() 58 this.locked = true 59 // console.log(tinyMCE.get('link_content_1').getContent({ format: 'text' })); 60 let data = { 61 link_name:this.link_name, 62 link_url:this.link_url, 63 link_category:this.$el.querySelector('.register-cat select').value, 64 link_image:this.link_image, 65 link_content:tinyMCE.get('link_content_1').getContent() 66 } 67 68 this.$https.post(b2_rest_url+'submitLink',Qs.stringify(data)).then(res=>{ 69 if(!this.userData.is_admin){ 70 this.disabled = true 71 } 72 73 Qmsg['success'](b2_global.js_text.global.submit_success,{html:true}); 74 75 this.link_name = '' 76 this.link_url = '' 77 this.link_category = '' 78 this.link_image = '' 79 this.link_content = '' 80 tinyMCE.get('link_content_1').setContent(''); 81 82 this.progress = 0 83 84 this.locked = false 85 }).catch(err=>{ 86 Qmsg['warning'](err.response.data.message,{html:true}); 87 this.locked = false 88 // this.disabled = false 89 }) 90 91 }, 92 imgUpload(event){ 93 if(event.target.files.length <= 0) return 94 if(this.locked == true) return 95 this.locked = true 96 this.progress = 0 97 let file = event.target.files[0] 98 99 let formData = new FormData() 100 101 formData.append('file',file,file.name) 102 formData.append("post_id", 1) 103 formData.append("type", 'avatar') 104 105 let config = { 106 onUploadProgress: progressEvent=>{ 107 this.progress = progressEvent.loaded / progressEvent.total * 100 | 0 108 } 109 } 110 111 this.toast = Qmsg['loading']('Loading...('+this.progress+'%)'); 112 113 this.$http.post(b2_rest_url+'fileUpload',formData,config).then(res=>{ 114 if(res.data.status == 401){ 115 Qmsg['warning'](res.data.message,{html:true}); 116 this.progress = 0 117 } 118 119 this.link_image = res.data.url 120 121 this.$refs.fileInput.value = null 122 this.locked = false; 123 this.toast.close() 124 }).catch(err=>{ 125 Qmsg['warning'](err.response.data.message,{html:true}); 126 this.locked = false 127 this.progress = 0 128 this.$refs.fileInput.value = null 129 this.toast.close() 130 }) 131 } 132 } 133}) 134 135var linkSingle = new Vue({ 136 el:'.single-link-rating', 137 data:{ 138 id:0, 139 locked:false, 140 up:0, 141 isUp:false 142 }, 143 mounted(){ 144 if(this.$refs.linkSingle){ 145 this.id = this.$refs.linkSingle.getAttribute('data-id') 146 this.getVote() 147 } 148 }, 149 methods:{ 150 getVote(){ 151 this.$http.post(b2_rest_url+'getLinkVote','link_id='+this.id
151).then(res=>{ 152 this.up = res.data.count 153 this.isUp = res.data.isup 154 }) 155 }, 156 linkVote(){ 157 if(this.locked) return 158 this.locked = true 159 this.$http.post(b2_rest_url+'linkVote','link_id='+this.id).then(res=>{ 160 161 this.up = this.up + res.data 162 163 if(res.data == -1){ 164 this.isUp = false 165 }else{ 166 this.isUp = true 167 } 168 169 this.locked = false; 170 171 }).catch(err=>{ 172 Qmsg['warning'](err.response.data.message,{html:true}); 173 this.locked = false 174 }) 175 } 176 } 177})
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.