{"id":0,"registry":{"0":{"submorphs":[{"__isSmartRef__":true,"id":1}],"scripts":[],"shape":{"__isSmartRef__":true,"id":14},"eventHandler":{"__isSmartRef__":true,"id":15},"_ClipMode":"visible","derivationIds":["EC7EBB28-54AE-4244-80ED-3E13650F82B7","342A6C62-C553-4289-957D-07B19D272AC3","AAC56214-32F4-4C5F-B923-F0C73102EF8B"],"id":"5D62F727-7938-4DE2-9008-F3C3FCCFDFF6","grabbingEnabled":false,"droppingEnabled":false,"halosEnabled":true,"value":false,"toggle":false,"isActive":true,"label":{"__isSmartRef__":true,"id":1},"_PreviousBorderWidth":1,"isPressed":false,"showsHalos":false,"attributeConnections":[{"__isSmartRef__":true,"id":16}],"doNotSerialize":["$$fire"],"doNotCopyProperties":["$$fire"],"name":"ShareWorldButtonForDan","partsBinMetaInfo":{"__isSmartRef__":true,"id":18},"#startLetters":"trans","moved":true,"magnets":[{"__isSmartRef__":true,"id":30},{"__isSmartRef__":true,"id":31},{"__isSmartRef__":true,"id":32},{"__isSmartRef__":true,"id":33},{"__isSmartRef__":true,"id":34},{"__isSmartRef__":true,"id":35},{"__isSmartRef__":true,"id":36},{"__isSmartRef__":true,"id":37}],"mailedURL":{"__isSmartRef__":true,"id":38},"_Rotation":0,"_Scale":1,"__serializedExpressions__":["_Position","distanceToDragEvent"],"partTests":{"__isSmartRef__":true,"id":39},"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":47},"__LivelyClassName__":"lively.morphic.Button","__SourceModuleName__":"Global.lively.morphic.Widgets","_Position":"lively.pt(0.0,0.0)","distanceToDragEvent":"lively.pt(71.0,-11.0)"},"1":{"submorphs":[],"scripts":[],"shape":{"__isSmartRef__":true,"id":2},"_WhiteSpaceHandling":"pre-wrap","textChunks":[{"__isSmartRef__":true,"id":3}],"eventHandler":{"__isSmartRef__":true,"id":5},"_ClipMode":"hidden","derivationIds":["7884E73F-0D17-44B3-907F-44A5223F1F3D","941B958E-2F98-4E5B-B244-859ACE2764DE","B86E795F-5D6F-4F5A-B046-5A7A4D01AB3F"],"id":"8E4BC49A-1826-430A-B1C9-50A62192070E","grabbingEnabled":false,"droppingEnabled":false,"halosEnabled":true,"fixedWidth":true,"_WordBreak":"break-all","fixedHeight":true,"_InputAllowed":false,"_HandStyle":"default","allowInput":false,"_FontFamily":"Helvetica","_FontSize":10,"evalEnabled":false,"owner":{"__isSmartRef__":true,"id":0},"isLabel":true,"_Align":"center","eventsAreIgnored":true,"_TextStylingMode":true,"showsHalos":false,"eventsAreDisabled":true,"_PointerEvents":"none","magnets":[{"__isSmartRef__":true,"id":6},{"__isSmartRef__":true,"id":7},{"__isSmartRef__":true,"id":8},{"__isSmartRef__":true,"id":9},{"__isSmartRef__":true,"id":10},{"__isSmartRef__":true,"id":11},{"__isSmartRef__":true,"id":12},{"__isSmartRef__":true,"id":13}],"__serializedExpressions__":["_TextColor"],"__LivelyClassName__":"lively.morphic.Text","__SourceModuleName__":"Global.lively.morphic.TextCore","_TextColor":"Color.rgb(0,0,0)"},"2":{"_BorderWidth":0,"_Fill":null,"__serializedExpressions__":["_Position","_Extent","_Padding","_BorderColor"],"__LivelyClassName__":"lively.morphic.Shapes.Rectangle","__SourceModuleName__":"Global.lively.morphic.Shapes","_Position":"lively.pt(0.0,0.0)","_Extent":"lively.pt(100.0,20.0)","_Padding":"lively.rect(0,3,0,0)","_BorderColor":"Color.rgb(0,0,0)"},"3":{"style":{"__isSmartRef__":true,"id":4},"chunkOwner":{"__isSmartRef__":true,"id":1},"_id":"_4702","storedString":"Share via mail","__LivelyClassName__":"lively.morphic.TextChunk","__SourceModuleName__":"Global.lively.morphic.TextCore"},"4":{"textShadow":"0px 1px 0 rgba(255,255,255,1)","__LivelyClassName__":"lively.morphic.TextEmphasis","__SourceModuleName__":"Global.lively.morphic.TextCore"},"5":{"morph":{"__isSmartRef__":true,"id":1},"__LivelyClassName__":"lively.morphic.EventHandler","__SourceModuleName__":"Global.lively.morphic.Events"},"6":{"morph":{"__isSmartRef__":true,"id":1},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.0,0.0)","cachedGlobalPosition":"lively.pt(521.0,239.0)"},"7":{"morph":{"__isSmartRef__":true,"id":1},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.5,0.0)","cachedGlobalPosition":"lively.pt(571.0,239.0)"},"8":{"morph":{"__isSmartRef__":true,"id":1},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(1.0,0.0)","cachedGlobalPosition":"lively.pt(621.0,239.0)"},"9":{"morph":{"__isSmartRef__":true,"id":1},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(1.0,0.5)","cachedGlobalPosition":"lively.pt(621.0,249.0)"},"10":{"morph":{"__isSmartRef__":true,"id":1},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(1.0,1.0)","cachedGlobalPosition":"lively.pt(621.0,259.0)"},"11":{"morph":{"__isSmartRef__":true,"id":1},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.5,1.0)","cachedGlobalPosition":"lively.pt(571.0,259.0)"},"12":{"morph":{"__isSmartRef__":true,"id":1},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.0,1.0)","cachedGlobalPosition":"lively.pt(521.0,259.0)"},"13":{"morph":{"__isSmartRef__":true,"id":1},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.0,0.5)","cachedGlobalPosition":"lively.pt(521.0,249.0)"},"14":{"_BorderWidth":1,"_BorderRadius":5,"_AppearanceStylingMode":true,"_BorderStylingMode":true,"__serializedExpressions__":["_Position","_Extent","_Padding","_BorderColor"],"__LivelyClassName__":"lively.morphic.Shapes.Rectangle","__SourceModuleName__":"Global.lively.morphic.Shapes","_Position":"lively.pt(0.0,0.0)","_Extent":"lively.pt(100.0,20.0)","_Padding":"lively.rect(0,0,0,0)","_BorderColor":"Color.rgb(189,190,192)"},"15":{"morph":{"__isSmartRef__":true,"id":0},"__LivelyClassName__":"lively.morphic.EventHandler","__SourceModuleName__":"Global.lively.morphic.Events"},"16":{"sourceObj":{"__isSmartRef__":true,"id":0},"sourceAttrName":"fire","targetObj":{"__isSmartRef__":true,"id":0},"targetMethodName":"doAction","varMapping":{"__isSmartRef__":true,"id":17},"__LivelyClassName__":"AttributeConnection","__SourceModuleName__":"Global.lively.bindings.Core"},"17":{"source":{"__isSmartRef__":true,"id":0},"target":{"__isSmartRef__":true,"id":0}},"18":{"partName":"ShareWorldButtonForDan","requiredModules":[],"partsSpaceName":"PartsBin/Collaboration/","comment":"A Button that will open a mail morph that is let's you share a link to a Lively World with others!","changes":[{"__isSmartRef__":true,"id":19},{"__isSmartRef__":true,"id":21},{"__isSmartRef__":true,"id":23},{"__isSmartRef__":true,"id":25},{"__isSmartRef__":true,"id":27}],"migrationLevel":4,"lastModifiedDate":{"__isSmartRef__":true,"id":29},"revisionOnLoad":192754,"__LivelyClassName__":"lively.PartsBin.PartsBinMetaInfo","__SourceModuleName__":"Global.lively.PartsBin"},"19":{"date":{"__isSmartRef__":true,"id":20},"author":"robertkrahn","message":"Save the world under a (temporary) URL for mail sharing.","id":"61DFF939-5FA7-4159-BE55-37C12F5B5709"},"20":{"isSerializedDate":true,"string":"Wed Feb 20 2013 16:07:03 GMT-0800 (PST)"},"21":{"date":{"__isSmartRef__":true,"id":22},"author":null,"message":"no comment","id":"F8B70225-5143-4A51-ABB4-344B488B3811"},"22":{"isSerializedDate":true,"string":"Tue Dec 11 2012 13:15:42 GMT-0800 (PST)"},"23":{"date":{"__isSmartRef__":true,"id":24},"author":"robertkrahn","message":"no comment","id":"9B8B6BE4-4519-4A6C-8F47-70DE61BBB0FB"},"24":{"isSerializedDate":true,"string":"Tue Dec 11 2012 13:53:16 GMT-0800 (PST)"},"25":{"date":{"__isSmartRef__":true,"id":26},"author":"robertkrahn","message":"no comment","id":"8909FD8C-C8D0-4217-9883-07A42821CB42"},"26":{"isSerializedDate":true,"string":"Wed Feb 20 2013 14:48:59 GMT-0800 (PST)"},"27":{"date":{"__isSmartRef__":true,"id":28},"author":"robertkrahn","message":"Fixed URL generation for mailed URLs","id":"46B07DC0-C290-494F-A296-F36B82EE912A"},"28":{"isSerializedDate":true,"string":"Thu Feb 21 2013 11:41:41 GMT-0800 (PST)"},"29":{"isSerializedDate":true,"string":"Wed Feb 20 2013 16:05:10 GMT-0800 (PST)"},"30":{"morph":{"__isSmartRef__":true,"id":0},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.0,0.0)","cachedGlobalPosition":"lively.pt(521.0,239.0)"},"31":{"morph":{"__isSmartRef__":true,"id":0},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.5,0.0)","cachedGlobalPosition":"lively.pt(571.0,239.0)"},"32":{"morph":{"__isSmartRef__":true,"id":0},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(1.0,0.0)","cachedGlobalPosition":"lively.pt(621.0,239.0)"},"33":{"morph":{"__isSmartRef__":true,"id":0},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(1.0,0.5)","cachedGlobalPosition":"lively.pt(621.0,249.0)"},"34":{"morph":{"__isSmartRef__":true,"id":0},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(1.0,1.0)","cachedGlobalPosition":"lively.pt(621.0,259.0)"},"35":{"morph":{"__isSmartRef__":true,"id":0},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.5,1.0)","cachedGlobalPosition":"lively.pt(571.0,259.0)"},"36":{"morph":{"__isSmartRef__":true,"id":0},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.0,1.0)","cachedGlobalPosition":"lively.pt(521.0,259.0)"},"37":{"morph":{"__isSmartRef__":true,"id":0},"connectedControlPoints":[],"__serializedExpressions__":["position","cachedGlobalPosition"],"__LivelyClassName__":"lively.morphic.RelativeMagnet","__SourceModuleName__":"Global.lively.morphic.Connectors","position":"lively.pt(0.0,0.5)","cachedGlobalPosition":"lively.pt(521.0,249.0)"},"38":{"protocol":"http:","hostname":"lively-kernel.org","pathname":"/repository/webwerkstatt/users/robertkrahn/ShareWorldButton-mailed4.xhtml","__LivelyClassName__":"URL","__SourceModuleName__":"Global.lively.Network"},"39":{"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":40}},"40":{"testGetMailURLDoesNotAppendPostfixMultipleTimes":{"__isSmartRef__":true,"id":41},"testGetMailURLAppendsMailSpecificPostfix":{"__isSmartRef__":true,"id":44}},"41":{"varMapping":{"__isSmartRef__":true,"id":42},"source":"function testGetMailURLDoesNotAppendPostfixMultipleTimes(aPart) {\n    var url = new URL('http://foo.bar/baz-mailed1.xhtml'),\n        expected = new URL('http://foo.bar/baz-mailed2.xhtml');\n    this.assertEquals(expected, aPart.getMailURL(url));\n}","funcProperties":{"__isSmartRef__":true,"id":43},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"42":{"this":{"__isSmartRef__":true,"id":39}},"43":{},"44":{"varMapping":{"__isSmartRef__":true,"id":45},"source":"function testGetMailURLAppendsMailSpecificPostfix(aPart) {\n    var expected = new URL('http://foo.bar/baz-mailed1.xhtml'),\n        url = new URL('http://foo.bar/baz.xhtml');\n    this.assertEquals(expected, aPart.getMailURL(url));\n}","funcProperties":{"__isSmartRef__":true,"id":46},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"45":{"this":{"__isSmartRef__":true,"id":39}},"46":{},"47":{"doAction":{"__isSmartRef__":true,"id":48},"onSendMail":{"__isSmartRef__":true,"id":52},"getMailURL":{"__isSmartRef__":true,"id":56}},"48":{"varMapping":{"__isSmartRef__":true,"id":49},"source":"function doAction() {\n    var url = URL.source,\n        worldURLForMail = this.getMailURL(url),\n        mailMorph = lively.PartsBin.getPart(\"EmailMorph\", 'PartsBin/Collaboration');\n    mailMorph.setMailContent({\n        subject: 'Check out this Lively World!',\n        content: Strings.format(\n            'Hey, have you seen the \"%s\" Lively World yet?'\n          + '\\n\\nVisit it here: %s',\n            url.filename().replace(/(-mailed[0-9]+)?\\..*$/, ''), worldURLForMail)});\n    mailMorph.openInWorld();\n    var p = this.getPositionInWorld().addPt(this.innerBounds().bottomCenter());\n    mailMorph.align(mailMorph.bounds().topCenter(), p);\n    mailMorph.get('ToText').focus();\n    this.mailedURL = worldURLForMail;\n    mailMorph.informOnSend(this, 'onSendMail');\n}","funcProperties":{"__isSmartRef__":true,"id":50},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"49":{"this":{"__isSmartRef__":true,"id":0}},"50":{"timestamp":{"__isSmartRef__":true,"id":51},"user":"robertkrahn","tags":[]},"51":{"isSerializedDate":true,"string":"Thu Feb 21 2013 11:40:39 GMT-0800 (PST)"},"52":{"varMapping":{"__isSmartRef__":true,"id":53},"source":"function onSendMail() {\n    var world = this.world();\n    try {\n        var oldVisitNewPageAfterSaveAs = world.visitNewPageAfterSaveAs;\n        world.visitNewPageAfterSaveAs = Functions.Null;\n        world.saveWorldAs(this.mailedURL, false);\n    } finally {\n        (function() {\n            world.visitNewPageAfterSaveAs = oldVisitNewPageAfterSaveAs;\n        }).delay(4);\n    }\n}","funcProperties":{"__isSmartRef__":true,"id":54},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"53":{"this":{"__isSmartRef__":true,"id":0}},"54":{"timestamp":{"__isSmartRef__":true,"id":55},"user":"robertkrahn","tags":[]},"55":{"isSerializedDate":true,"string":"Wed Feb 20 2013 16:05:22 GMT-0800 (PST)"},"56":{"varMapping":{"__isSmartRef__":true,"id":57},"source":"function getMailURL(url) {\n    // takes a URL and creates a new one from it by appending \"mailedX\"\n    // where X is a number. Example:\n    // http://foo.bar/baz.xhtml -> http://foo.bar/baz-mailed1.xhtml\n    // Ensures that there is no existing world behind the new URL.\n    var url = url || URL.source,\n        filename = url.filename();\n    // Dissect the URL in order to find the basename, strip existing\n    // \"mailed\" postfixes from it, get the file extension, ...\n    var nameMatch = filename.match(/([^-]+)(-mailed([0-9]+))?(\\.(x)?html)$/),\n        i = (nameMatch && Number(nameMatch[3]) + 1) || 1,\n        basename = (nameMatch && nameMatch[1])\n                || filename.replace(/\\.(x)?html/, ''),\n        ext = (nameMatch && nameMatch[4]) || '.xhtml',\n        newURL;\n    // now we count up i until we find a non-existing URL...\n    do {\n        var newName = basename + '-mailed' + i + ext;\n        newURL = url.withFilename(newName);\n        i++;\n    } while (newURL.asWebResource().exists());\n    return newURL;\n}","funcProperties":{"__isSmartRef__":true,"id":58},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"57":{"this":{"__isSmartRef__":true,"id":0}},"58":{"timestamp":{"__isSmartRef__":true,"id":59},"user":"robertkrahn","tags":[]},"59":{"isSerializedDate":true,"string":"Thu Feb 21 2013 11:38:48 GMT-0800 (PST)"},"isSimplifiedRegistry":true}}