Commit 2d3356eb398eb7425f04e8fd8774648477880c8e
- Diff rendering mode:
- inline
- side by side
swtr/static/js/swtmaker.js
(44 / 37)
  | |||
67 | 67 | return false; | |
68 | 68 | } | |
69 | 69 | /*if(!swtr.access_token) { | |
70 | throw new Error('Access Token required to get query that API'); | ||
71 | }*/ | ||
70 | throw new Error('Access Token required to get query that API'); | ||
71 | }*/ | ||
72 | 72 | // setting up params | |
73 | 73 | var where = options.where, | |
74 | 74 | who = options.who || null; | |
75 | url = swtr.swtstoreURL() + swtr.endpoints.get + '?where=' + | ||
76 | encodeURIComponent(where) + '&access_token=' + swtr.access_token; | ||
75 | url = swtr.swtstoreURL() + swtr.endpoints.get + '?where=' + | ||
76 | encodeURIComponent(where) + '&access_token=' + swtr.access_token; | ||
77 | 77 | if(who) { | |
78 | 78 | url += '&who=' + who; | |
79 | 79 | } | |
… | … | ||
108 | 108 | } | |
109 | 109 | ||
110 | 110 | var url = swtr.swtstoreURL() + swtr.endpoints.post + | |
111 | '?access_token=' + swtr.access_token; | ||
111 | '?access_token=' + swtr.access_token; | ||
112 | 112 | ||
113 | 113 | this.sync('create', dummy_collection, { | |
114 | 114 | url: url, | |
… | … | ||
294 | 294 | }, | |
295 | 295 | setImage: function(event) { | |
296 | 296 | event.preventDefault(); | |
297 | this.imgURL = $('#img-url-input').val(); | ||
298 | if(!this.imgURL) { | ||
297 | var url = $('#img-url-input').val(); | ||
298 | if(url.contains('.jpg') || url.contains('.png') || | ||
299 | url.contains('.gif') || url.contains('.jpeg')) { | ||
300 | this.imgURL = $('#img-url-input').val(); | ||
301 | if(!this.imgURL) { | ||
302 | return false; | ||
303 | } | ||
304 | if(this.$img.attr('src') === this.imgURL) { | ||
305 | return; | ||
306 | } | ||
307 | anno.reset(); | ||
308 | var self = this; | ||
309 | this.$overlay.show(); | ||
310 | this.helpview.step(7); | ||
311 | this.$img.attr('src', this.imgURL); | ||
299 | 312 | return false; | |
300 | 313 | } | |
301 | if(this.$img.attr('src') === this.imgURL) { | ||
302 | return; | ||
314 | else { | ||
315 | window.location.href = '/annotate?where=' + url; | ||
303 | 316 | } | |
304 | anno.reset(); | ||
305 | var self = this; | ||
306 | this.$overlay.show(); | ||
307 | this.helpview.step(7); | ||
308 | this.$img.attr('src', this.imgURL); | ||
309 | return false; | ||
310 | 317 | }, | |
311 | 318 | imageLoaded: function(event) { | |
312 | 319 | var self = event.data; | |
… | … | ||
541 | 541 | step: function(n) { | |
542 | 542 | var text = ''; | |
543 | 543 | switch (n) { | |
544 | case 0 : text = 'Getting annotations..'; | ||
545 | break; | ||
546 | case 1: text = 'Enter the URL of an image below, and start annotating!'; | ||
547 | break; | ||
548 | case 2: text = 'Annotate the image, or see other annotations'; | ||
549 | break; | ||
550 | case 3: text = 'Now you can sweet this annotation, or add more annotations'; | ||
551 | break; | ||
552 | case 4: text = 'Click Sweet button to publish these annotations to the Sweet Store'; | ||
553 | break; | ||
554 | case 5: text = 'Publishing your sweets'; | ||
555 | break; | ||
556 | case 6: text = 'Sweets successfully posted'; | ||
557 | break; | ||
558 | case 7: text = 'Fetching your image..'; | ||
559 | break; | ||
560 | case 8: text = 'Oops! Seems like the image URL is wrong! Or we couldn\'t fetch the image.'; | ||
561 | break; | ||
562 | case 9: text = 'You have to be <i>signed in</i> to sweet store to post sweets'; | ||
563 | break; | ||
564 | case 10: text = 'Oops! Something went wrong. We couldn\'t publish the sweets. Try again.' | ||
565 | break; | ||
544 | case 0 : text = 'Getting annotations..'; | ||
545 | break; | ||
546 | case 1: text = 'Enter the URL of an image below, and start annotating!'; | ||
547 | break; | ||
548 | case 2: text = 'Annotate the image, or see other annotations'; | ||
549 | break; | ||
550 | case 3: text = 'Now you can sweet this annotation, or add more annotations'; | ||
551 | break; | ||
552 | case 4: text = 'Click Sweet button to publish these annotations to the Sweet Store'; | ||
553 | break; | ||
554 | case 5: text = 'Publishing your sweets'; | ||
555 | break; | ||
556 | case 6: text = 'Sweets successfully posted'; | ||
557 | break; | ||
558 | case 7: text = 'Fetching your image..'; | ||
559 | break; | ||
560 | case 8: text = 'Oops! Seems like the image URL is wrong! Or we couldn\'t fetch the image.'; | ||
561 | break; | ||
562 | case 9: text = 'You have to be <i>signed in</i> to sweet store to post sweets'; | ||
563 | break; | ||
564 | case 10: text = 'Oops! Something went wrong. We couldn\'t publish the sweets. Try again.' | ||
565 | break; | ||
566 | 566 | } | |
567 | 567 | $(this.el).html(text); | |
568 | 568 | $(window).scrollTop(0, 0); |