File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -699,6 +699,19 @@ $('.stars').each(function(idx, element){
699
699
}
700
700
} ) ;
701
701
702
+ function setInstalledText ( ) {
703
+ var button = $ ( '#extension-button' ) ;
704
+ if ( button && button . hasClass ( 'is-installed' ) ) {
705
+ button . find ( '.button-text' ) . text ( 'Already installed' ) ;
706
+ }
707
+ }
708
+
709
+ setInstalledText ( ) ;
710
+ // The is-installed class is added by the extension. It is unspecified when
711
+ // this is done. So check again in a second or so.
712
+ setTimeout ( setInstalledText , 1000 ) ;
713
+
714
+ // chrome.webstore.install can only be called from standard event handlers.
702
715
document . getElementById ( 'extension-button' ) . addEventListener ( 'click' , function ( event ) {
703
716
var button = $ ( event . target ) ;
704
717
if ( button . hasClass ( 'is-installed' ) ) {
@@ -743,9 +756,13 @@ document.getElementById('extension-button').addEventListener('click', function(e
743
756
openInWindow ( ) ;
744
757
} ) ;
745
758
} catch ( e ) {
759
+ button . removeClass ( 'is-installed' ) ;
760
+ button . find ( '.button-text' ) . text ( 'Add to chrome' ) ;
746
761
openInWindow ( ) ;
747
762
}
748
763
} else {
764
+ button . removeClass ( 'is-installed' ) ;
765
+ button . find ( '.button-text' ) . text ( 'Add to chrome' ) ;
749
766
openInWindow ( ) ;
750
767
}
751
768
} ) ;
You can’t perform that action at this time.
0 commit comments