Commit 175d76af66a9308f67dd68394358263c7d0fec4b
- Diff rendering mode:
- inline
- side by side
swtr/static/js/main.js
(14 / 2)
  | |||
313 | 313 | this.showSweets(); | |
314 | 314 | return false; | |
315 | 315 | }, | |
316 | // function to update the urls in the UI if an image is loaded internally | ||
317 | // and not from user UI. | ||
318 | updateURLs: function(url) { | ||
319 | $('#user-input').val(url); | ||
320 | }, | ||
316 | 321 | // load a URL for annotation (can be of image or html resource for now) | |
317 | 322 | loadURL: function(url, type) { | |
318 | 323 | //console.log('loadURL()'); | |
… | … | ||
328 | 328 | // if type is given explicitly; we load it as such. | |
329 | 329 | if(type === 'image') { | |
330 | 330 | this.initImageAnno(url); | |
331 | this.updateURLs(url); | ||
331 | 332 | return false; | |
332 | 333 | } | |
333 | 334 | // else try to find what resource is the URL.. | |
… | … | ||
547 | 547 | find('img').attr('src'); | |
548 | 548 | //TODO: load the image in the play area/workbench | |
549 | 549 | console.log('load image anno', url); | |
550 | swtr.app_router.loadPlayArea(url, 'image'); | ||
550 | 551 | }, | |
551 | 552 | search: function(data, cb) { | |
552 | 553 | swtr.appView.$overlay.show(); | |
… | … | ||
879 | 879 | } | |
880 | 880 | $('#' + id).show(); | |
881 | 881 | this.highlight(id); | |
882 | console.log('shown', id); | ||
882 | 883 | }, | |
883 | 884 | highlight: function(id) { | |
884 | 885 | $('#swtr-navbar-collapse li').removeClass('active'); | |
… | … | ||
890 | 890 | start: function() { | |
891 | 891 | var fragment = window.location.hash.split('#')[1]; | |
892 | 892 | if(!fragment) { | |
893 | this.navigate('home'); | ||
893 | this.navigate('home', {trigger: true}); | ||
894 | 894 | return; | |
895 | 895 | } | |
896 | 896 | var route = fragment.split('/')[1]; | |
897 | 897 | if(_.indexOf(_.keys(this.routes), route) > -1) { | |
898 | this.navigate(fragment); | ||
898 | this.navigate(fragment, {trigger: true}); | ||
899 | 899 | } | |
900 | }, | ||
901 | loadPlayArea: function(url, type) { | ||
902 | this.navigate('play', {trigger: true}); | ||
903 | this.mounted_component.loadURL(url, type); | ||
900 | 904 | } | |
901 | 905 | }); | |
902 | 906 |