@@ -1047,12 +1047,18 @@ var link = (function(){
10471047var makeGroupOptions = function ( ) {
10481048if ( bookmarks . get ( ) . length > 0 ) {
10491049bookmarks . get ( ) . forEach ( function ( arrayItem , index ) {
1050+ var name ;
1051+ if ( arrayItem . name . text == null || arrayItem . name . text == "" ) {
1052+ name = "Unnamed group " + ( index + 1 ) ;
1053+ } else {
1054+ name = arrayItem . name . text ;
1055+ } ;
10501056var option = helper . makeNode ( {
10511057tag : "option" ,
1052- text : arrayItem . name . text ,
1058+ text : name ,
10531059attr : [ {
10541060key : "value" ,
1055- value : arrayItem . name . text
1061+ value : name
10561062} ]
10571063} ) ;
10581064groupExistingGroup . appendChild ( option ) ;
@@ -1413,7 +1419,7 @@ var link = (function(){
14131419groupBody . appendChild ( linkEmpty ) ;
14141420group . appendChild ( groupBody ) ;
14151421addButton . addEventListener ( "click" , function ( event ) {
1416- link . add . item . open ( ) ;
1422+ add . item . open ( ) ;
14171423} , false ) ;
14181424return group ;
14191425} ,
@@ -1424,8 +1430,8 @@ var link = (function(){
14241430linkEmpty . appendChild ( para ) ;
14251431linkEmpty . appendChild ( addButton ) ;
14261432addButton . addEventListener ( "click" , function ( event ) {
1427- link . add . item . open ( ) ;
1428- link . add . item . selectGroup ( groupIndex ) ;
1433+ add . item . open ( ) ;
1434+ add . item . selectGroup ( groupIndex ) ;
14291435} , false ) ;
14301436return linkEmpty ;
14311437} ,
@@ -1636,6 +1642,7 @@ var link = (function(){
16361642pagelock . unlock ( ) ;
16371643} ,
16381644selectGroup : function ( groupIndex ) {
1645+ stagedGroup . init ( ) ;
16391646stagedLink . position . destination . group = groupIndex ;
16401647stagedLink . position . destination . item = 0 ;
16411648helper . e ( ".link-form-select-group" ) . selectedIndex = stagedLink . position . destination . group ;
@@ -1750,7 +1757,12 @@ var link = (function(){
17501757var form = render . group . form ( {
17511758useStagedGroup : true
17521759} ) ;
1753- var heading = "Edit " + stagedGroup . group . name . text ;
1760+ var heading ;
1761+ if ( stagedGroup . group . name . text == null || stagedGroup . group . name . text == "" ) {
1762+ heading = "Edit unnamed group " + ( stagedGroup . position . origin + 1 ) ;
1763+ } else {
1764+ heading = "Edit " + stagedGroup . group . name . text ;
1765+ } ;
17541766var successAction = function ( ) {
17551767var copyStagedGroup = JSON . parse ( JSON . stringify ( stagedGroup ) ) ;
17561768bookmarks . mod . edit . group ( copyStagedGroup ) ;
@@ -1844,10 +1856,10 @@ var link = (function(){
18441856stagedGroup . group = JSON . parse ( JSON . stringify ( copyStagedGroup . group ) ) ;
18451857stagedGroup . position = JSON . parse ( JSON . stringify ( copyStagedGroup . position ) ) ;
18461858var heading ;
1847- if ( stagedGroup . group . name . text != null && stagedGroup . group . name . text ! ="" ) {
1848- heading = "Remove " + stagedGroup . group . name . text ;
1859+ if ( stagedGroup . group . name . text == null || stagedGroup . group . name . text = ="" ) {
1860+ heading = "Remove unnamed group " + ( stagedGroup . position . origin + 1 ) ;
18491861} else {
1850- heading = "Remove unnamed group" ;
1862+ heading = "Remove " + stagedGroup . group . name . text ;
18511863} ;
18521864var successAction = function ( ) {
18531865var copyStagedGroup = JSON . parse ( JSON . stringify ( stagedGroup ) ) ;
0 commit comments