{"20130609":"dickon_public","01. My Tiddlyspace Monitor (Tivity)":"dickon_public","1 Corinthians 13:12 - Glass darkly":"dickon_public","1. Wait":"dickon_public","2. Analyze":"dickon_public","3. Volunteer":"dickon_public","4. Evaluate":"dickon_public","@alexhough":"dickon_public","@ambit":"dickon_public","@ambit-admin":"dickon_public","@ambit-casus":"dickon_public","@ambit-content":"dickon_public","@ambit-kidsco":"dickon_public","@ambit-mac":"dickon_public","@ambit-new-theme-test":"dickon_public","@ambit-stories":"dickon_public","@ambit-tasks":"dickon_public","@ambit-theme":"dickon_public","@ambit-workgroup":"dickon_public","@ambit2":"dickon_public","@bauwebijl":"dickon_public","@blog":"dickon_public","@cdent":"dickon_public","@cdent-mt":"dickon_public","@chris-dent":"dickon_public","@dbtester":"dickon_public","@dialecticdad":"dickon_public","@dickon":"dickon_public","@dickontests":"dickon_public","@docs":"dickon_public","@faq":"dickon_public","@flicktiddler":"dickon_public","@fnd":"dickon_public","@ganalytics":"dickon_public","@glossary":"dickon_public","@interview":"dickon_public","@jermolene":"dickon_public","@jnthnlstr":"dickon_public","@jon":"dickon_public","@jrbl":"dickon_public","@maans":"dickon_public","@matt":"dickon_public","@mattlucht":"dickon_public","@psd":"dickon_public","@themes":"dickon_public","@tiddlyspace":"dickon_public","@tiddlyworld":"dickon_public","@tscount":"dickon_public","AMBIT":"dickon_public","AMBIT Outcomes Framework - development thoughts":"dickon_public","AMBIT URLs":"dickon_public","About":"pip-ii_public","About TiddlySpace":"dickon_public","About TiddlyWiki":"dickon_public","About me":"dickon_public","Academic (Literature review) Notes":"dickon_public","Activity":"dickon_public","ActivityStreamPlugin":"following_public","Anna Freud":"dickon_public","Anna Freud Centre":"dickon_public","BabyStudying":"dickon_public","BabyStudying [draft]":"dickon_public","Belsky et al 2012 - antecedents of Borderline PD":"dickon_public","Big thanks to all at Osmosoft":"dickon_public","Blog":"dickon_public","Blog about TiddlyManuals":"dickon_public","Borderliners - Living well in life's edgy places":"dickon_public","Breakdance making a better world":"dickon_public","CASUS":"dickon_public","CASUS - Cambs Child and Adolescent Substance Use Service":"dickon_public","CLARHC":"dickon_public","CLARHC-research project":"dickon_public","ColorPalette":"dickon_public","Compulsion":"dickon_public","Craving":"dickon_public","CravingCircuit":"dickon_public","Cup of Tea":"dickon_public","Dance Offensive":"dickon_public","DbtestersTester":"dickon_public","DeepSeaDiver":"dickon_public","DefaultTiddlers":"dickon_public","DelayWikifiedViewTypePlugin":"pip-ii_public","Do you keep adding new features to your existing TiddlyWiki(s)?":"dickon_public","Early Warning Signs":"dickon_public","EditTemplate":"pip-ii_public","Embedding video web pages and pictures":"dickon_public","ExtraFiltersPlugin":"filters_public","Forming, Storming and Norming":"dickon_public","GettingStarted":"backups_public","GoodChoiceBadChoice.jpg":"dickon_public","Google MBT Group":"dickon_public","Greatest poem in the english language":"dickon_public","Hello":"dickon_public","Hello Peter":"dickon_public","HelloThere":"edit_public","Help request 09.06.13 - AMBIT manual not working in Internet Explorer":"dickon_public","Hi Social":"dickon_public","HokusaiWave":"dickon_public","How did you first discover TiddlyWiki?":"dickon_public","How has the TiddlyWiki community helped you?":"dickon_public","How many TiddlyWikis have you created and do you use regularly?":"dickon_public","How many other people have you introduced to TiddlyWiki?":"dickon_public","How many tiddlers and how many megabytes in your largest TiddlyWiki?":"dickon_public","How the human capacity for Mentalizing arises":"dickon_public","How to use the activity feed":"following_public","HtmlCss":"stub_public","HtmlJavascript":"backups_public","If I want to notify the @ambit-workgroup of a thought":"dickon_public","ImportExternalLinksPlugin":"following_public","Index":"dickon_public","Lifepreserver":"dickon_public","Links":"dickon_public","LoadMissingExternalTiddler":"following_public","MBT-F":"dickon_public","MST-CAN":"dickon_public","MainMenu":"dickon_public","Mapping the territory":"dickon_public","MarkupPreHead":"backups_public","Mentalization":"dickon_public","Mentalizing":"dickon_public","Mentalizing Quotes":"dickon_public","Mentalizing Research and Quotes":"dickon_public","Mind-mindedness in parents - Walker et al":"dickon_public","MoreSocialPlugin":"social_public","Mortal Tides":"dickon_public","New AMBIT WHEEL":"dickon_public","NewHerePlugin":"dickon_public","NumberSortFilterPlugin":"filters_public","OnionLayers":"dickon_public","PageTemplate":"pip-ii_public","Picture Uploads like magic":"dickon_public","Please enter a title...":"dickon_public","Please help me import TW from tiddlyspot":"dickon_public","Poetry":"dickon_public","Progress on the tiddlymanual - check in here!":"dickon_public","Projects":"dickon_public","Psychiatry Chamber":"dickon_public","Public by Default":"dickon_public","RSSReaderPlugin":"dickon_public","Relaxation exercises":"dickon_public","Replies and Notifications":"following_public","Revalidation":"dickon_public","SeaChart":"dickon_public","Self-hate":"dickon_public","ServerSettings":"backups_public","Setup tiddler":"dickon_public","SideBarOptions":"pip-ii_public","SideBarTabs":"following_public","SiteIcon":"dickon_public","SiteInfo":"dickon_public","SiteSubtitle":"dickon_public","SiteTitle":"dickon_public","Spaces":"dickon_public","States of Mind":"dickon_public","Steering in stormy waters":"dickon_public","SteeringInStorm":"dickon_public","Stopwatch":"dickon_public","Stuff I don't understand":"dickon_public","Stuff I think about TiddlySpace":"dickon_public","StyleSheet":"dickon_public","StyleSheetHeader":"pip-ii_public","StyleSheetSideBar":"pip-ii_public","StyleSheetTiddlySpace":"pip-ii_public","TabFollowing":"following_public","Tennessee Williams - I don't ask for your pity":"dickon_public","Test call":"dickon_public","Testing following with @social":"dickon_public","Theory of Mind and Emotion Regulation Difficulties in Adolescents With Borderline Traits - Carla Sharp et al 2011":"dickon_public","Thinking together":"dickon_public","TiddlerEditablePlugin":"pip-ii_public","TiddlyManuals":"dickon_public","TiddlySocial":"dickon_public","TiddlySpace":"dickon_public","TiddlySpace home page":"dickon_public","TiddlySpaceFollowingSuggestions":"following_public","TiddlySpaceFollowingWizard":"following_public","TiddlySpaceIdentity":"dickon_public","TiddlySpaceIntraSpaceInclusion":"following_public","TiddlyWiki":"dickon_public","Tips for TiddlyWikis":"dickon_public","ToolbarCommands":"pip-ii_public","Trojan":"dickon_public","Trying out RSS feed in Tiddler - doesn't work!":"dickon_public","Upload test":"dickon_public","ViewTemplate":"pip-ii_public","WAVE":"dickon_public","WAVE Crisis Drill":"dickon_public","WWFW":"dickon_public","Welcome to AMBIT!":"dickon_public","Wenger and Lave - Communities of Practice":"dickon_public","What was it about TiddlyWiki that captured your interest?":"dickon_public","Wikis for note-taking":"dickon_public","Wikis in therapy":"dickon_public","Writing":"dickon_public","_topics":"following_public","activity":"tivity_public","allowedsites.txt":"dickon_public","angular.js":"backups_public","backups":"backups_public","backups.css":"backups_public","backups.js":"backups_public","backupsSetupFlag":"backups_public","complex-cogwheels!!!":"dickon_public","crankiness of social exchange in Tiddlyspace":"dickon_public","edit":"edit_public","edit.css":"edit_public","edit.js":"edit_public","editSetupFlag":"edit_public","editedit.js":"edit_public","extraclusion":"edit_public","follow":"dickon_public","friendjs":"following_public","friends":"following_public","included in ambit":"dickon_public","index":"backups_public","list@groupie":"dickon_public","loading.gif":"pip-ii_public","pip-iiSetupFlag":"pip-ii_public","reply.svg":"social_public","social discoursive aspects":"dickon_public","socialSetupFlag":"social_public","stubSetupFlag":"stub_public","that irritating american crime series called 'The Mentalist'":"dickon_public","tivitySetupFlag":"tivity_public","tsScanCountPlugin":"following_public"}
{"20130609":"\"54c02396f40d619d26c5048ded92f6bc\"","01. My Tiddlyspace Monitor (Tivity)":"\"54dabadd32e00bc447e51b2d98ccf277\"","1 Corinthians 13:12 - Glass darkly":"\"71b013ae30a789e9b0a0149706b546be\"","1. Wait":"\"bd5fb7c381da4b5248f5016039d56e63\"","2. Analyze":"\"30153c1886e9a34a1ce5968b1c6224a4\"","3. Volunteer":"\"3c6664ea1af67092c22a01430519888e\"","4. Evaluate":"\"ffa5e8d6b09c0ebe6444654b3fd5fb9e\"","@alexhough":"\"17363239272a86f62b3b459b6f8b0b97\"","@ambit":"\"d99143bc38b1c9e0b4b8cad0b1df1ac9\"","@ambit-admin":"\"9f6f8c9ebaff3a8c964a59e1667ee185\"","@ambit-casus":"\"76ef4c13a12fdf018eb3e2746b014d55\"","@ambit-content":"\"b828e271f59811db4dee132f42508e35\"","@ambit-kidsco":"\"2cccbbeb460473ba4fe467a365de25ba\"","@ambit-mac":"\"13a4b2bea68905edd2e22a6519af1ba9\"","@ambit-new-theme-test":"\"b29a731074f4c2e509e0da86cbce7ed9\"","@ambit-stories":"\"4c736eafb0e64e9ee0ddbf99aa533b24\"","@ambit-tasks":"\"2a2ac02746f399e4976a302c3053cb07\"","@ambit-theme":"\"79aed882568c58b0653b5aafdd251ca8\"","@ambit-workgroup":"\"333ab4e55a43f04e2ba770f27686087a\"","@ambit2":"\"d5e806a90e8e0b91a1c9340552787c98\"","@bauwebijl":"\"5ee9b134ebc534262375c3fb44fc818e\"","@blog":"\"45a4b5e8bcb79c172ef1aa750be96d61\"","@cdent":"\"281528794c1b618d04b70d8719097a14\"","@cdent-mt":"\"9abe1205d032af4043b21407412e6be4\"","@chris-dent":"\"114be760c276facec2bb2e2938993e5e\"","@dbtester":"\"0a5397f367434d3f7199037bac1dabb2\"","@dialecticdad":"\"fc41320ab66e8f693a913f42ae22d7fb\"","@dickon":"\"051d50559e842738336744404f02bd5b\"","@dickontests":"\"07dbd9f64a9737c9d0b578608d2b5b8b\"","@docs":"\"f52bdaa73369322aab15b74f6b093a61\"","@faq":"\"04bd79a94a11dadf05d5fa581f9a3029\"","@flicktiddler":"\"428aa091dc3b22841c1e9a4b6cda5146\"","@fnd":"\"95a5804f0b9c8b6660dac61e5a131c75\"","@ganalytics":"\"02553f7763055be35c05b92a97412be4\"","@glossary":"\"0e0345cf3f1af263030bdf51e57b5ea9\"","@interview":"\"d77c3f6b2bae5f22f3a9c4632807325f\"","@jermolene":"\"e8ebd20019b60d92010d6df84d84a86e\"","@jnthnlstr":"\"8e07a5237455f1a40e313a2963716b94\"","@jon":"\"a84cadb79127a9ba8ca2b3d1b485c59c\"","@jrbl":"\"7a911f413553aa22467d238a77e523d0\"","@maans":"\"8b9687047870ba693cf5afdf683c6708\"","@matt":"\"c171d9af0a564a527ab40a299630c07f\"","@mattlucht":"\"40115d4737e01244ae758e059439be26\"","@psd":"\"9c4e04151b1011705f9bd95318ac3666\"","@themes":"\"7e571b45167d26109abc631e37e945f3\"","@tiddlyspace":"\"8a2af5d4b41476c872a23350907521cd\"","@tiddlyworld":"\"b6bc5a85184ea4db75e0186a39e4cbb8\"","@tscount":"\"fbbd4bc6a3cc58de567de8178392a9bb\"","AMBIT":"\"3ad374032edb3f922bc0a1e507df1f2a\"","AMBIT Outcomes Framework - development thoughts":"\"3ca9a344f7029cf6363d6052712afe99\"","AMBIT URLs":"\"64deaf38a2d27fc54b052ae7bdae5cd7\"","About":"\"a8530eedd3c161bc42922d048cd6a769\"","About TiddlySpace":"\"8e511cf5da034987f9c6771bffa360ea\"","About TiddlyWiki":"\"1ee7751cfd8885cd8ac60e66a1de6174\"","About me":"\"2a240ebdd6a8cde159ed92edadd1c02f\"","Academic (Literature review) Notes":"\"c2405fa6e36fc120f34b2ca57b4784c5\"","Activity":"\"185431183e64dac79992b897be778118\"","ActivityStreamPlugin":"\"e88529505746242cf0a0c12553d8c7b9\"","Anna Freud":"\"adc472fc2b029f9298ca63bdb48d0e89\"","Anna Freud Centre":"\"2dbbaffd175dd12cfaa78b72c2e096b7\"","BabyStudying":"\"00114aff9db92cc84e99250d3bd88de3\"","BabyStudying [draft]":"\"7bfc8dffdfda75adac14f81e72997066\"","Belsky et al 2012 - antecedents of Borderline PD":"\"0e033c50d7072790a3cfea9a8e7f7cce\"","Big thanks to all at Osmosoft":"\"3fdfc595954c73aff485ee38408addf5\"","Blog":"\"e9a0dfd2abf9d7217b60115b01f90eaf\"","Blog about TiddlyManuals":"\"526863a67f306cf4817751790e0b0e16\"","Borderliners - Living well in life's edgy places":"\"8afac1e5cd6bd5316406e946f2dc3bc3\"","Breakdance making a better world":"\"0337c142f4eb737065c8207a0e06df8f\"","CASUS":"\"6b752a988c02953ee86e347b4f8c89fb\"","CASUS - Cambs Child and Adolescent Substance Use Service":"\"f27a8e4936b6dca761e0ae48cf859304\"","CLARHC":"\"671d08c7cf71b9c67c5361f1491f35ad\"","CLARHC-research project":"\"5c8b7e77a3696a8856848e25cd9cf819\"","ColorPalette":"\"6db13ca7392a2f60df2ea76b6f76e1de\"","Compulsion":"\"b6962f0fabbc4ac9ea644ac4e14bd1b6\"","Craving":"\"5d5c2b69c1e6b054f65982a837e2dd0a\"","CravingCircuit":"\"f43fee0e87c934c2892a9870957a6979\"","Cup of Tea":"\"f5cd49b55652cf1fb788b64988fff3f9\"","Dance Offensive":"\"8eb3d3fdf09103adcf1eff755e3d01c7\"","DbtestersTester":"\"5e2106a9da76e89345c203c18c1bdc53\"","DeepSeaDiver":"\"7e1f1639f43bf7d47c4864cd16b6cbd9\"","DefaultTiddlers":"\"a09d2b4476521a8241f41c75fde3b53c\"","DelayWikifiedViewTypePlugin":"\"ae443058d76c8e6996ec319dc1acca31\"","Do you keep adding new features to your existing TiddlyWiki(s)?":"\"cfbbd30c6dbe548671a6260c757b83ab\"","Early Warning Signs":"\"542fcb9f1bd65418cd58d4ae7607943a\"","EditTemplate":"\"5f9911f624eeda7a015f3fe3c687dd72\"","Embedding video web pages and pictures":"\"7ece33f454a2edc8738e24fd70599ec3\"","ExtraFiltersPlugin":"\"6aa27443aa7f85a43add7f50c3c6eaee\"","Forming, Storming and Norming":"\"76120866ea55380f8aad215a8e28d638\"","GettingStarted":"\"409a4e351300ab194c53edf5b0dc9d90\"","GoodChoiceBadChoice.jpg":"\"e93bac5db4e9e5e92590891b9ad0ef8c\"","Google MBT Group":"\"60b035e3512865107dd9adb682cb8fe5\"","Greatest poem in the english language":"\"7d68b2059ee1cde42be7d839ebef8a3c\"","Hello":"\"1553fa1e913c88a65c4e19a66aaa5578\"","Hello Peter":"\"a06e9f165d027c00e82efec1ddf6b85e\"","HelloThere":"\"9ca2063b6afc05950eb96a98aef28a50\"","Help request 09.06.13 - AMBIT manual not working in Internet Explorer":"\"9397815a32c7c5eed41433d32ef9dec3\"","Hi Social":"\"c9e108f87646df612457599225b98ad2\"","HokusaiWave":"\"dff2e37831507c831509de28c9590513\"","How did you first discover TiddlyWiki?":"\"0f2eb75f481aed1edf4854782ae6f94e\"","How has the TiddlyWiki community helped you?":"\"874822b77ea3b33425884fd300d550c9\"","How many TiddlyWikis have you created and do you use regularly?":"\"ecdf5862ba0d8564ab4506877dd9d725\"","How many other people have you introduced to TiddlyWiki?":"\"17339d228a66e289a2d83be51e54e4ec\"","How many tiddlers and how many megabytes in your largest TiddlyWiki?":"\"589a3aec1b6c5f64117507ff63f37ef4\"","How the human capacity for Mentalizing arises":"\"2de9bac69abe10c759ca7c27edb859a4\"","How to use the activity feed":"\"f9844842a881570d30acc39aa9aff37e\"","HtmlCss":"\"7091b9c1d60d9f65db697fe52c88b447\"","HtmlJavascript":"\"9134b5e2a5d7269f84bed5fdf589b6cd\"","If I want to notify the @ambit-workgroup of a thought":"\"70ff128a6ff681d7142d4372ea000dd0\"","ImportExternalLinksPlugin":"\"686da0b72d6d92db5b54b5d09b3e7754\"","Index":"\"4ee384cebae7e2ce61bcf8fde4efe0cc\"","Lifepreserver":"\"a39f778bdc484be1b0f5dc3c14301337\"","Links":"\"205003d261a48b41aa1f2761a8e8634d\"","LoadMissingExternalTiddler":"\"2017da0a8aa839962c54b4f421afe6c3\"","MBT-F":"\"d8d83ceae03479e07f695236ce40ae37\"","MST-CAN":"\"39368060bd9f9bd14881ec66716ef78b\"","MainMenu":"\"3828768c43fb40e5b7f7428d162ebcb3\"","Mapping the territory":"\"e109835df716de4540d0f75ac23e29cf\"","MarkupPreHead":"\"7ec453b7d65b0af35ca9f714cdd00b6a\"","Mentalization":"\"67a5f7cace273c77f1d22184354e744d\"","Mentalizing":"\"6230000b38e76adb04dd1d1dafb3c9be\"","Mentalizing Quotes":"\"5024d1116213e4e2a38882de53534a45\"","Mentalizing Research and Quotes":"\"f799952854193c8cf9dcc24408e51a83\"","Mind-mindedness in parents - Walker et al":"\"ba7385dc0bb59b16ca22795a64ffd6f0\"","MoreSocialPlugin":"\"0c7e421d5fc7658e403f776ac7342219\"","Mortal Tides":"\"78a3403d6fb69311ed34217f2c008d47\"","New AMBIT WHEEL":"\"51c703dee7357476ca1285f42dcb87db\"","NewHerePlugin":"\"46cfd8484e6ab7cfb96eba0a3a8314bd\"","NumberSortFilterPlugin":"\"03fb16394009bd5567fd904c5d704062\"","OnionLayers":"\"039b0efbcd752bd18db94862d46f5db2\"","PageTemplate":"\"86582b2d6d38d568f666b63fbf08f220\"","Picture Uploads like magic":"\"18f5f3096f4b3f0d5f2bdc2e169fc857\"","Please enter a title...":"\"94ba5299d55e43089d9e289b21c4f688\"","Please help me import TW from tiddlyspot":"\"012c781589151d7ed0a5f4be83de016f\"","Poetry":"\"6e14ac95fe956ca278ab4d9e45197106\"","Progress on the tiddlymanual - check in here!":"\"6640f73beb71f2807ed7b84e2ad4bc04\"","Projects":"\"e728defe981d7f9ae06fc0efae297756\"","Psychiatry Chamber":"\"88f24c80b2567bf182c860e8602bf483\"","Public by Default":"\"2bb3bffc2db0c604794af95560c3e1ce\"","RSSReaderPlugin":"\"9855e0c07ceab82330664e86f0bad3f3\"","Relaxation exercises":"\"cfd8200cc4ef759f985e1662076f9b4a\"","Replies and Notifications":"\"13e427e285bc9ecf4fb97d00f2d0c1b3\"","Revalidation":"\"44bff02e39d1d5d662f4818e75966a6c\"","SeaChart":"\"ab4db92dc09f3061b092eba2475c9dfc\"","Self-hate":"\"35a2f1fe5f62afdc479201cc6f0c1c82\"","ServerSettings":"\"36f21739fcec476e768c9896d025c7ee\"","Setup tiddler":"\"7a7aaaba64843524a3d8a2d6b709a977\"","SideBarOptions":"\"1e15bc5e7e44d4857b4728c726c67580\"","SideBarTabs":"\"61daf8aa2edd4b788fdce514001c211a\"","SiteIcon":"\"a24b0e9deb4cf4c1e1a4a9aee229aa28\"","SiteInfo":"\"89acf00b77c9171e6b15eae97d95eac3\"","SiteSubtitle":"\"2fcb83a1fc5bfbfa6ca2762ff7bc0cfd\"","SiteTitle":"\"af6a3c9bbc82ea5585be4854b187445b\"","Spaces":"\"fa9fb6d91666af591763ceb054ee3d81\"","States of Mind":"\"874c5c574b755b05cfeb468c3299a2b3\"","Steering in stormy waters":"\"6dd95a46826fe30ab1bb0018dccc0123\"","SteeringInStorm":"\"73679732e915f7d8ae6ebbd7a3e2d0fd\"","Stopwatch":"\"dc20e87fd2a523fb8675237eeed80994\"","Stuff I don't understand":"\"37a3f49338f926c6664f5f160be6562c\"","Stuff I think about TiddlySpace":"\"58a589925326f177a84671d3d0a89ebc\"","StyleSheet":"\"a64da7f899f2cc850601fb0c53e041a4\"","StyleSheetHeader":"\"2dcd2bf36f94881c52708fab727bcdca\"","StyleSheetSideBar":"\"c6518120d9fad2ec765bae371b011010\"","StyleSheetTiddlySpace":"\"be1ce61d3ad0ec205ba57b90ccf025a3\"","TabFollowing":"\"c9b4c388990166f8ae51b8b66bb7f288\"","Tennessee Williams - I don't ask for your pity":"\"f197b352bd846ab139bf075edfaa46d1\"","Test call":"\"2a333523b62e5732c846c033c657ac18\"","Testing following with @social":"\"a8d1ae2a2645d219b26318744fad4207\"","Theory of Mind and Emotion Regulation Difficulties in Adolescents With Borderline Traits - Carla Sharp et al 2011":"\"4d54b3cfb2d42adcdbbf3b99def3569b\"","Thinking together":"\"89ba8ff59c97c3da8e497d73038e9e10\"","TiddlerEditablePlugin":"\"9edf4e9716ea548e44b29610f1b7be4f\"","TiddlyManuals":"\"5f616b86bf90f91db513d410090caf08\"","TiddlySocial":"\"c8f43dacc5aae86f5af90484340ef992\"","TiddlySpace":"\"dc3917ba0b3eed97c6d8ef2c026c1d3d\"","TiddlySpace home page":"\"fe9af0e8609e409ed0e3b3d7b302dbfd\"","TiddlySpaceFollowingSuggestions":"\"c6b14c5dc3faa8008e5ff69f2ec9931d\"","TiddlySpaceFollowingWizard":"\"3424350dcb8760cd43a13aebf847dc51\"","TiddlySpaceIdentity":"\"924f172426f9924111edf81e4fbb0260\"","TiddlySpaceIntraSpaceInclusion":"\"7503cd2ca0f725741357d300243faf46\"","TiddlyWiki":"\"b196002207750ccb91aea6114da2b8be\"","Tips for TiddlyWikis":"\"fbc43362b3f7be7c3b9feaf0ca6260b1\"","ToolbarCommands":"\"885d23fe6f2cbc88c044bbf35b0c6fe6\"","Trojan":"\"8e0d4ca92a353bc0dffd558b710f1cd4\"","Trying out RSS feed in Tiddler - doesn't work!":"\"e50e464b3288b12c5e5dc4fd230cd2e0\"","Upload test":"\"0bdbe8902c19c48cd3bf07c2373b0e4f\"","ViewTemplate":"\"da5a94a50aa8a14b9e7eeb5002e4537a\"","WAVE":"\"c040c0c9c5b9795b075d0d5af01e9510\"","WAVE Crisis Drill":"\"3872a409da958264d393e933424755e5\"","WWFW":"\"83666f3a0c5959718a56abcd469aef42\"","Welcome to AMBIT!":"\"2146bfaf49910cab989ee28ee536bdcf\"","Wenger and Lave - Communities of Practice":"\"25ec47bfd04075314d40f4dc5b240ab9\"","What was it about TiddlyWiki that captured your interest?":"\"cc93abfb7e4f0a952199faadaff2aa1e\"","Wikis for note-taking":"\"12c25539001d587b741a031c547015bc\"","Wikis in therapy":"\"79dda6f6031f323c4149ad48b4107427\"","Writing":"\"d37eac97697d5bb6ae75671c82fe4c4e\"","_topics":"\"c3a525137287f043ccb647f52cf29d2d\"","activity":"\"74b18ae9aa948c6936d5c6af24d2be06\"","allowedsites.txt":"\"b1ebfd73c5b784897d8659d7c4998b7e\"","angular.js":"\"b1657857a451b2fc515b9d58af1d91b0\"","backups":"\"4c75a6badaeeb77fd843827f8c9d8fc8\"","backups.css":"\"ca2cd5e9ee7802ed99dbb9b156bd21c9\"","backups.js":"\"0729d1c5e2bb5568cf6c0037f8329ce6\"","backupsSetupFlag":"\"b3740e617f6e0d93eebbf65963d0a5b1\"","complex-cogwheels!!!":"\"8199669518ae443ccb7cfc2b7dad8e74\"","crankiness of social exchange in Tiddlyspace":"\"4b996f31f767c1b5097e0345db6fc5aa\"","edit":"\"509f6ff1472fb71a192ca2fd444b6b2b\"","edit.css":"\"7e0dc508d800ab033ad61136c3f9e8f0\"","edit.js":"\"66fc905325efe91a05d6e18037228db1\"","editSetupFlag":"\"19bdb35e2e8532e6804d44cdb253d477\"","editedit.js":"\"649bcb448ac87c3bef52719c0f702658\"","extraclusion":"\"a414c8f61c0c0915d55f1a0cc43a24c9\"","follow":"\"05ec5ecdc525e56dd4430ba3997e3dde\"","friendjs":"\"6d872f6429f202672a83428a1caecd2d\"","friends":"\"b3e42a1ff25d69d90298083972a01b27\"","included in ambit":"\"a8ca1e2d3fb5afd55b164700f08409f6\"","index":"\"c7521d99e890357922fc3b0099f275dc\"","list@groupie":"\"6c2b8963aeb1662fc0b4e1c2c13367b3\"","loading.gif":"\"c0cfc0942c78fffec3825992eedc3a9f\"","pip-iiSetupFlag":"\"e03f8b520dccb06c1df2257c83eefb8f\"","reply.svg":"\"8114c6cca1a598d2c944d1bbedd0f10e\"","social discoursive aspects":"\"e8de571aeca653a57e23a778770cdee2\"","socialSetupFlag":"\"abc9eb832ec19afa0caca4b46ea62005\"","stubSetupFlag":"\"67c74f940a133568f0ef49ee9e6c460c\"","that irritating american crime series called 'The Mentalist'":"\"e78c3188683980d865e75d31c174f53b\"","tivitySetupFlag":"\"3f5bea01bff0396677eb7e699b4882ca\"","tsScanCountPlugin":"\"3262c1a52134a7f498aaf26f2b3ead59\""}
https://8y1wh49hn1.execute-api.eu-west-2.amazonaws.com/prod/
4s50tg1b4toisc43c4q42gsceq
eu-west-2:2756d3cb-8b8b-47a9-8248-595a9d254d91
<html><div align="center"><iframe src="http://dickon.tiddlyspace.com/activity" frameborder="0" width="100%" height="600"></iframe></div></html>
For now we see through a glass, darkly; but then face to face:
now I know in part; but then shall I know even as also I am known.
!@@color(red):''Why wait?''@@
<<image [[HokusaiWave]] width:400 height:300>>
* Waves are temporary - they hit you, and they pass by.
* No wave EVER stays in the same place for ever.
* All you need to do is survive the wave that is your [[Craving]].
* It will pass on its way whatever you do, and you can learn from each one - whether or not it catches you out.
!@@color(red):''How to wait?''@@
!!1. Agree some rules for yourself
* //If you write your rules down somewhere, and show them to someone you trust, it is more likely you will keep them!//
* Below are some suggestions - pick ones you like, or add your own
* Don't set too many, or make them too hard! It is easy to "set yourself up to fail"
!!2. Distraction
__''(a) Make a rule for yourself:''__
That as soon as you NOTICE a [[Craving]] wave, you will STOP and DO something ELSE first (not what your [[Craving]] wave tells you to do!)
* We suggest a particularly good idea (known to grandmothers for centuries) is to have ''a cup of tea''/coffee/cold drink/glass of water.
<<image [[Cup of Tea]] width:480 height:480>>
* This is a good idea, because preparing or getting a drink //will occupy your attention// for a while.
* Making a cup of tea, etc, is something that is FAMILIAR, and EASY so just doing it might calm you down.
* Doing something like this may be ''enough for the wave to settle down on its own - remember that no wave lasts for long''
__''(b) Create a list of your best Distraction techniques:''__
Work through your list each time you get hit by a wave. Here are some examples (your own ones will probably be much better):
|bgcolor(darkgray):''Technique'' |bgcolor(darkgray):''Details'' |
|bgcolor(lightgray):''Listen to music'' |bgcolor(lightgray):Create a chillout playlist on your phone/mp3 player (choose songs that mellow you - they don't need to be the //coolest// tracks that you'd play in public; pick the ones that WORK for you! |
|bgcolor(lightgray):''Take a walk'' |bgcolor(lightgray):Have a set walk, or walk for a set number of minutes, and while you walk just concentrate on each step, feel how the path feels to your feet, notice the speed of your breathing, count how many birds you see - anything that works to fill your mind with something ELSE... |
|bgcolor(lightgray):''Phone a friend'' |bgcolor(lightgray):Sort out some family members, or friends, who you feel you can talk with about what you are struggling with. You can be gently [[Assertive]]: Ask them if they can be available to talk if they are free - tell them you might want to talk about nothing-in-particular, just to take your mind off things, so they don't need to be "specialists" - just to be available. Have their numbers in your phone. If they say unhelpful things to begin with, explain this gently and help them be more helpful to you next time. |
|bgcolor(lightgray):''Something to DO'' |bgcolor(lightgray):Carry a simple puzzle book around, or a notebook to doodle or write in. Some people find colouring books/patterns restful because they have to concentrate enough to take their mind off other things, but not so hard that they are put off. Knitting?! |
|bgcolor(lightgray):[[Relaxation exercises]] |bgcolor(lightgray):Things like a Progressive Muscle Relaxation are simple, and get more effective the more you practice them - just like an athlete trains to build up strength |
|bgcolor(lightgray):(Last but not least) [[2. Analyze]] |bgcolor(lightgray):This is step 2. in the WAVE approach, and ''just working your way through and answering the questions there will give you more TIME for the wave to die down''... ALL YOU ARE TRYING TO DO IS RIDE THE WAVE THROUGH TO ITS END, WITHOUT ACTING IN THE WAYS THAT HAVE BEEN UNHELPFUL TO YOU IN THE PAST - ''All Waves Pass By!'' |
!!3. Don't take it personally!
<<image [[HokusaiWave]] width:400 height:300>>
The wave ''is not you!'' - you are in the boat, getting hit by these things - your job is to survive, and learn the skills of wave riding. It's not your fault that the waves are happening. Right now you are in stormy waters, but one of the things you are learning is [[Mapping the territory]] so that, as well as getting more skilled at //riding// waves, over time you can avoid the biggest waves that right now are knocking you over.
!!4. Go easy on yourself!
* Sometimes waves are too strong, and you get caught out; you trip, you fall, you have a ''"lapse"''.
<<image [[Self-hate]] width:480 height:200>>
* Big deal. If you find yourself bashing yourself up about these slips, STOP IT! ''Adding'' to your problems by beating yourself up about being a failure is not helping you.
* Try repeating this to yourself a hundred times: ''Any surfer will tell you that learning to ride waves is IMPOSSIBLE without falling off - quite a lot.''
* You learn by getting back on and trying again - this ''learning from experience'' is where we get to in the last stage of the [[WAVE]] approach - [[4. Evaluate]]
!!5. Try just waiting a little longer this time!
<<image [[Stopwatch]] width:300 height:300>>
* If you are unable to resist the wave, despite trying all your techniques, then ''Try to Wait for 5 minutes longer than you did last time before you fell off''
* Each time you hit a wave, try to extend the amount of time you WAIT before falling off - by 5 minutes at a time. Sooner or later you will extend your waiting period for long enough that ''the wave will just die down, because that's what all waves do!''
!6. Keep a reminder or "talisman" on you
* This sounds a bit magical, or even weird and wonderful, but it isn't really - it's just a memory prompt and a confidence booster.
* Try keeping some small object that reminds you of your ''intentions'' and ''plans''.
** A keyring, a small charm, a bracelet, etc that particularly reminds you of this work, and the idea that the urge to binge, etc, is ''just a wave''.
** A small notebook, where you can write down key points such as the [[WAVE - Crisis Drill]], etc.
* If you are feeling awkward or anxious, sometimes just holding some object like this is enough to help remind you, and keep you afloat
<<image [[Lifepreserver]] width:300 height:220>>
!''@@color(blue):Why analyze?@@''
* Just stopping to analyze ''"what's going on here?"'' forces you to STOP LEAPING INTO ACTION, which is part of Step [[1. Wait]].
* Thinking about these questions gets your mind to use different parts of your brain to to think -
!''@@color(blue):Analyzing: questions to ask yourself:@@''
|bgcolor(darkgray):''Questions'' |bgcolor(darkgray):''Description'' |bgcolor(darkgray):''Your own answers:'' |
|bgcolor(lightgray):''What is this wave?'' |bgcolor(lightgray)://Name it:<br>An urge, a craving - for what?:<br>A powerful feeling? - which?//: |bgcolor(lightgray): |
|bgcolor(lightgray):''How big is this wave?'' |bgcolor(lightgray)://Give it a score 0 - 10:<br>Compare scores to past waves you've survived// |bgcolor(lightgray): |
|bgcolor(lightgray):''What else is going on?'' |bgcolor(lightgray)://What happened earlier today? <br>Apart from the craving, what __else__ might you be missing or wanting?<br> What [[States of Mind]] can you identify?//: |bgcolor(lightgray): |
|bgcolor(lightgray):''What are my options?'' |bgcolor(lightgray)://List out all the choices you have<br>Include ALL options, including ones you may ''not'' want to do:// |bgcolor(lightgray): |
|bgcolor(lightgray):''Pros and Cons of these options?'' |bgcolor(lightgray)://List the good things about each choice<br>List the bad things about each choice:// |bgcolor(lightgray): |
!@@color(blue):''Keep a note of the options''@@
* There should be a RANGE of options
** Some will seem foolish, or unhelpful
** Some will seem difficult. even impossible
** Some will seem better than others
* The important thing is that you see you have a range of choices
!!@@color(blue):''Never forget that an outboard mind is a useful thing''@@
* Two minds working on a problem are usually better than one
* This is especially so if one of the minds (//yours!//) is stressed because a wave is breaking over your head
* Keep alive the idea that you can phone a buddy, who might help you think because they aren't underwater right now, like you are. It is a bit like the guy on the surface who pumps air (//"Thinking"//) down to the diver who's in the highly pressured and stressful place:
<<image [[DeepSeaDiver]] width:300 height:480>>
in reply to [[20130609]]@cdent:
Thanks Chris - you are superfast as ever. I don't know how you do it!
I have long suspected that the right-thinking folk at TS have long ago seen better of spending too much time with IE in any of its manifestations, can't make sense of it myself.
<<image [[GoodChoiceBadChoice.jpg]] width:480 height:290>>
!Volunteers are CHOOSING what they want to do
* Mostly when you are hit by a wave and get knocked off balance, you don't feel like you have a CHOICE.
** Learning to ride the waves in your life is about understanding how to make the best possible choices in times of stress and chaos
** And accepting that this doesn't mean it will always go right
* __''Look at the Options you have come up with when you followed step [[2. Analyze]]:''__
** Some may look easier than others
** Some may look foolish
** Some may look better than others
* __''Ask yourself which option you would CHOOSE (volunteer) to do?''__
** This means you are taking charge of the boat, rather than feeling that the wave is making all the decisions
** You will be making the best choice you can in these difficult circumstances
** Having a plan that you chose is better than having no plan and being carried away or swamped by the wave
<<image [[HokusaiWave]] width:500 height:300>>
!Sometimes in life we make good choices, but bad things still happen
* People riding waves - in boats or in life - will often fall over, get wet; that is life.
* However, //we can increase our chances of getting to where we want to go to// if we learn how to make good choices.
* Draw up a list of __''where you want to get to:''__
** __''In your relationship with yourself''__ (//to feel happy, to feel OK with who you are, etc?//)
** __''In your relationships with other people''__ (//to get on, to enjoy each other, to be able to ask for help, and to assert myself when someone is in my space, etc?//)
** __''In what you do''__ (//to get to college, to get qualifications, a job, a place of my own, to earn money, to record my album, etc?//
!Keep a notebook or a web diary
* If you don't write down or record what you are learning, you might easily forget it
* It is hard enough to learn when you are relaxed and feeling in control, but much harder when you are feeling "at sea".
* You are aiming to slowly build a short list of key lessons that apply to ''YOU'' in ''YOUR LIFE''.
!Now that the wave has passed:
* Ask yourself //how did I do?//
** DON'T WORRY if you didn't do as well as you think you //"should have"//
** You can learn more from things that didn't go according to plan.
* Can you score how you did? Copy this table or adapt something like it for your use:
|bgcolor(darkgray): ''Date/Time'' |bgcolor(darkgray): ''Describe Wave:''<br>Circumstances, place, etc |bgcolor(darkgray): ''Strength:''<br>(0-10) |bgcolor(darkgray): ''What I did:''<br>(Description) |bgcolor(darkgray): ''Rate Success:''<br> (0-10) |bgcolor(darkgray): ''Learning:''<br>Any lessons? |
|bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |
|bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |
|bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |
|bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |bgcolor(lightgray): <br><br> |
* ''Dealing with [[Lapses]]'' - learning is best done from mistakes
[[Mapping the territory]]
[[Early Warning Signs]]
Adapting your Drill
Type the text for '@alexhough'
!Adolescent ~Mentalization-Based Integrative Treatment
See the [[AMBIT manual|http://imp.peermore.com/imp/recipes/imp/tiddlers.wiki]], as it currently is at TiddlyWeb, or versions of this being developed by different teams at [[TiddlyManuals|http://www.tiddlymanuals.com]]. In due course the TiddlySpace @ambit will host the TiddlyManuals.
Type the text for '@ambit-admin'
I am following the '@ambit-casus' version of the @ambit manual.
I am following the Kids Company version of the @ambit manual at: '@ambit-kidsco'
The ambit manual for the MAC team is at: '@ambit-mac'
Type the text for '@ambit-stories'
Type the text for '@ambit-tasks'
Type the text for '@ambit-theme'
Type the text for '@ambit-workgroup'
Type the text for '@ambit2'
Type the text for 'New Tiddler'
Type the text for '@blog'
[[Chris Dent|http://cdent.tiddlyspace.com/]]
@cdent for technical stuff
@chris-dent for social networking, [[Thinking together]] stuff
!@cdent-mt
Chris Dent is one of the key architects of tiddlyweb and a fascinating man - I never realised he was a climber, too, till just now!
@chris-dent for social networking stuff, and [[Thinking together]]
@cdent for more technical stuff
Errr, not sure if it makes sense to have this in my own tiddlyspace... is this an easy way to find stuff that other people following me (whom I am following) might be tagging in their spaces?
The notion of 'following' is one thing, but I think there may be a different relationship to define; when two people are following each other... this is more than two people going round and round in circles (Winnie the Pooh and the Heffalump), this is two people [[Thinking together]]...
Type the text for '@dickontests'
Type the text for '@docs'
@flicktiddler allows you to flick tiddlers to other spaces.
To use include this space into the space you want to flick into.
Then try flicking this tiddler by clicking on the more menu and clicking flick tiddler (only works on public tiddlers).
It will open up a new window and cause the flicking.
Type the text for '@ganalytics'
Type the text for '@glossary'
!@interview
All about Tiddlywiki - how people found it, how they use it, what they want from it...
Type the text for 'New Tiddler'
Type the text for '@jnthnlstr'
Type the text for '@jrbl'
Type the text for '@maans'
Type the text for '@matt'
Type the text for '@mattlucht'
Type the text for '@themes'
Type the text for '@tiddlyspace'
Type the text for 'New Tiddler'
Type the text for '@tscount'
<<tag AMBIT>>
!Adolescent ~Mentalizatiion-Based Integrative Therapy
A novel approach to working with complex hard to reach youth, that is used in just under 20 settings around the UK.
With Peter Fuggle I am the lead author of this approach, and other authors are Peter Fonagy, Mary Target, Eia Asen, Neil Dawson and Rabbia Malik.
!Links
@ambit = the Core Content of the AMBIT manual, that local teams inherit in their local versions, and then modify, to use Adolescent Mentalization Based Integrative Treatment to support their local development of excellent locally-attuned practice.
@tiddlymanuals for all public links to AMBIT stuff
!'EDITORIAL sites
The sites below are ''@@color(red):only for the use of the AFC's AMBIT team authors/editors@@'' - these are the different "spaces" that collectively make up (they are all "included" in) the @ambit site. Note that these sites are not "themed" and have the basic TiddlySpace look and feel.
@ambit-workgroup (admin - mostly private)
@ambit-content - for authoring AMBIT content
@ambit-help - for authoring material on how to USE the tiddlymanual (technical manual) - content should be specific to the ambit THEME (how to navigate, what buttons do what, etc) but not to AMBIT as a method of working //per se// (which should go in ambit-content).
@ambit-plugins - for authoring or gathering functional plugins that make the whole site run properly
@ambit-howto - for authoring material on how to APPLY the tiddlymanual in therapeutic practice (not for AMBIT-specific content, but rather content about how teams might share content, etc.)
@ambit-aim - for authoring material related to the AIM assessment, and its interactive properties with the AMBIT manual...
@ambit-theme - all the elements of the styling that give the AMBIT site its distinctive feel and behaviour (with thanks to Jonathan Lister and Johua Bradley at [[withjandj|http://withjandj.com/#/]], and our [[Sponsors]] for this.
!Where?
Belfast International Airport - 8th Feb 2013 - with Peter
!What's an outcomes Framework?
A constrained set of measures, against a defined set of constructs (which collectively define what we think we are doing), to measure change in Knowledge, Behaviours, Systemic factors, and Client Outcomes
!Subtopics
|<<tag [[AMBIT Outcomes Framework - development thoughts]]>>|
!Schedule
|Timepoint:|Timing|What are we Measuring?|
|1.|t - 1m|[[Baseline Measure of Organisation]]|
|2.|t - 0|[[Baseline Service Systems]]|
|2.|t - 0|[[Baseline Knowledge]]|
|2.|t - 0|[[Baseline Practice]]|
|2.|t - 0|[[Baseline Client Outcomes]]|
|3.|t + 1m|[[Post Training Knowledge]]|
|4.|t + 3m|[[Post Training Practice Change]]|
|5.|t + 6-9m|[[Post Training Systems Change]]|
|5.|t + 6-9m|[[Post Training Outcomes Change]]|
|5.|t + 6-9m|[[Post Training Learning Organisation]]|
|6.|t + 12-18m|[[Long range sustainability]]|
!!@@[[DEMO of AMBIT core content|http://imp.peermore.com/imp/recipes/imp/tiddlers.wiki]]@@
@@{{{http://imp.peermore.com/imp/recipes/imp/tiddlers.wiki}}}@@
This is the core editorial content of the AMBIT approach to outreach work with complex, hard to reach youth. The software that this is written in allows customised variants to be set up, that are 'attuned' to local circumstances, settings, and service ecologies.
!Local versions in use:
[[TiddlyManuals|What is a TiddlyManual?]] offer a very different approach to traditional treatment manualization, moving from a 'one-size-fits-all' approach to the notion of a common core of basic stance and evidence-based interventions, with teams developing the disciplines to 'self-author' the application of this in a local ecology. They allow (encourage, even) local teams to adapt their version manual, adding locally-relevant details, protocols, and signposts to core content that help address specific problems that are recognised in that specific neighbourhood. The technology used for the AMBIT manual provides a shared common core in the manual, that all teams using this approach access, to which local 'attunements' can quickly and easily be added (these are marked as @@color(red):Customised@@ - you can think of them as 'notes-in-the-margin' that are instantly integrated into the whole document.) As this is new technology, further developments are on stream - it will shortly be possible to 'toggle' between local adaptations/variations and the original core content that these might to some extent overwrite.
Teams beginning this process have their versions of their treatment manuals accessible here:
!!@@[[Cambridgeshire Adolescent Substance Use Service - CASUS|http://imp.peermore.com/imp/recipes/yous/tiddlers.wiki]]@@
{{{http://imp.peermore.com/imp/recipes/yous/tiddlers.wiki}}}
This is an NHS team based in the [[Cambridgeshire and Peterborough Foundation Trust|http://www.cpft.nhs.uk/]], covering a large rural area, with several urban centres, that works with young people with complex difficulties including problematic use of substances.
!!@@[[Kids Company (Red Yard) - South London|http://imp.peermore.com/imp/recipes/kidsco/tiddlers.wiki]]@@
{{{http://imp.peermore.com/imp/recipes/kidsco/tiddlers.wiki}}}
[[Kids Company|http://www.kidsco.org.uk/]] is a nationally recognised charity working with hard-to-reach youth in South London and elsewhere.
!!@@[[Islington Adolescent Outreach Team - IAOT|http://imp.peermore.com/imp/recipes/iaot/tiddlers.wiki]]@@
{{{http://imp.peermore.com/imp/recipes/iaot/tiddlers.wiki}}}
This is an outreach team working as part of [[Islington NHS|http://www.islington.nhs.uk/adolescent-outreach-team.htm]] with young people with severe mental health problems.
!!@@[[Plymouth NHS CAMHS Outreach team|http://imp.peermore.com/imp/recipes/plymouth/tiddlers.wiki]]@@
{{{http://imp.peermore.com/imp/recipes/plymouth/tiddlers.wiki}}}
A new NHS CAMHS Outreach service based in [[Plymouth|http://www.plymouthpct.nhs.uk/services/communitycamhs/Pages/default.aspx]], that will be starting to adapt its version of the AMBIT manual from February 2010.
!!!@@[[Authors CORE content|http://imp.peermore.com/imp/recipes/editorial/tiddlers.wiki]]@@
{{{http://imp.peermore.com/imp/recipes/editorial/tiddlers.wiki}}}
This is for the core authors, based at the [[Anna Freud Centre|http://www.annafreud.org]]. note that for technical reasons ALL the [[Tiddlers]] in this version are marked as ''@@color(red):"Customised"@@''
A super duper minimalistic theme for tiddlyspace. The spawn of @pip
All stuff about TiddlySpace (as oppposed to stuff I think [[About TiddlyWiki]]) goes under here...
!Boring bit
TiddlySpace is the online environment for hosting TiddlyWiki's - an ecosystem where any individual tiddlers I write are stored in "bags" (one marked "private" the other marked "public" for every "space" I create.) Multiple different tiddlywikis can be constructed using a simple (I use this word as if I have the faintest clue about the actual clever //programming// that makes this glorious and unique thingummy //work//... whcih I don't...) "__recipe__" that picks out the tiddlers from the requisite bags and bungs them all together to make a tiddlywiki.
The bags into which a Recipe "dips" can be owned by different people, so the wiki that "my" recipe calls up is basically another bag, containing a combination of:
(a) stuff I have authored (living in one of my other bags) and
(b) stuff that other people have authored (living in their "public" bag - otherwise I won't see it) - this is the priniciple of "__inclusion__".
!Members and Inclusion and Collaborating
Spaces have members, and members have equal rights to make or unmake members in that space (making someone a mmeber of your Space is a bit like giving someone the keys to your office; they MIGHT change the locks when you are out, so be sure only to make people you trust into members of any space you want to collaborate over... this is what the TS community refer to as the priniciple of "__small trusted groups__".
* If you write a load of excellent stuff in your Space (1), and you want to collaborate on it, but ou also want to hang on to your original stuff as well, then just create another Space (2).
* Now INCLUDE your excellent first space (1) in Space (2).
* Invite new members into Space (2)
* These new members can access all the stuff in Space (1) because Space (2) is like an amoeba swallowing its prey...
* BUT unlike the amoeba, Space (2) can't actually //digest// (or delete) the tiddlers from Space (1), but can only overwrite them, or add other tiddlers to live alongside them and link to them, etc...
* When they can edit the original Sapce (1) tiddlers, their new //versions// are held in Space (2), the originals that live in Space (1) are untouched.
* Deleting their new versions in Space (2) will just reveal the original version from Space (1), which pops back in its place.
* You can also review all the previous "versions" of a tiddler to see its history of revisions...
* Hey Presto
All stuff about TiddlyWiki (as opposed to [[TiddlySpace|About TiddlySpace]]) goes tagged under this heading
My CV is [[here|http://www.linkedin.com/in/dickonbevington]]
I work in Cambridge for the NHS and as a Fellow at the [[CLARHC|CLARHC-research project]] (Collaboration for Leadership and Applied Research in Health and Social Care) and at the [[Anna Freud Centre|http://annafreud.org]].
!!(a) [[Notes on literature review of adolescent Substance Use Disorder|http://sud-treatments-literature.tiddlyspace.com]]
A set of wikified notes on the scientific literature on Substance Use Disorder in children and adolescents - made to help me plan the chapter I have been writing for the 2nd Edition of "What Works for Whom: a critical review of treatments for children and adolescents" along with Peter Fonagy, David Cottrell, Jeanette Phillips, and Danya Glaser.
Includes planning notes for a chapter for the ''Royal College of General Practitioners'' on Child and Adolescent substance use (with Dr Daphne Rumball)
!!(b) [[Notes on literature review of Self-Injurious Behaviour|http://sib-treatments-literature.tiddlyspace.com]]
A set of wikified notes on the scientific literature on ~Self-Injurious Behaviour in children and adolescents - made to help me plan the chapter I have been writing for the 2nd Edition of "What Works for Whom: a critical review of treatments for children and adolescents" along with Peter Fonagy, David Cottrell, Jeanette Phillips, and Danya Glaser.
!!(c) [[Notes on literature of Psychosis|http://psychosis-literature.tiddlyspace.com/tiddlers.wiki]]
A set of notes (much less thatn the above two) where I gather stuff of interest and usefulness about psychosis in the literature.
!!(d) [[Notes on e-Therapies|http://e-therapies.tiddlyspace.com]]
Notes around some work I am doing with an expert advisory group on the e-therapies (note: these are MY notes, and not the opinon of the exert advisory group)
!!(e) [[Notes on Manuals, Outcomes Measurement and Learning|http://outcomes-learning.tiddlyspace.com]]
A new space for storing notes on the field of outcomes measurement, and team learning - which is a growing area of interest for @ambit.
[[Replies and Notifications]]
<<activity>>
/***
|''Name''|ActivityStreamPlugin|
|''Version''|0.5.4|
|''Description''|Provides a following macro|
|''Author''|Jon Robson|
|''Requires''|TiddlySpaceFollowingPlugin|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
|''Source''|https://github.com/jdlrobson/TiddlyWiki/raw/master/plugins/TiddlySpaceInstaller/ActivityStreamPlugin.js|
!Usage
{{{<<activity>>}}}
!!Supressing activity
You can supress notifications by id:
"plugin", "shadow", "standard", "follow", "followYou", "siteInfo", "siteIcon", "ownSiteIcon", "notify", "reply"
e.g. {{{ <<activity supress:siteIcon>> }}} will hide siteIcon activity from you.
!!Supressing people
{{{<<activity ignore:person}}} will ignore all activity where person is the subject of the activity. eg. person followed other-person will not appear in the feed.
!!Controlling displayed dates.
{{{<<activity timestampFormat:"<0hh o' clock>" headingFormat:"0DD/0MM" >>}}} will display date headings as date/month eg.
3rd of January would be displayed as 03/01. This particular timestamp example gives you the hour of the activity.
!!Even more content
{{{<<activity limit:no>>}}} will show you all possible activity in the last X days where X is set at a macro level (advanced developers should see config.macros.activity.RECENTNESS).
!StyleSheet
.activityStream .externalImage, .activityStream .image {
display: inline;
}
.feedItem .siteIcon {
display: inline;
}
.activityStream .error {
background-color: red;
color: white;
font-weight: bold;
}
.activityStream .feedItem {
list-style: none;
}
.activityStream .notification {
background-color: yellow;
color: black;
}
.activityStream .activityGroupTitle {
font-weight: bold;
margin-top: 8px;
}
.activityStream .feedItem {
margin-left: 8px;
}
!Code
***/
//{{{
(function($) {
var name = "StyleSheetActivityStream";
config.shadowTiddlers[name] = store.getTiddlerText(tiddler.title +
"##StyleSheet");
store.addNotification(name, refreshStyles);
var followMacro = config.macros.followTiddlers;
var tweb = config.extensions.tiddlyweb;
var tiddlyspace = config.extensions.tiddlyspace;
var scanMacro = config.macros.tsScan;
var modifierSpaceLink = "<<view modifier spaceLink>>";
var spaceTiddlyLink = "<<view server.bag spaceLink server.title>>";
var bagSpaceLink = "<<view server.bag spaceLink>>";
var bagSiteIcon = "<<view server.bag SiteIcon width:24 height:24 label:no preserveAspectRatio:yes>>";
var modifierSiteIcon = "<<view modifier SiteIcon width:24 height:24 label:no preserveAspectRatio:yes>>";
var timestamp = "[<<view modified date '0hh:0mm'>>]";
var replyLink = "<<view server.title replyLink>>";
config.shadowTiddlers.ActivityStreamTemplates = [
"!notify\n%3 {{notification{%0 %1 has modified %2 in %0 %1 and flagged it for your attention!}}} %8\n",
"!reply\n%3 {{notification{%0 %1 replied with %2 to your %4 %5 post.}}} %8\n",
"!userSiteIcon\n%3 %6 %7 has a new ~SiteIcon.\n",
"!spaceSiteIcon\n%3 %6 %7 updated the SiteIcon for the %0 %1 space.\n",
"!image\n%3 %6 %7 drew the image %2 in the %1 space.\n",
"!plugin\n%3 %6 %7 modified a plugin called %2 in the %0 %1 space.\n",
"!shadow\n%3 %6 %7 modified a shadow tiddler %2 in the %0 %1 space.\n",
"!geo\n%3 %6 %7 modified a geo tiddler called %2 in the %0 %1 space <<view title maplink 'view on map'>>. %8\n",
"!followYou\n%3 %0 %1 is now following you.\n",
"!follow\n%3 %0 %1 is now following %4 %5 <<view server.title link follow>>\n",
"!siteInfo\n%3 %6 %7 <<view server.bag spaceLink server.title label:described>> the %0 %1 space.\n",
"!video\n%3 %6 %7 modified a video entitled %2 in the %0 %1 space. %8\n",
"!standard\n%3 %6 %7 modified %2 in the %0 %1 space. %8\n"
].join("").format(bagSiteIcon, bagSpaceLink, spaceTiddlyLink, timestamp,
"<<view server.title SiteIcon width:24 height:24 label:no preserveAspectRatio:yes>>", "<<view server.title spaceLink>>",
modifierSiteIcon, modifierSpaceLink, replyLink);
story.refreshTiddler("ActivityStreamTemplates", null, true);
config.annotations.ActivityStreamTemplates = "This is a special tiddler used by the ActivityStreamPlugin. It is used for templating notifications. Templates at the top have preference over templates at the bottom.";
var macro = config.macros.activity = {
default_limit: 50,
templates: [],
init: function() {
var templates = [];
var regex = new RegExp(/^!(.*)\n/gm);
var text = store.getTiddlerText("ActivityStreamTemplates");
var match = regex.exec(text);
while(match) {
templates.push(match[1]);
match = regex.exec(text);
}
macro.templates = templates;
},
// order matters - earlier templates override older ones
RECENTNESS: 2, // in days
TIMESTAMP_FORMAT: "<0hh:0mm>",
info: {},
locale: {
pleaseWait: "please wait while we load your stream...",
errorLoading: "The activity stream failed to load. Please make sure you have an internet connection and try again.",
userHeading: "Below is the activity stream for spaces that this space follows with the follow tag. (%0/%1 spaces have been loaded)",
emptyStream: "Activity stream currently empty. (%0/%1 loaded)"
},
getTimeStamp: function() {
var today = new Date();
macro._lastRun = today.getTime();
var previous = new Date(today.setDate(today.getDate() - macro.RECENTNESS));
return previous.convertToYYYYMMDDHHMM();
},
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
var container = $("<div />").text(macro.locale.pleaseWait).appendTo(place).
attr("refresh", "macro").attr("macroName", macroName).attr("paramString", paramString);
var space = tiddlyspace.currentSpace.name;
var options = macro.getOptions(paramString);
$(container).attr("activity-limit", options.limit);
macro._session = Math.random();
var activityType;
var sourceActivity = function(user) {
macro.CURRENT_USER = user.name;
macro.USER_AT_TAG = "@%0".format(user.name);
followMacro.getFollowers(function(users) {
macro.getActivity(container, users, activityType, options);
}, macro.CURRENT_USER);
container.attr("activity-type", activityType);
macro._renderStream(container, activityType, options);
};
if(options.user) {
sourceActivity({name: options.user});
} else {
sourceActivity({ name: tiddlyspace.currentSpace.name });
}
},
getOptions: function(paramString) {
var options = {};
var args = paramString.parseParams("name")[0];
var toMap = ["timestampFormat", "headingFormat", "limit", "user"];
var i;
for(i = 0; i < toMap.length; i++) {
var map = toMap[i];
options[map] = args[map] ? args[map][0] : false;
}
var supress = args.supress || [];
var templates = [];
var show = args.show ? args.show : macro.templates;
for(i = 0; i < show.length; i++) {
var template = show[i];
if(supress.indexOf(template) === -1) {
templates.push(template);
}
}
options.ignore = args.ignore || [];
options.templates = templates;
return options;
},
_getActivityQuery: function(user, timestamp) {
timestamp = timestamp || macro.getTimeStamp();
if(user) {
return "/bags/%0_public/tiddlers?select=modified:>%1".format(user, timestamp);
} else {
return false;
}
},
refresh: function(container) {
var type = $(container).attr("activity-type");
var limit = $(container).attr("activity-limit");
var options = macro.getOptions($(container).attr("paramString"));
options.limit = parseInt(limit, 10);
macro.renderStream(container, type, options);
},
getActivity: function(place, users, type, options) {
var i;
var timestamp = macro.activityTimestamp;
var firstRun = timestamp ? false : true;
macro.info.loaded = firstRun ? 0 : macro.info.loaded;
var afterAjax = function(tiddlers) {
if(firstRun) {
macro.info.loaded += 1;
}
macro.updateStream(tiddlers, type, options);
macro.renderStream(place, type, options);
};
var success = function(tiddlers) {
afterAjax(tiddlers);
};
var error = function() {
afterAjax([]);
};
if(macro._lastRun > new Date().getTime() - 300000) { // leave 5 minutes between calls
afterAjax([]);
return;
}
macro.info.queries = users.length;
for(i = 0; i < users.length; i++) {
var user = users[i];
ajaxReq({
url: macro._getActivityQuery(user, timestamp),
dataType: "json", success: success, error: error
});
}
macro.activityTimestamp = new Date().convertToYYYYMMDDHHMM();
},
reportError: function(place) {
var error = $("<div />").addClass("error").text(locale.errorLoading);
$(place).empty().append(error);
},
createFeedEntry: function(container, tiddler, options) {
var item = $("<li />").addClass("feedItem");
var content = $("<div />").appendTo(item);
var wikifyPlace = $("<span />").appendTo(content)[0];
var author = tiddler.modifier;
if(author && !options.ignore.contains(author)) {
$(container).append(item);
config.macros.view.views.activityItem(null, wikifyPlace, null, null, null, tiddler);
return item;
}
return false;
},
renderStream: function(place, type, options) {
window.clearTimeout(macro._renderTimeout);
macro._renderTimeout = window.setTimeout(function() {
macro._renderStream(place, type, options);
}, 100);
},
_renderStream: function(place, type, options) {
$(place).empty();
var limit = options.limit;
var container = $("<ul />").addClass("activityStream").appendTo(place);
var textHeading = macro.locale.userHeading.format(macro.info.loaded, macro.info.queries);
$("<li />").addClass("listTitle").text(textHeading).appendTo(container);
var tiddlers = store.sortTiddlers(store.filterTiddlers("[server.activity[true]]"), "-modified"); // TODO: sort headings instead if possible (conflicts with limit)
var headings = [];
var groups = {};
var processed = 0, i, j;
var atEndOfActivityFeed = true;
for(i = 0; i < tiddlers.length; i++) {
var tiddler = tiddlers[i];
if(options.templates.contains(tiddler.fields["server.activity.type"])) {
if(!limit || processed < limit) {
var modified = tiddler.modified;
if(modified) {
// format date.
var modifiedString = modified.formatString(options.headingFormat || config.macros.timeline.dateFormat);
if(headings.contains(modifiedString)) {
groups[modifiedString].push(tiddler);
} else {
headings.push(modifiedString);
groups[modifiedString] = [ tiddler ];
}
}
processed += 1;
} else {
atEndOfActivityFeed = false;
}
}
}
var somethingRendered;
for(i = 0; i < headings.length; i++) {
var heading = headings[i];
var _tiddlers = store.sortTiddlers(groups[heading], "-modified");
var headingEl;
if(_tiddlers.length > 0) {
headingEl = $("<li />").addClass("listTitle activityGroupTitle").text(heading).appendTo(container);
}
var rendered = [];
for(j = 0; j < _tiddlers.length; j++) {
var item = macro.createFeedEntry(container, _tiddlers[j], options);
if(item) {
rendered.push(item);
}
}
if(rendered.length === 0) {
headingEl.remove();
} else {
somethingRendered = true;
}
}
if(!somethingRendered) {
var msg;
if(macro.gotActivity) { // it has been run before
msg = macro.locale.emptyStream.format(macro.info.loaded, macro.info.queries);
} else {
msg = macro.locale.pleaseWait;
}
$(container).text(msg);
}
if(!atEndOfActivityFeed) { // show more button
$("<input />").attr("type", "button").val("more").click(function(ev) {
var currentLimit = $(place).attr("activity-limit");
var newLimit = parseInt(currentLimit, 10) + 50;
macro.default_limit = newLimit;
$(place).attr("activity-limit", newLimit);
macro.refresh(place);
}).appendTo(place);
}
this.gotActivity = true;
},
updateStream: function(jstiddlers, type, options) {
// assume already sorted.
var tiddlers = scanMacro._tiddlerfy(jstiddlers, options);
var _dirty = store.isDirty();
$.each(tiddlers, function(i, tid) {
var info = config.macros.view.activity.getActivityInfo(tid, options);
tid.fields["server.activity.type"] = info.type;
tid.fields["server.activity"] = "true";
if(!tid.tags.contains("excludeLists")) {
tid.title = tiddlyspace.getLocalTitle(tid.title, tid.fields["server.workspace"]);
tid.tags = tid.tags.concat(["excludeLists", "excludeMissing", "excludeSearch"]);
tid.fields.doNotSave = "true";
store.addTiddler(tid); // save caused unsaved changes alert and slowdown
}
});
store.setDirty(_dirty);
}
};
config.macros.view.views.activityItem = function(value, place, params, wikifier,
paramString, tiddler) {
var info = config.macros.view.activity.getActivityInfo(tiddler, {});
wikify(info.template, place, null, tiddler);
};
var helper = config.macros.view.activity = {
_isNotification: function(tiddler) {
return tiddler.tags.contains(macro.USER_AT_TAG) || tiddler.tags.contains("@all");
},
_repliesOn: function() {
return tiddlyspace.currentSpace.name === macro.CURRENT_USER;
},
types: {
video: function(tiddler) {
return tiddler.tags.contains("video");
},
geo: function(tiddler) {
return tiddler.fields["geo.lat"] && tiddler.fields["geo.long"];
},
siteInfo: function(tiddler) {
var title = tiddler.fields["server.title"];
return title === "SiteInfo";
},
userSiteIcon: function(tiddler) {
var modifierBag = "%0_public".format(tiddler.modifier);
var title = tiddler.fields["server.title"];
return title === "SiteIcon" && modifierBag === tiddler.fields["server.bag"];
},
spaceSiteIcon: function(tiddler) {
var title = tiddler.fields["server.title"];
return title === "SiteIcon"; // note userSiteIcon above does the bag check
},
shadow: function(tiddler) {
var title = tiddler.fields["server.title"];
return title in config.shadowTiddlers;
},
plugin: function(tiddler) {
return tiddler.tags.contains("systemConfig");
},
followYou: function(tiddler) {
var title = tiddler.fields["server.title"];
title = title.indexOf("@") === 0 ? title.substr(1) : title;
return tiddler.tags.contains("follow") && title === macro.USER_AT_TAG;
},
follow: function(tiddler) {
return tiddler.tags.contains("follow");
},
reply: function(tiddler) {
var title = tiddler.fields["server.title"];
var myTiddler = store.getTiddler(tiddler.title);
var myTiddlerIsOlder = myTiddler && myTiddler.modified < tiddler.modified;
return store.tiddlerExists(title) && myTiddlerIsOlder && helper._repliesOn(tiddler);
},
notify: function(tiddler) {
var title = tiddler.fields["server.title"];
var myTiddler = store.getTiddler(title);
var myTiddlerIsNewer = myTiddler && myTiddler.modified > tiddler.modified;
return helper._isNotification(tiddler) && helper._repliesOn(tiddler) && !myTiddlerIsNewer;
},
standard: function(tiddler) {
return true;
},
image: function(tiddler) {
return config.macros.image.isImageTiddler(tiddler);
}
},
// each type should point to a slice in ActivityStreamTemplates tiddler
getActivityInfo: function(tiddler, options) {
var repliesOn = tiddlyspace.currentSpace.name === macro.CURRENT_USER;
var activityType, i;
if(tiddler) {
for(i = 0; i < macro.templates.length; i++) {
var type = macro.templates[i];
if(!activityType && helper.types[type]) {
if(helper.types[type](tiddler)) {
activityType = type;
}
}
}
}
template = store.getTiddlerText("ActivityStreamTemplates##" + activityType) || locale.standardTemplate;
return activityType ? { template: template, type: activityType } : false;
}
};
config.macros.view.views.link = function(value, place, params, wikifier,
paramString, tiddler) {
var el = createTiddlyLink(place,value,true);
if(params[2]) {
$(el).text(params[2]);
}
};
config.macros.view.views.maplink = function(value, place, params, wikifier,
paramString, tiddler) {
var lat = tiddler.fields["geo.lat"];
var lng = tiddler.fields["geo.long"];
var label = params[2] || value;
if(lat && lng) {
$("<a />").attr("href", "http://maps.google.com/maps?saddr=%0,%1".format(lat, lng)).text(label).appendTo(place);
}
};
var _displayS = tiddlyspace.displayServerTiddler;
tiddlyspace.displayServerTiddler = function(src, title, workspace, callback) {
var localTitle = tiddlyspace.getLocalTitle(title, workspace);
var localTiddler = store.getTiddler(localTitle);
var _callback = function(src, tiddler) {
if(callback) {
callback(src, tiddler);
}
if(localTiddler) {
tiddler.fields["server.activity"] = "true";
tiddler.fields["server.activity.type"] = localTiddler.fields["server.activity.type"];
}
};
return _displayS.apply(this, [ src, title, workspace, _callback ]);
};
}(jQuery));
//}}}
>//There is no absolute psychoanalytic technique for use with children, but rather a set of analytic principles which have to be adapted to specific cases.//
In: Sandler et al, 1980
The [[Anna Freud Centre|http://annafreud.org]] is a charity dedicated to innovation, evaluation and dissemination of best practice for the mental health of children, young people and their families.
It runs many trainings nationally and internationally, and acts as a focus for the development of the Mentalization based therapies, including [[AMBIT]] and [[MBT-F]].
I work 2 days a week there, as child psychiatrist for the service, and as a treatment developer and trainer.
* Large cohort study
** Shows about 3% risk of BPD in Non-FH (of any psychiatric disorder) and Non-maltreated children.
** Slight increased if there is a FH
** Very large increase if there is a FH + Maltreatment
Protective factor is Mz in child
Thanks to Paul, Matt, Colm, Ben, and Jeremy at Osmosoft, as well as Jon Lister, for a very busy afternoon last week, transferring the AMBIT tiddlyManual into tiddlyspace.
I can see where this is going now, and it is really exciting.
Dickon
All bloggy stuff is tagged under this heading and you can select stuff here:
| <<tag Blog>> |
The main blog is my [[Blog about TiddlyManuals]].
!Winners!
Delighted to let people know that the AMBIT collaboration (the pre-eminent example of tiddlymanuals) was voted as wonner of the Guardian and Virgin Business Media "INNOVATION NATION" award in the category of collaboration. See their website [[Here|http://www.guardian.co.uk/innovation-nation-awards/innovation-nation-awards-winners#collab]]
!Blog
I keep a [[Blogspot blog|http://dickonb.blogspot.com/]], all about Tiddlymanuals (included at the bottom of this page) which is an excellent place for insomniacs. The mogadon of www. It is one of the lesser-visited wildernesses of the internet, though without any of the grandeur of, say, Rannoch moor or the Tibetan plateau. And still less the poetry. I really don't advise looking at it unless you burn to hear more about my wiki-mania, and the struggles to develop an opensource product that other people might find useful, and which might influence practice for the better. If that is not your thing, then ignore... but the POINT of all these wikis is to be useful, and to be useful the machinery has to work so that it doesn't impose itself upon the user... the interest is, then, in thinking through of the architecture of the task and the needs of users...
@TiddlyManuals also has a news for users section, and I suspect that will be more useful - even if "interesting" may be stretching it...
The blog below charts the TiddlyManuals project to develop tiddlywiki as a tool to help manualize complex therapies... for some reason it is not in Tiddlyspace, but you can see it here:
<html><div align="center"><iframe src="http://dickonb.blogspot.com/" frameborder="0" width="100%" height="100%"></iframe></div></html>
Early scoping for a self help book based on Mentalization based approaches for borderline PD and those borderline elements that all of us experience in the edgier parts of life.
With Carla Sharp
This is by [[Dance Offensive]] - a great organisation doing great work in Cambridgeshire and well beyond. Do visit their website and consider donating.
<html><div align="center"><iframe src="https://showbox-tr.dropbox.com/get_transcoded/t/y99jdsg0ckykloi/Jody%20final.wmv?secure_hash=&token_hash=AAHGU5HAD1uBbJwIfAIM8Oz57DjwlrBzh9jTF-0r067yIQ" frameborder="0" width="100%" height="600"></iframe></div></html>
Cambridgeshire Child and Adolescent Substance Use Service
CASUS is an AMBIT service, commissioned to provide Substance Use services for youth in Cambridgeshire, with a website [[here|http://www.casus.cpft.NHS.uk]].
@ambit-casus is where you find our local version of the AMBIT manual
[[CASUS|http://www.casus.cpft.nhs.uk]] is my main NHS post. CASUS has been one of the main teams where the [[AMBIT]] method of working has been developed, working with multiply disadvantaged, complex, hard to reach, and often extraordinarily inspiring young people. They have their own [[locally-attuned version of the AMBIT manual|http://ambit-casus.tiddlyspace.com]] and a [[public-facing website|http://www.casus.cpft.nhs.uk]] which has loads of info and useful links on it, including links to our AMBIT manual.
See http://clarhc-research.tiddlyspace.com/tiddlers.wiki
See [[SWWFF in Cambridgeshire|http://cambs-swwff.tiddlyspace.com]] for the project's public-facing site.
----
See http://clarhc-research.tiddlyspace.com/tiddlers.wiki for the administrative coordinating site. This is a planning space (mostly private) for coordinating my research through the CLARHC (Collaboration for Leadership and Applied Research in Health and Social Care, based in Cambridge)...
I am doing a brief study of the practice, education, attitudes, and experiences of workers in teams that we are training in @ambit so as to support the development of their local expertise - trying to get a good number of ~PRE- and ~POST-Training questionnaires done, that I can supplement with a smaller number of semi-structured qualitative interviews (for thematic analysis) to look at what factors if any might predict the way a worker engages with help (particularly in the form of referring to a treatment manual), and in what other ways AMBIT training may affect behaviours by and between team members.
The second part of the CLARHC project is a much larger study, that will last three years - to look at the effect of a major reorganisation of the Cambridgeshire Social Services; developing and implementing the "Reclaiming Social Work" model of arranging frontline workers across the whole county into small teams or "units" - each one with an embedded clinician. The project will evaluate the impact of this major reorganisation in terms of the impacts upon social workers, team working practices, and upon their outcomes (children taken into care, number of referrals accepted, outcomes of referrals, etc). In addition, there will be a trial of @ambit in 6 randomly-assigned units across the county - comparing these units with the other non-AMBIT teams, and looking for any evidence of "value added" flowing from the additional AMBIT training and web/wiki-based treatment manual support.
/*{{{*/
Background: #eff5df
Foreground: #191f09
PrimaryPale: #eff5dd
PrimaryLight: #b7d46a
PrimaryMid: #6a8325
PrimaryDark: #0d1004
SecondaryPale: #f4ddf5
SecondaryLight: #ce6ad4
SecondaryMid: #7f2583
SecondaryDark: #0f0410
TertiaryPale: #ffffcc
TertiaryLight: #6a96d4
TertiaryMid: #254d83
TertiaryDark: #040910
ColorPaletteParameters: HSL([76|41], [0.5530875288351996|0.5530875288351996|0.5530875288351996|0.5530875288351996],[0.041532244092216564|0.3330606735732981|0.6245891030543796|0.9161175325354611])
/*}}}*/
This is some physical action that you find you "have to do" - even though you may find it annoying or silly to be having to do this. OCD (Obsessive Compulsive Disorder) consists of compulsions and obsessions (thoughts that you keep having, even though you don't want to have them).
In many ways people who binge, or use drugs or alcohol do this ''compulsively''
See also [[Craving]]
!What is it?
* The [[WAVE]] we are talking about here is a craving.
* Craving is what is happening when you suddenly feel quite overwhelmed by the need to do or have something that you've previously said to yourself that you //don't want//.
* Suddenly you find you //do seem to want it//, and it is difficult to say //"No, I still don't really want this!"//
* For example, just BEFORE a person who is trying to stop drinking, or bingeing, or smoking breaks their promise (//"I'll never do it again!"//) a CRAVING is what hits them and makes them lose their balance - ''JUST AS A BIG WAVE CAN KNOCK YOU OFF YOUR FEET OR TURN YOUR BOAT OVER''.
*** They may feel overwhelmed
*** They may feel out of control
*** They may find themselves doing what they don't want to do
!What do we know about Cravings?
* We know that Cravings arise in the brain, and are due to ''a wave of natural chemicals being released'' across areas of the brain - often triggered by ''associations'' (walking past the sweet shop, meeting an old drug-using friend...)
<<image [[CravingCircuit]] width:300 height:450>>
* We know that Cravings work like WAVES on people
** They come, and then they go - ''literally __in the brain__, the chemicals released __will run out__, and reduce back down again after a while''
** But commonly, people don't wait for the cravings to go so they ACT on their craving instead to make the unpleasant feeling go away (they have a drink, or a cigarette, or a binge)...
!What to do about this?
* Acting on the craving (saying //"Oh what the hell, OK, one more time..."//)
** DOES make the craving go away - ''but at a cost!''
** The trouble is, ''if you always "solve" your cravings by saying yes to them, you never learn that they will go away ANYWAY''
** And you are at risk of getting further and further into trouble with the thing you are trying to quit.
* We will be emphasising how you can learn to ride these waves in a more expert way.
**Go back to [[WAVE]] to find out how.
see [[Dance Offensive|http://www.danceoffensive.com]]'s website here.
<html><div align="center"><iframe src="http://www.danceoffensive.com" frameborder="0" width="100%" height="600"></iframe></div></html>
So this is more about commenting between separate authors - if the two authors then decide to //collaborate// they could form a small trusted group and share a separate space.
/***
|''Name''|DelayWikifiedViewTypePlugin|
!Description
This provides the _wikified view type which hooks into TiddlySpace's scrolling mechanism to only wikify content which is in the window focus. This allows one to open all tiddlers by default without fear of browsing crashing.
***/
//{{{
var w = config.macros.view.views.wikified;
config.macros.view.views._wikified = function(value, place, params, wikifier,
paramString, tiddler) {
var that = this;
var args = arguments;
jQuery("<span />").addClass("wikifying").text("rendering...").appendTo(place);
config.extensions.tiddlyspace.scroller.registerIsVisibleEvent(tiddler.title, function() {
jQuery(place).empty();
w.apply(that, args);
});
};
//}}}
To some extent, but I find that it is a "marker" of where the task (that underlies the reason for setting up the TW in the first place) has got to when I //slow down// on the modifications! I hasten to add I only do pretty simple modifications, and tend to use the same small number of plugins or techniques again and again.
!Learning
<<image [[BabyStudying]] width:200 height:200>>
* As you go through step [[4. Evaluate]] you will start to learn about the most important early warning signs ''FOR YOU'' that a wave might be about to hit.
* Everybody's Early Warning Signs are probably a bit different from each others', though many will be similar.
* You will have to map yours out (see also [[Mapping the territory]]).
!Examples:
* ''Noticing I am stressed:''
** Muscle tension
** Snappiness with friends or family
** Notice I am worrying about "stupid stuff" that ordinarily you wouldn't
* ''Arguments''
** These often happen very quickly, and pass quickly, but leave us more stressed than we realise at the time
** Being more argumentative than usual is another sign
* ''Other old habits creeping back''
** Nail-biting
** Obsessional thinking (tidying, cleaning, hand-washing, etc)
* ''Something out of the ordinary happens''
** It could be a ''good'' thing, as much as a ''bad'' thing
** Anything that "shakes me up" and interrupts the day I was "expecting to have"
* ''Common "Reminders"''
** Walking past a food shop (or an off-license, or a dealer's flat)
** Seeing a film that involves other people doing whatever it is that your [[Craving]] is for.
* ''After some small triumph''
** Sometimes after you have achieved something (got a piece of work done, finished some kind of performance, coped with some OTHER tricky situation) you can feel //"I deserve a treat now"//...
!What to do
* Keep a List of YOUR main Early Warning Signs
* Develop a SCALE to measure the RISK of hitting a craving (0 = zero risk, 10 = Extremely high risk, almost inevitable a craving is round the corner)
* Divide RISK scores into:
|bgcolor(green):''LOW RISK<br>(0 -3)'' |bgcolor(lightgray): ''No action required, just keep your wits about you as normal'' |
|bgcolor(orange):''MEDIUM RISK<br>(4 - 6)'' |bgcolor(lightgray):''Take avoiding action (avoid the danger zones you've identified in [[Mapping the territory]], do some [[Relaxation exercises]])'' |
|bgcolor(red):''HIGH RISK<br>(7 - 10)'' |bgcolor(lightgray): ''Start the [[WAVE Crisis Drill]]'' |
<!--{{{-->
<div class='toolbar'
macro='toolbar [[ToolbarCommands::EditToolbar]]'>
</div>
<div class='heading editorHeading'>
<div class='editor title' macro='edit title'></div>
<div class='tagClear'></div>
</div>
<div class='annotationsBox' macro='annotations'>
<div class='editSpaceSiteIcon'
macro='tiddlerOrigin height:16 width:16 label:no interactive:no'>
</div>
<div class="privacyEdit" macro='setPrivacy label:no interactive:no'></div>
<div class='tagClear'></div>
</div>
<div class='editor' macro='edit text'></div>
<div class='editorFooter'>
<div class='tagTitle'>tags</div>
<div class='editor' macro='edit tags'></div>
<div class='tagAnnotation'>
<span macro='message views.editor.tagPrompt'></span>
<span macro='tagChooser excludeLists'></span>
</div>
</div>
<!--}}}-->
!Either:
...Cut and paste the You tube "embed" code straight in, but ''bracket it'' with @@{{{<html>}}}@@ and @@{{{</html>}}}@@ which gives you this:
!!!Dem boys!
<html><object width="425" height="344"><param name="movie" value="https://youtube.com/v/tW5f4z6qXik&hl=en_GB&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="https://youtube.com/v/tW5f4z6qXik&hl=en_GB&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></html>
!Or...
Use an Iframe which creates a larger "window on the web" - just stick the URL (web address) for the page in where it says WEBPAGEURLHERE!:
{{{
<html><div align="center"><iframe src="WEBPAGEURLHERE" frameborder="0" width="100%" height="600"></iframe></div></html>
}}}
/*!**
|''Name''|ExtraFilters|
|''Author''|Jon Robson|
|''Version''|0.6.8|
|''Status''|@@experimental@@|
|''Requires''|TiddlySpaceFilters ImageMacroPlugin|
|''CodeRepository''|<...>|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
!Notes
* Updates shadow tiddlers to known TiddlySpace shadow tiddlers
* adds the following filters
{{{
[is[tiddler]] - allows you to match all tiddlers - useful for applying the isnot filter (see later)
[is[image]] - returns only image tiddlers (e.g. png, jpeg, gif etc..)
[is[shadow]] - returns if the tiddler is a known shadow tiddler
[is[svg]] - returns only svg tiddlers
[is[tagged]] - returns tiddlers with tags
[isnot[image]] - filters result of previous filters for ones that are not images
[notag[<tag>]] - filters result of previous filters for ones without a tag
[nofield[<field>]] - check for absence of field or field value in previous filters
[has[<field or attribute>]] - match tiddlers which have a field or attribute set.
[and[<filter expression>]] - e.g.[and[tag:foo]] checks all tiddlers from previous filters for a tag foo.
[nobag[foo]] - removes any tiddlers previously returned by a previous filter that belong to the given bag
[is[open]]
[startsWith[title,Foo]] returns all tiddlers who's titles start with Foo.
}}}
***/
//{{{
(function($) {
var _display = Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function() {
var res = _display.apply(this, arguments);
$("[macroName=list]").each(function(i, el) {
config.macros.list.refresh(el);
});
return res;
};
var _close = Story.prototype.closeTiddler;
Story.prototype.closeTiddler = function() {
var res = _close.apply(this, arguments);
$("[macroName=list]").each(function(i, el) {
config.macros.list.refresh(el);
});
return res;
};
config.shadowTiddlers.SiteIcon = "";
config.shadowTiddlers.SiteInfo = "";
config.shadowTiddlers.SystemSettings = "";
config.shadowTiddlers[config.extensions.tiddlyspace.currentSpace.name + "SetupFlag"] = "";
config.filterHelpers["is"].image = config.macros.image.isImageTiddler;
config.filterHelpers["is"].svg = config.macros.image.isSVGTiddler;
config.filterHelpers["is"].tiddler = function(tiddler) {
return tiddler ? true : false;
}
config.filterHelpers["is"].open = function(tiddler) {
return story.getTiddler(tiddler.title) ? true : false;
}
config.filterHelpers["is"].shadow = function(tiddler) {
return tiddler && tiddler.title && tiddler.title in config.shadowTiddlers ? true : false;
}
config.filterHelpers["is"].tagged = function(tiddler) {
return tiddler && tiddler.tags.length > 0 ? true : false;
};
config.filterHelpers["is"].external = function(tiddler) {
var endsWith = config.extensions.BinaryTiddlersPlugin.endsWith;
var fields = tiddler.fields;
var bag = fields["server.bag"] || "";
var local = config.filterHelpers["is"].local(tiddler);
if(!local && endsWith(bag, "_public") || bag.indexOf("_") === -1) {
return true;
} else {
return false;
}
};
config.filterHelpers["is"].privateAndExternal = function(tiddler) {
var endsWith = config.extensions.BinaryTiddlersPlugin.endsWith;
var fields = tiddler.fields;
var bag = fields["server.bag"] || "";
return !config.filterHelpers["is"].local(tiddler) && endsWith(bag, "_private");
};
config.filters.isnot = function(candidates, match) {
var type = match[3];
var results = [];
for (var i = 0; i < candidates.length; i++) {
var tiddler = candidates[i];
var helper = config.filterHelpers.is[type];
if(helper && !helper(tiddler)) {
results.pushUnique(tiddler);
}
}
return results;
};
config.filters.nobag = function(results, match) {
var bag = match[3];
var newResults = [];
for(var i = 0; i < results.length; i++) {
var tiddler = results[i];
if(tiddler.fields["server.bag"] !== bag) {
newResults.push(tiddler);
}
}
return newResults;
};
config.filters.linksTo = function(results, match) {
var name = match[3];
results = this.getTiddlers();
var newResults = [];
for(var i = 0; i < results.length; i++) {
var tiddler = results[i];
var links = tiddler.getLinks("title", "excludeLists");
if(links.contains(name)) {
newResults.push(tiddler);
}
}
return newResults;
};
config.filters.notag = function(results, match) {
var tag = match[3];
var newResults = [];
for(var i = 0; i < results.length; i++) {
var tiddler = results[i];
if(!tiddler.tags.contains(tag)) {
newResults.push(tiddler);
}
}
return newResults;
};
config.filters.nofield = function(results, match) {
var fieldname = match[3];
var newResults = [];
for(var i = 0; i < results.length; i++) {
var tiddler = results[i];
if(!tiddler.fields[fieldname]) {
newResults.push(tiddler);
}
}
return newResults;
};
config.filters.and = function(results, match) {
var args = match[3].split(":");
var negationMode = false;
var handler = args[0];
if(handler.indexOf("!") === 0) {
handler = handler.substr(1);
negationMode = true;
}
var value = args[1];
if(config.filters[handler]) {
var titles = [];
var matches = config.filters[handler].call(this, [], [null, null, handler, value]); // note some filters require second argument :(
for(var i = 0; i < matches.length; i++) {
titles.push(matches[i].title);
}
var newResults = [];
for(var i = 0; i < results.length; i++) {
var tid = results[i];
if(!negationMode && titles.contains(tid.title)) {
newResults.push(tid);
} else if(negationMode && !titles.contains(tid.title)) {
newResults.push(tid);
}
}
return newResults;
} else {
return results;
}
};
config.filters.has = function(results, match) {
var field = match[3];
var results = [];
this.forEachTiddler(function(title, tid) {
if(tid[field] || tid.fields[field]) {
results.push(tid);
}
});
return results;
};
config.filters.startsWith = function(results, match) {
var args = match[3].split(",");
var field, str;
if(args.length === 1) {
field = "title";
str = args[0]
} else {
field = args[0];
str = args[1];
}
var newResults = [];
// use this to keep the current store context
this.forEachTiddler(function(i, tid) {
var val = this.getValue(tid, field);
if(val && val.indexOf(str) === 0) {
newResults.push(tid);
}
})
return newResults;
}
var scanMacro = config.macros.tsScan;
config.filterHelpers.loadingTiddler = new Tiddler("Loading...");
config.filterHelpers.loadingTiddler.text = "loading...";
config.filterHelpers.loadingTiddler.fields["msg.loading"] = "loading...";
config.filterHelpers.url = {};
config.filters.url = function(results, match) {
var url = match[3];
var tiddlers = config.filterHelpers.url[url];
if(tiddlers) {
return tiddlers;
} else if(!status) {
config.filterHelpers.url[url] = [ config.filterHelpers.loadingTiddler ];
$.ajax({type:"get", url: url, dataType: "json", success: function(jstiddlers) {
var tiddlers = scanMacro._tiddlerfy(jstiddlers, {});
config.filterHelpers.url[url] = tiddlers;
refreshDisplay();
}, error: function() {
displayMessage("unable to connect to %0".format(url));
}
});
}
return config.filterHelpers.url[url];
};
}(jQuery));
//}}}
This is an idea from Bruce Tuckman
See http://en.wikipedia.org/wiki/Tuckman%27s_stages_of_group_development
Forming and Storming are essentially pretty inward-looking stages, adn I would say that TiddlySpace is pretty much in these at present, without so much evidence of externally-directed usage quite yet (I am sure there are plenty of examples that show me I am wrong in that...)
/%
Hello,
If you choose to change this GettingStarted tiddler, you may wish to add the following to your new content if you expect you space to be included:
<<<
----
Hello,
''This ~GettingStarted tiddler has been customized.''
If you want to see the original system tiddler just click the following link: GettingStarted@system-info at system-info.
<<<
%/
Welcome to your brand new [[TiddlySpace|http://docs.tiddlyspace.com/TiddlySpace]].
You're almost ready to go, there are just a couple of things left to do.
!Customise your space
Go to [[SpaceSettings]] to finish customising your space. When you're done, come back here (just scroll up). Don't worry though, this will still be open when you've finished.
!Further Customisation
For advanced options, the [[ServerSettings]] tiddler is used to enable the following features:
#index: The value is the name of a tiddler that will be presented when loading the space. For example, when set to {{{Hello}}} for the space hello.tiddlyspace.com, navigating to that URL will present the Hello tiddler. If there is no {{{Hello}}} you will get an error.
#editor: The name of an [[editor application|http://docs.tiddlyspace.com/Example%20Tiddler%20Editors]] to edit tiddlers with. Applications come from [[included spaces|http://docs.tiddlyspace.com/How%20do%20I%20include%2Fexclude%20spaces%3F]]
//If you do not need or understand these features there is no need to create a ServerSettings tiddler.//
To edit these options:
* click [[here|ServerSettings]] to open the [[ServerSettings]] tiddler
* click on the edit button (the pencil icon)
* add the options you wish to set
* click on the save button (the tick icon).
An example [[ServerSettings]] tiddler:
{{{
index: HelloThere
editor: /edit#{tiddler}
}}}
The additional text after /edit allows a tiddler to be opened in edit mode e.g:
{{{http://hello.tiddlyspace.com/edit#MyTiddler}}}
!!See Also
* [[ServerSettings shadow tiddler|http://docs.tiddlyspace.com/ServerSettings%20shadow%20tiddler]]
* [[Choosing a non-TiddlyWiki Default Application for your Space|http://docs.tiddlyspace.com/Choosing%20a%20non-TiddlyWiki%20Default%20Application%20for%20your%20Space]]
!Finished customising?
You can [[Start writing]] some [[tiddlers|http://docs.tiddlyspace.com/Tiddler]].
If you're not done tweaking yet though, you can always [[Customise this space|SpaceSettings]] a bit more.
You can also [[access and read other tiddlers in various ways|http://docs.tiddlyspace.com/Viewing%20Tiddlers]].
!Administration
If you'd like to change your password or create another space, visit "Your Account" from the [[Universal Backstage|http://docs.tiddlyspace.com/UniversalBackstage]] (the blue dot in the upper right of the page). If you'd like to add a member or [[include a space|http://docs.tiddlyspace.com/How%20do%20I%20include%2Fexclude%20spaces%3F]] visit "This Space" from the [[Universal Backstage|http://docs.tiddlyspace.com/UniversalBackstage]].
You can have as many spaces as you like and each space can have as many members as you or your group need.
!Stuck?
If you're stuck, and would like some help, please visit the [[help|http://help.tiddlyspace.com]] space, which can point you in the right direction.
<html><div align="center"><iframe src="https://groups.google.com/forum/embed/?place=forum/mbt-practicedevelopmentresearch" frameborder="0" width="100%" height="1000"></iframe></div></html>
<html><iframe width="640" height="360" src="https://youtube.com/embed/A0pnI8uMcLM?rel=0" frameborder="0" allowfullscreen></iframe></html>
!Welcome
I am Dickon Bevington. I work as a Child and Adolescent Psychiatrist [[in Cambridge|http://www.casus.cpft.nhs.uk]] and at the [[Anna Freud Centre|http://www.annafreud.org]]. This was just the place where I was working out TiddlySpace, and how it supports the @ambit project that I lead with Peter Fuggle from the [[Anna Freud Centre|http://www.annafreud.org]]... increasingly I use it as a signposting site for various other [[Spaces]], from which I organise or explore stuff, or play.
!Confidentiality
A lot of material here would be excruciatingly boring to anyone but me, and is thus private. The pages ("tiddlers") in TiddlySpace can be either "public" or "private" - private pages are only visible if you are a member of a particular wiki (or "Space"); I always emphasise that although the privacy levels in TiddlySpace are perfectly good, they are NOT designed to the same specs as medical (NHS) sites, and so I would ''never'' advise anyone using them for //clinical material// that should always be stored behind ~NHS-level firewalls.
!Thanks
I am most grateful to many people in the incredibly helpful [[Tiddlywiki community|https://groups.google.com/forum/?fromgroups#!forum/tiddlywiki]] for helping me learn to use this stuff. I'd have to start with Jeremy Ruston (@jermolene) who got me started, as well as @osmosoft, especially Matt Lucht and Paul Downey. Then Jon Lister (@jnthnlstr) and Joshua Bradley of withjandj (http://withjandj.com) who have helped design the new look and functions in the new @ambit manual, as well as Chris Dent (@chris-dent) for all his work on tiddlyweb and thinking about the architecture that supports TiddlySpace; Chris's ability to articulate how programming skills can (and I think increasingly do) map onto (and shape) the 'softer' skills of human communication and the reading of intentionality is in my opinion quite remarkable. Also Eric Shulman in California for his unstoppable enthusiasm for helping people improve the code to make TiddlyWiki work - and latterly for his endeavours to keep the AMBIT manual working in the antediluvian web browsers that august organisations in the NHS tend to favour over more modern browsers that tend instead to, errrm, //work//.
!Blog
I keep an occasional [[Blog]] about the TiddlyManuals aspect of this project. It hardly rates as the most riveting read on the Internet. You can access it direct on the web [[here|http://dickonb.blogspot.com/]] . Increasingly the blogging aspects of TiddlyManuals and AMBIT are contained at the @tiddlymanuals site itself...
Type the text for 'New Tiddler'
<<tiddler SiteInfo>>
To try it there are two steps, the first required, the second and third optional:
* Include the edit space in your space.
* Add the following lines to or create a tiddler called 'HtmlJavascript' (If jquery is already in there, there's no need to have it twice.)
{{{
/bags/edit_public/tiddlers/editedit.js
}}}
* If you want to to use edit as the default editor for missing tiddlers, edit the ServerSettings tiddler and add:
{{{
editor: /edit#{tiddler}
}}}
Then when you visit {{{/edit}}} in your own space, you'll find an editor.
* You can select a tiddler to edit from the sidebar by clicking on the pen icon.
* Clicking a tiddler title will take you to view that tiddler.
* Clicking on a tag in the lower left will add that tag to the tiddler. Click again to remove the tag.
* In the upper right you save, revert or delete.
* Below that are options for choosing the type of the tiddler. You can create other things besides tiddlywiki text: Markdown and raw HTML, CSS or ~JavaScript.
* Edit supports client-side [[extraclusion]].
You can start edit from a link and by providing some information in the hash of the URI you can tell it about the new tiddler you want to create:
{{{
/edit#<title>/<tags>/<type>
}}}
* tags are formatted as they are in TiddlyWiki (double square brackets around tags containing spaces)
* type is a content-type, such as {{{text/x-markdown}}}
Having discovered the delights of @tapas recently this has made a lot more sense of how I can use the social elements of TS more effectively. So I am posting this on TS, but will also post a version on the Google group.
I have had a number of calls over the past few days from members of ~AMBIT-adapting local teams who say the manual is not working (displaying white) in internet explorer.
This is great news insofar as it suggests there is still engagement with the manual and people want to get it fixed, but also a big worry. Most teams we train are embedded in large organisations (the NHS being the perfect example) whose approach to IT (especially the social aspects of it) is antediluvian and whose rigid insistence on the use of palaeolithic browsers is one of the irritating "non-negotiables" (although we are getting better at negotiating)...
I suspect this is not because of any changes to the ambit theme, as this hasn't changed for a bit. I suspect it is something else, and I do remember picking up a snippet about a javascript handling problem with IE recently...
Any thoughts? Would really like to be able to reconnect teams with their manuals ASAP.
Much gratitude for any help.
Dickon
I have known and loved Jeremy Ruston for many years, so it was word of (horse's) mouth.
It is strange when you have known someone for many years; suddenly to discover how something so excellent has been going on in their work (that had always seemed so far away from your own) - and that it absolutely answers what you are after... kerrr-ching!
I got curious about what this Tiddly stuff was about in conversation, and Jeremy sent me a link, which I started looking at in about 2005 I think. As a total non-techy I commend my own bravery in trying to get past the somewhat opaque documentation, but there was a fairly sudden "lights came on" moment when I saw massive potential in what was on offer, that I had seen nowhere else.
Amazingly helpful and quick to respond - knowledgeably and creatively - via the Google Group.
I worry that as TW gets bigger as a "movement" (?!) there could be a loss of capacity from the small group of utterly dedicated 'evangelists' for TW who do seem to have an extraordinary capacity to be massively helpful almost instantaneously, whenever I have posted with a confusion or glitch...
At least 20
Some I use all the time (the @ambit manual is probably my peak!)
My NHS team uses an offline TW (securely stored) to track and document all the clients we treat, documenting team discussion in the TW, and printing out these tiddlers for pasting into the conventional paper notes. The TW is projected and edited during every team meeting, and the act of typing into it has become part of our efforts towards "transparent practice"...
I use TW's for major literature reviews - fantastic for cross referencing, tagging, ensuring that I have integrated a disparate body of literature.
I use TW's in management meetings to make wikified minutes - people get intrigued and wnat to understand and that often deepens the discussion - what are the underlying themes (Tags) that we are REALLY trying to crack in this meeting?
etc...
I get about 4-500 hits a month to my Tiddlymanuals at present, which compared to how many people regularly read treatment manuals is, in my book, quite good going for a new project.
There are about 17 teams starting to use and adapt their own local versions of a TiddlyManual around the UK, and these vary in size from about 4 or 5 up to about 25.
The main @ambit tiddlymanual (see @tiddlymanuals) is over 2Mb now - still works fine!
Mentalizing requires some working hardware, of course; the genetic associations with autistic spectrum disorders (ASD's) suggest that the immense difficulty that sufferers of these conditions face in trying to mentalize is (at least in a large part) because of the connections that are lacking.
For most humans, however, it is more a question of early experience that determines whether or not they can switch on mentalizing when it is required. Because ''mentalizing arises in a relational context...''
We learn to mentalize through the iterative experience of //being 'mentalized'// - mostly by the key attachment figures in our early lives; mothers, primary carers, etc.
The process of 'programming' the developing infant to mentalize runs along these lines (& i think that here is where there are some of the most interesting overlaps with the nascent process of communication within TiddlySpace.
The mother is constantly bombarded with impressions from her baby's behaviour. When she is sensitively attuned to the child she does three things; she MIRRORS the child's mental state (as best she can imagine what this is - fear, hunger, rage, joy, etc), but equally she MARKS this mirroring so that the baby does not simply receive 'anger' back (which would be terrifying) but instead has a mother who is perhaps frowning, while cooing and saying "you are a cross patch!" as if to say "my estimation of your mental state is that you are 'angry', but I am not angry with YOU!". Finally, she is able to respond CONTINGENTLY to the needs that she imagines her baby has in the moment.
This iterative experience of CONTINGENT, MARKED, MIRRORING is what allows the baby to take in an idea of himself or herself HAVING A MIND, which has different states at different times, according to which it is more or less effective at carrying out other day-to-day tasks. As Prof Peter Fonagy puts it, in an extension of Descartes' famous words: //"My mother thinks I think, therefore I am."//
!And the connection to TiddlySpace is...?
Now this sense of experiencing one's thoughts/feelings as they are represented in the mind of another seems to me to be close to what TiddlySpace might facilitate - particularly if the MARKING of 'my' tiddlers is clear as I see them adapted, digested, adopted, or challenged within another person's Space.
It seems to me that the way that TiddlySpace 'mirrors' the experiencing of our behaviours (speech acts, tiddlers, etc, included) //being taken inside another mental space and explicitly engaged with// is absolutely key. This may seem a 'clunkier' communication form than the two-dimensional stream of, say, Facebook or Twitter, where all conversation coexists in a //single shared space// (the implication being that //"meanings here are all shared and explicit"//, as opposed to a set of words meaning one thing in my head, and something entirely different in yours...) but it may have real advantages. Where
Facebook or Twitter are the //agora// (marketplace), TiddlySpace holds promise as the home, office, or living room.
The activity feed is best for sharing opinions on something. To make best use of it create a tiddler and tag it with a username you would like to share thought with on this subject.
For instance I might create a tiddler called [[Animal I'd least like to be stuck in a cage with]]. I might say
<<<
I would least like to be stuck in a cage with a lion as it could tear me apart amongst other reasons.
<<<
I then tag it @matias to get @matias's attention to see what he think. This flags it in @matias's activity feed and tells him that I am interested in his thoughts. Of course @matias can ignore it, and if he is not using the activity feed feature he may not even know about the message. If he wants to respond all @matias then has to do is create his own tiddler [[Animal I'd least like to be stuck in a cage with]]. Matias might say
<<<
A lion would be not as bad as a great white shark... not only would you be stuck in a cage with it but you would be underwater with a likelihood of drowning to increase suffering.
<<<
It's not over yet.. now I can refine my original post with the thoughts of Matias. I might think mm, @matias has got a point there with the water, but I think a crocodile would more likely eat me then a great white shark and I fancy my chances with the great white.
I then update my tiddler to say
<<<
I would least like to be stuck in a cage with a crocodile as it could tear me apart amongst other reasons. A lion would also be scary however I'm not a good swimmer so would be less likely to be able to make an escape. A crocodile is worse than a shark as shark attacks on humans are rare, so I'd fancy my chances.
<<<
We continue replying this way revising our tiddlers till the process finishes and I have a tiddler which clearly explains the [[Animal I'd least like to be stuck in a cage with]] with very detailed reasoning.
@import url(http://straightwsgi.tiddlyspace.com/bags/straightwsgi_public/tiddlers/HtmlCss);
/bags/edit_public/tiddlers/editedit.js
/status.js
!I have two choices
#From within the @ambit-workgroup I can write a tiddler, which will show up in the Recent list in the index.
##If I want to notify a //particular person// i tag the tiddler with their individual name/site (for instance {{{@}}} or {{{@katyv}}}) - if they are using the @following space (//include// it in your home space) then it will show up highlighted in their ''Activity'' stream.
#From other spaces of theirs (eg @katyv or @peterf) they can press 'reply to this tiddler'... This opens a copy of the tiddler they want to comment on/improve, in their space. They can write their version, or add their annotations... This is THEIR version now (in THEIR ) space, but they can notify the OriginalAuthor by tagging the tiddler with {{{@originalauthor}}} (or {{{@katyv @peterf @ambit-workgroup}}} etc...)
/***
|''Name''|ImportExternalLinksPlugin|
|''Author''|Jon Robson|
|''Version''|0.3.0|
|''Requires''|TiddlySpaceConfig TiddlySpaceLinkPlugin TiddlySpaceCloneCommand|
|''Description''|Turns space links into ajax links so you don't have to leave the comfort of your own TiddlyWiki|
!Notes
This maybe should hides the editTiddler, cloneTiddler commands. Ideally the toolbar commands should hide themselves but we need a strong concept of "this is a sucked in tiddler" to do that.
***/
//{{{
(function($){
var tiddlyspace = config.extensions.tiddlyspace;
_createSpaceLink = createSpaceLink;
if(_createSpaceLink) {
createSpaceLink = function(place, spaceName, title, alt, isBag) {
var tooltip = "Click to open in current document. Right click to open in original space.";
_createSpaceLink(place, spaceName, title, alt, isBag);
var workspace;
if(isBag) {
workspace = "bags/%0".format(spaceName);
} else {
workspace = "bags/%0_public".format(spaceName);
}
if(title && spaceName != tiddlyspace.currentSpace.name) {
var link = $("a:last", place);
var newlink = $("<a />").text("[link]").after(link[0]);
// very hacky
var updateInterval = setInterval(function() {
var href = link.attr("href");
if(href) {
$(newlink).attr("href", href);
clearInterval(updateInterval);
}
}, 200);
if(link.parent(".replyLink").length == 0) { // don't suck in a reply link.
link.attr("title", tooltip).addClass("importLink").click(function(ev) {
if(config.floorboards) {
config.floorboards.pushUnique("%0_public".format(spaceName));
}
tiddlyspace.displayServerTiddler(ev.target, title, workspace, function(el) {
// TODO: the commands should disable themselves based on the meta information.
//$("[commandname=editTiddler], [commandname=cloneTiddler]", el).hide();
});
ev.preventDefault();
});
}
}
};
}
var _cloneHandler = config.commands.cloneTiddler.handler;
config.commands.cloneTiddler.handler = function(event, src, title) {
var _tiddler = store.getTiddler(title);
var source = _tiddler ? _tiddler.fields["server.bag"] : false;
var imported = _tiddler ? _tiddler.fields["tiddler.source"] : false;
var realTitle = _tiddler ? _tiddler.fields["server.title"] : title;
_cloneHandler.apply(this, [event, src, title]);
var tidEl = story.getTiddler(title);
$(story.getTiddlerField(title, "title")).val(realTitle);
if(source) {
$("<input />").attr("type", "hidden").attr("edit", "tiddler.source").val(source).appendTo(tidEl);
$("<input />").attr("type", "hidden").attr("edit", "server.activity").appendTo(tidEl);
}
}
})(jQuery);
//}}}
<<tabs
txtMainTab
"Recent" "Recently edited tiddlers" TabTimeline
"All" "All tiddlers" TabAll
"Public" "All public tiddlers" [[TiddlySpaceTabs##Public]]
"Private" "All private tiddlers" [[TiddlySpaceTabs##Private]]
"Tags" "All tags" TabTags
"Spaces" "Tiddlers grouped by space" [[TiddlySpaceTabs##Spaces]]
"Missing" "Missing tiddlers" TabMoreMissing
"Orphans" "Orphaned tiddlers" TabMoreOrphans
"Shadows" "Shadowed tiddlers" TabMoreShadowed
>>
Links to other stuff I have found and like on the web.
/***
|''Name''|LoadMissingExternalTiddler|
|''Version''|0.1.0|
|''Author''|Jon Robson|
***/
//{{{
var _loadMissing = Story.prototype.loadMissingTiddler;
Story.prototype.loadMissingTiddler = function(title,fields,callback) {
var matches = title.match(/([^\*]*) \*\(@([^\)]*)\)\*/);
if(matches && matches.length > 0) {
var sTitle = matches[1];
var space = matches[2]; config.extensions.tiddlyspace.displayServerTiddler(story.getTiddler(title),
sTitle, "bags/%0_public".format(space));
} else {
_loadMissing.apply(this, arguments)
}
};
//}}}
For the online manual see: @mbtf
For material gathered here related to MBTF: <<tag MBT-F>>
For material on [[MBT-F at the AFC]]
!DB tasks
The current manual needs an update in order to use the @ambit-theme-v3
!~MultiSystemic Treatment for Child Abuse and Neglect
The UK pilot for this adaptation of MST for families at risk of breakdown because of physical or emotional abuse or neglect. Run from Cambs Local Authority in collaboration with [[CPFT|http://cpft.nhs.uk]].
''@@color(green):| <<tag [[Spaces]]>> | <<tag TiddlySocial>> | <<tag [[Projects]]>> | <<tag Links>> | <<tag [[Tasks]]>> | [[Calendar]] | <<tag SiteManager>> | [[Index]] |@@''
<<image [[SeaChart]] width:480 height:300>>
!Learning where the danger lies
As part of the step [[4. Evaluate]] you are trying to build up a kind of "Sea Chart" that lets you know where you are most likely to get hit by a big wave, so you can either ''prepare for this'' or ''avoid that area''.
!!Where are the risky places?
* Particular spots in town?
* Particular houses, or rooms?
!!Who are the risky people?
* Are there particular people with whom (or after you have been with them) you tend to get hit by Waves?
* Can you talk to them about this (//Improve your relationship//)?
* do you need to //avoid them// for while, for ever?
!!What are the risky States of Mind
See [[States of Mind]]
<!--{{{-->
<link href="/bags/backups_public/tiddlers.atom" rel="alternate"
type="application/atom+xml" title="backups's public feed" />
<link rel="canonical" href="http://backups.tiddlyspace.com/" />
<!--}}}-->
I am starting to gather a collection of:
<<tag [[Mentalizing Research and Quotes]]>>
For the best tiddly-based description of Mentalization, as at August 2013, the most work has so far (by far!) gone into the material in the @ambit manual. In due course the stuff that is currently in AMBIT will be updated, clarified, and further worked on by the wider MBT steering group, and then drawn down into the @mentalization site... but we're not there yet - too much else on!
@mentalization - This is in construction, not finished. It's a site where the mentalization-based treatments steering group are pooling and sorting our conceptual model, and training materials, with a view to developing a clear, shared explanation of what is mentalization. In due course (when the site is more advanced) this will be included in all the treatment variations, to ensure that whilst the various different applications of Mentalizing may look different, or stress different aspects, we are all 'singing from the same space' (so to speak.)
<<tag Mentalizing>>
This is the imaginative activity involved in making sense of one's own behaviour, or of the behaviour of others, //and doing so by means of imputing intentional mental states - the contents of a mind that motivate action; be this hopes, beliefs, fears, wishes...//
!28.02.11 - Update for [[Mentalizing]] @alexhough
Recursion is quite a helpful term in relation to mentalizing, insofar as it implies the possibility of endlessness (you can get lost in over-mentalizing - "excrementalizing" as described below!) but also of the values of the present inevitably //changing// the next values, or one's understanding of the past - so there is a flexibility, and inherent changeability implicit in the concept, I suppose.
From my reading of [[Wabi Sabi|http://c2.com/cgi/wiki?WabiSabi]] this is more about an //aesthetic//, but I like the connection with imperfection - the acceptance of the real implicit in the concept. Anyone who quotes Leonard Cohen's wonderful song "Anthem" gets my vote, too! ([[Wabi Sabi|http://c2.com/cgi/wiki?WabiSabi]].) When we work therapeutically in a "mentalization-based" way, I suppose we absolutely try to sustain our ''not-knowing'' the contents of the other's mind, as well as a respectful curiosity/inquisitiveness to understand better in a way that is transparent to that other person. (The whole idea being that I meet myself in the most digestible and realistic way as i am represented //in the mind of a trusted other//.)
Now, this discussion leads me (in a recursive spasm!) to reflect on the continued [[crankiness of social exchange in Tiddlyspace]]...
!Update: [[November 21 2010]]
>Essentially Mentalizing is about what happens when I ''take in information'' from another human being (or from reflections of myself) and consider what this information tells me about them. Hence the notion of Spaces (as in TiddlySpaces) is relevant here, and it is clearer if we think about [[How the human capacity for Mentalizing arises]], which is all about discovering the very existence of MyMind, in the way it is represented in the mind of a Trusted Other (prototypically, this is the mother.)
There is increasingly robust neuroimaging evidence to show that this can be localised, mainly to an area called the pre-frontal cortex.
Successful mentalizing, activated at the right times (rather than over-activated [welcome paranoia!], or suppressed by powerful emotional states [the red mist!]...) is a prerequisite of adaptive and successful human relationships. We need to be relatively good at "reading" each other to get along, particularly in close 'attachment' relationships.
Mentalizing is, if you like, the third and most sophisticated component of the human brain's functional apparatus for operating in complex social systems. The three systems are (in order of complexity):
#Mentalizing system - which places a brake upon the excesses of the other two...
#Attachment system - the system that allows special caring relationships to develop
#Threat system - the system that identifes potential threats and activates safety-seeking behaviour ('fight or flight')
See the [[AMBIT manual|http://imp.peermore.com/imp/recipes/imp/tiddlers.wiki]] to explore this in more detail.
!And where does this fit into TiddlySpace, or TiddlySpace fit into it?
If TiddlySpace can support a different kind of conversation, that more closely approximates effective communication (less narcissistic talking to oneself, or broadcasting into the blue, more engagement with the other(s) in a //collaborative co-construction of meaning//, which involves //checking// what the other means, etc.) ...then it will be modelling more accurately the 'rules of exchange' that successful communication appears to follow. In AMBIT we have tried to do this by formulating a vet simple set of ritualized steps that we call [[Thinking together]], and in a more technically challenging way, i think the programmers working on the architecture of TiddlySpace have been chipping away at the same kind of problems...
!re. Mentalizing[@alexhough]
>Dickon, would it be fair to say that mentalizing is something to do with reperceiving and Mental Models
Yes, I think reperceiving and mental models may capture something of the quality of mentalizing.
In the literature there is frequent reference to the notion of //meta-cognition// - thinking about thinking, although in this context I would include 'feeling' in the definition of 'thinking' as it is about that awareness of 'mental contents', the existential experience of one's own (or someone else's) subjectivity... and an awareness of the //difference// between mental representations and the 'real world'.
''What happens when mentalizing gets overwhelmed'' (which as it happens in the most recently evolved parts of the brain [pre-frontal cortex] that have less capacity to create 'volume' than more primitive structures that do 'threat-response', etc, is very common) ''is that the system 'rolls back' to more 'primitive' or immature systems of thinking.'' One of these is called [[Psychic equivalence]] in which the contents of my mind (my mental representations of the world) are directly equated with reality ("the thoughts in my mind ARE the world")... Useful that a baby who burns himself thinks "Fire IS dangerous", but less useful when i find myself thinking (and believing) that "I am rubbish!" or "Mum just wants to spoil everything in my life!"
The other 'pre-mentalistic' modes of thinking that people tend to 'roll back' into when mentalizing is overwhelmed are [[Pretend mode]] and [[Teleological thinking]], both of which are described in the ambit manual.
This rolling back and forth between mentalizing and non-mentalizing modes of thinking is a constant for humans - it would be very difficult to be in a constant state of mentalizing, and not particularly productive (John Allen, one of the mentalization-based theorists has a wonderful phrase reported to me by Efrain Bleiberg, which describes 'over-mentalizing; sometimes you have to just act (teleology) and sometimes by playing at roles (pretend) you oil the wheels and get further... he refers to mentalizing without cease as "excrementalizing").
My thought about the kind of exchanges possible in TiddlySpace is that they might ultimately be quite good at fostering/sustaining mentalized communication, because of the explicit modelling of private mental space and public, and the explicit rejection of a single 'tablet' on which our conversation is recorded as though 'this is you and this is me' (psychic equivalence) - instead, we both curate our own thoughts, and share our modifications in the light of what we see others are making of what we publish...
This is closely linked to the way children learn to mentalize - by experiencing their minds //as represented in the mind of a trusted other//
There are some clunkinesses in the system, still, but this is what most fascinates me about TIddlySpace.
<<tag [[Mentalizing Quotes]]>>
!Reference
Clin Child Psychol Psychiatry July 2012 vol. 17 no. 3 318-335
!Title
Mind-mindedness in parents of pre-schoolers: A comparison between clinical and community samples
Tansy M. Walker (1)
Rebecca Wheatcroft (2)
Paul M. Camic (3)
(1) Brighton and Hove Child and Adolescent Mental Health Service, Sussex Partnership NHS Foundation Trust, UK
(2) Greenwich Child and Adolescent Mental Health Service, Oxleas NHS Trust, UK
(3) Department of Applied Psychology, Canterbury Christ Church University, UK
Dr Tansy Walker, Clinical Psychologist, Brighton and Hove Child and Adolescent Mental Health Service, St. Stephen’s House, 45a Borough Street, Brighton, BN1 3BG Email: tansywalker@nhs.net
!Abstract
Mind-mindedness relates to parents’ propensity to treat their young children as individuals with minds of their own. Research with community samples has demonstrated impressive findings regarding child development outcomes, leading to a suggestion that mind-mindedness should be considered in clinical interventions. This is the first mind-mindedness study to include parents of children referred to clinical services. A between group design (n=49) was used to investigate whether mind-mindedness differed between parents of a clinical group of pre-school children and parents of a community comparison group and to explore how mind-mindedness related to parental depression and stress, and child difficulties. The findings revealed that mind-mindedness was significantly lower in the clinical sample and was not related to depression in either group. In the clinical group mind-mindedness was related to parenting stress and in the community group it was related to children’s emotional and behavioural difficulties. Overall these findings provide preliminary evidence that mind-mindedness may be an important construct to consider in pre-school clinical interventions.
/***
|''Requires''|TiddlySpaceViewTypes|
!Notes
An iframe running on jon.tiddlyspace.com cannot point to an absolute url on jon.tiddlyspace.. weird
***/
//{{{
(function($) {
var tweb = config.extensions.tiddlyweb;
var tiddlyspace = config.extensions.tiddlyspace;
config.macros.view.replyLink = {
locale: {
label: "Reply to this tiddler",
cancel: "Cancel reply"
},
icon: "reply.svg"
};
config.macros.view.views.replyLink = function(value, place, params, wikifier,
paramString, tiddler) {
var space;
if(tiddler) {
var bag = tiddler.fields["server.bag"];
space = tiddlyspace.resolveSpaceName(bag);
}
var replyLinkView = config.macros.view.replyLink;
var icon = replyLinkView.icon;
var locale = replyLinkView.locale;
var container = $('<a class="replyLink" />').appendTo(place)[0];
$('<div style="display:block;" />').appendTo(place);
if(icon && store.getTiddler(icon)) {
config.macros.image.renderImage(container, icon, { width: 24, height: 24, alt: locale.label});
} else {
$(container).text(locale.label);
}
var replyFrame = document.createElement("iframe");
replyFrame.setAttribute("width", "100%");
replyFrame.setAttribute("height", "600");
container.appendChild(replyFrame);
var id = "f_" + Math.random();
replyFrame.setAttribute("id", id);
replyFrame.setAttribute("name", id);
$(replyFrame).hide().appendTo(place);
var replyHidden = true;
tweb.getUserInfo(function(user) {
if(!user.anon) {
var status = tweb.status;
var currentSpace = tiddlyspace.currentSpace.name;
if(user.name !== currentSpace) {
var host = tiddlyspace.getHost(status.server_host, user.name);
var url = "%0#reply:[[%1]]".format(host, encodeURIComponent(value));
$(container).click(function(ev) {
if(replyHidden) {
$(replyFrame).show(1000);
if(!icon) {
$(container).text(locale.cancel);
}
} else {
$(replyFrame).hide(1000);
if(!icon) {
$(container).text(locale.label);
}
}
replyHidden = !replyHidden;
});
replyFrame.setAttribute("src", url);
} else {
$(container).click(function(ev) {
story.displayTiddler(ev.target, value);
});
}
} else {
$(container).remove();
}
});
};
var p = config.paramifiers;
p.reply = {
onstart: function(v) {
var clone = $("#tiddlerDisplay").clone()[0];
var message = $("#messageArea").clone()[0];
$("#tiddlerDisplay").parents().each(function(i, el) {
if(!$(el).is("body,html")) {
$(el).empty();
}
});
$("<div />").attr("id", "contentWrapper").appendTo(document.body)[0]
$("#contentWrapper").append(message).append(clone);
$("#backstageArea, #backstageButton").remove(); // kill the backstage
p.newTiddler.onstart(v);
}
};
})(jQuery);
//}}}
!@mortaltides
My sons' band website. Indie folk, signed to Wild Sound Recordings label.
/***
|Name:|NewHerePlugin|
|Description:|Creates the new here and new journal macros|
|Version:|3.0 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#NewHerePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.macros, {
newHere: {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
wikify("<<newTiddler "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
}
},
newJournalHere: {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
wikify("<<newJournal "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
}
}
});
//}}}
//{{{
config.filters.numbersort = function(results,match) {
var field = match[3];
results = results.sort(function(a, b) {
var val1 = a[field] || a.fields[field];
var val2 = b[field] || b.fields[field];
return parseFloat(val1, 10) < parseFloat(val2, 10) ? -1 : 1;
});
return results;
};
//}}}
<!--{{{-->
<div class='searchbar' macro='search'></div>
<div class='header'>
<h1 class='siteTitle tiddlerEditable' refresh='content' tiddler='SiteTitle'></h1>
<h2 class='siteSubTitle tiddlerEditable' refresh='content' tiddler='SiteSubtitle'></h2>
<div id='navBar' refresh='content' tiddler='MainMenu'></div>
</div>
<div class='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<div class='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<!--}}}-->
I am trying to import the TW http://mbft-manual.tiddlyspot.com into a new TS called @mbtf
I put in the URL to the import tiddlers box, click import, and i just get an error message.
What am I doing wrong?
Dickon
The improvements to the TiddlyManual are being tracked and documented here:
@ambit-stories
Please check it out...
<<tag [[AMBIT]]>>
<<tag [[CASUS]]>>
<<tag [[MST-CAN]]>>
<<tag [[WWFW]]>>
<<tag [[MBT-F]]>>
<<tag [[TiddlyManuals]]>>
<<tag [[Writing]]>>
An internet-based consultation and assessment service - in development.
http://www.psychiatry-uk.com/
in reply to @jon:
<<<
Firstly @jrbl apologies for us not handling this properly.
As I hope you can understand the motivations were sincere, and we felt it was something we needed to do sooner rather than later for this very reason.
As well as posting to the @blog we posted to the [[google group|http://groups.google.com/group/tiddlywiki/browse_thread/thread/f6f30b0f68a34f9d]] and have discussed it on the groups, in irc and on TiddlySpace previously but as you point out there was no guarantee any existing users would see either of those sources. I think we incorrectly took this as a green light without considering the wider impact..
Anyway I'm not going to make excuses but on hindsight we've handled it badly.
I totally agree with your vision of how it should be:
We have a story which should do what you say [[TiddlySpaceStartupScreen]]@tiddlyspace
It's just taking time to become real. @colmbritton has done some [[promising wireframes|Start Up Screen Write Up]]@colmbritton
You open up an interesting bigger question about how we notify existing users of new features.
Many websites (for example Facebook) occasionally popup alerts saying we've changed stuff. These can be slightly annoying but it's something we could replicate for things such as this which are significant. With such a notification system we could have said "hey why not make your space public" which on hindsight would have been a better approach and would have ensured you were at least aware of the development. We however then have to be careful not to abuse such a notification system too much (which is hard in such a rapid development cycle) and allow users to easily turn it off (I know many people prefer atom feeds for instance).
Thanks for your feedback.
<<<
Interesting debate.
I would certainly like a default privacy settings tab in the space backstage menu, and would probably choose private by default for most uses, as I think this is how I work with my thoughts work generally. A bit of reflection, meta-cognition, evaluation, etc, is generally not a bad thing.
Also, I would be keen for TiddlySpace to use its configuration to promote //quality// of communication over //quantity//. This is one of the things that would seem to distinguish it from Facebook, twitter or other 'stream of consciousness' sites. I am not convinced that the concept of //curation// goes with automatic publication.
Another option would be for a kind of pop-up to occur when a tiddler in edit mode is closed, so that conscious explicit choices are made on a case-by-case basis. Not sure how difficult this would be.
/***
|''Name:''|RSSReaderPlugin|
|''Description:''|This plugin provides a RSSReader for TiddlyWiki|
|''Version:''|1.1.2|
|''Date:''|2008-09-02|
|''Source:''|http://tiddlywiki.bidix.info/#RSSReaderPlugin|
|''Documentation:''|http://tiddlywiki.bidix.info/#RSSReaderPluginDoc|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''Credit:''|BramChen for RssNewsMacro|
|''[[License]]:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
|''OptionalRequires:''|http://www.tiddlytools.com/#NestedSlidersPlugin|
***/
//{{{
version.extensions.RSSReaderPlugin = {
major: 1, minor: 1, revision: 2,
date: new Date("2008-09-02"),
source: "http://TiddlyWiki.bidix.info/#RSSReaderPlugin",
author: "BidiX",
coreVersion: '2.2.0'
};
config.macros.rssReader = {
dateFormat: "DDD, DD MMM YYYY",
itemStyle: "display: block;border: 1px solid black;padding: 5px;margin: 5px;", //useed '@@'+itemStyle+itemText+'@@'
msg:{
permissionDenied: "Permission to read preferences was denied.",
noRSSFeed: "No RSS Feed at this address %0",
urlNotAccessible: " Access to %0 is not allowed"
},
cache: [], // url => XMLHttpRequest.responseXML
desc: "noDesc",
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var desc = params[0];
var feedURL = params[1];
var toFilter = (params[2] ? true : false);
var filterString = (toFilter?(params[2].substr(0,1) == ' '? tiddler.title:params[2]):'');
var place = createTiddlyElement(place, "div", "RSSReader");
wikify("^^<<rssFeedUpdate "+feedURL+" [[" + tiddler.title + "]]>>^^\n",place);
if (this.cache[feedURL]) {
this.displayRssFeed(this.cache[feedURL], feedURL, place, desc, toFilter, filterString);
}
else {
var r = loadRemoteFile(feedURL,config.macros.rssReader.processResponse, [place, desc, toFilter, filterString]);
if (typeof r == "string")
displayMessage(r);
}
},
// callback for loadRemoteFile
// params : [place, desc, toFilter, filterString]
processResponse: function(status, params, responseText, url, xhr) { // feedURL, place, desc, toFilter, filterString) {
if (window.netscape){
try {
if (document.location.protocol.indexOf("http") == -1) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
}
}
catch (e) { displayMessage(e.description?e.description:e.toString()); }
}
if (xhr.status == 404)
{
displayMessage(config.macros.rssReader.noRSSFeed.format([url]));
return;
}
if (!status)
{
displayMessage(config.macros.rssReader.noRSSFeed.format([url]));
return;
}
if (xhr.responseXML) {
// response is interpreted as XML
config.macros.rssReader.cache[url] = xhr.responseXML;
config.macros.rssReader.displayRssFeed(xhr.responseXML, params[0], url, params[1], params[2], params[3]);
}
else {
if (responseText.substr(0,5) == "<?xml") {
// response exists but not return as XML -> try to parse it
var dom = (new DOMParser()).parseFromString(responseText, "text/xml");
if (dom) {
// parsing successful so use it
config.macros.rssReader.cache[url] = dom;
config.macros.rssReader.displayRssFeed(dom, params[0], url, params[1], params[2], params[3]);
return;
}
}
// no XML display as html
wikify("<html>" + responseText + "</html>", params[0]);
displayMessage(config.macros.rssReader.msg.noRSSFeed.format([url]));
}
},
// explore down the DOM tree
displayRssFeed: function(xml, place, feedURL, desc, toFilter, filterString){
// Channel
var chanelNode = xml.getElementsByTagName('channel').item(0);
var chanelTitleElement = (chanelNode ? chanelNode.getElementsByTagName('title').item(0) : null);
var chanelTitle = "";
if ((chanelTitleElement) && (chanelTitleElement.firstChild))
chanelTitle = chanelTitleElement.firstChild.nodeValue;
var chanelLinkElement = (chanelNode ? chanelNode.getElementsByTagName('link').item(0) : null);
var chanelLink = "";
if (chanelLinkElement)
chanelLink = chanelLinkElement.firstChild.nodeValue;
var titleTxt = "!![["+chanelTitle+"|"+chanelLink+"]]\n";
var title = createTiddlyElement(place,"div",null,"ChanelTitle",null);
wikify(titleTxt,title);
// ItemList
var itemList = xml.getElementsByTagName('item');
var article = createTiddlyElement(place,"ul",null,null,null);
var lastDate;
var re;
if (toFilter)
re = new RegExp(filterString.escapeRegExp());
for (var i=0; i<itemList.length; i++){
var titleElm = itemList[i].getElementsByTagName('title').item(0);
var titleText = (titleElm ? titleElm.firstChild.nodeValue : '');
if (toFilter && ! titleText.match(re)) {
continue;
}
var descText = '';
descElem = itemList[i].getElementsByTagName('description').item(0);
if (descElem){
try{
for (var ii=0; ii<descElem.childNodes.length; ii++) {
descText += descElem.childNodes[ii].nodeValue;
}
}
catch(e){}
descText = descText.replace(/<br \/>/g,'\n');
if (desc == "asHtml")
descText = "<html>"+descText+"</html>";
}
var linkElm = itemList[i].getElementsByTagName("link").item(0);
var linkURL = linkElm.firstChild.nodeValue;
var pubElm = itemList[i].getElementsByTagName('pubDate').item(0);
var pubDate;
if (!pubElm) {
pubElm = itemList[i].getElementsByTagName('date').item(0); // for del.icio.us
if (pubElm) {
pubDate = pubElm.firstChild.nodeValue;
pubDate = this.formatDateString(this.dateFormat, pubDate);
}
else {
pubDate = '0';
}
}
else {
pubDate = (pubElm ? pubElm.firstChild.nodeValue : 0);
pubDate = this.formatDate(this.dateFormat, pubDate);
}
titleText = titleText.replace(/\[|\]/g,'');
var rssText = '*'+'[[' + titleText + '|' + linkURL + ']]' + '' ;
if ((desc != "noDesc") && descText){
rssText = rssText.replace(/\n/g,' ');
descText = '@@'+this.itemStyle+descText + '@@\n';
if (version.extensions.nestedSliders){
descText = '+++[...]' + descText + '===';
}
rssText = rssText + descText;
}
var story;
if ((lastDate != pubDate) && ( pubDate != '0')) {
story = createTiddlyElement(article,"li",null,"RSSItem",pubDate);
lastDate = pubDate;
}
else {
lastDate = pubDate;
}
story = createTiddlyElement(article,"div",null,"RSSItem",null);
wikify(rssText,story);
}
},
formatDate: function(template, date){
var dateString = new Date(date);
// template = template.replace(/hh|mm|ss/g,'');
return dateString.formatString(template);
},
formatDateString: function(template, date){
var dateString = new Date(date.substr(0,4), date.substr(5,2) - 1, date.substr(8,2)
);
return dateString.formatString(template);
}
};
config.macros.rssFeedUpdate = {
label: "Update",
prompt: "Clear the cache and redisplay this RssFeed",
handler: function(place,macroName,params) {
var feedURL = params[0];
var tiddlerTitle = params[1];
createTiddlyButton(place, this.label, this.prompt,
function () {
if (config.macros.rssReader.cache[feedURL]) {
config.macros.rssReader.cache[feedURL] = null;
}
story.refreshTiddler(tiddlerTitle,null, true);
return false;});
}
};
//}}}
!There's lots of choice
* No ONE exercise works for EVERYONE - you may need to shop around
* No exercise is likely to WORK FIRST TIME - you will need to practice quite a few times before you "get it".
!Examples:
Here is one on PROGRESSIVE MUSCLE RELAXATION, a very well-researched technique (by Dr. Jaan Reitav):
<html><iframe width="480" height="360" src="https://www.youtube.com/embed/f7I2Upk5jqI?rel=0" frameborder="0" allowfullscreen></iframe></html>
Here's some talks/meditations on MINDFULNESS:
A Talk by Andy Puddicombe:
<html><iframe width="640" height="360" src="https://www.youtube.com/embed/qzR62JJCMBQ?rel=0" frameborder="0" allowfullscreen></iframe></html>
Here is a "mindfulness meditation" by Jon Kabatt-Zinn, focusing on boy awareness:
<html><iframe width="640" height="360" src="https://www.youtube.com/embed/4jmG3UFZGNU?rel=0" frameborder="0" allowfullscreen></iframe></html>
Here is another one, focusing on what you hear around you:
<html><iframe width="640" height="360" src="https://www.youtube.com/embed/qHBwwejuwDk?rel=0" frameborder="0" allowfullscreen></iframe></html>
<<activity show:reply show:notify>>
!Dickon's revalidation wiki
http://db-revalidation.tiddlyspace.com/ - mostly private stuff logging my activities and training-updates as a doctor for revalidation purposes.
index: backups
editor: /edit#{tiddler}//text%2fx-markdown
Welcome to your brand new TiddlySpace.
To get started with this blank [[TiddlySpace]], you'll need to modify the following tiddlers:
* If you don't like the color scheme click <<RandomColorPaletteButton>> to generate a new random color scheme.
* Upload a SiteIcon. A SiteIcon gives your space an identity to make it recognisable to others. A good site icon will be square and at least 48*48 pixels size.
<<binaryUploadPublic title:SiteIcon>>
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlySpace is opened
* Many features of TiddlySpace are accessed via the backstage bar located at the top of the page. You can toggle it on or off using the button in the top right corner of the screen.
<<newTiddler>><<closeAll>>
<<tabs
txtMainTab
"Recent" "Recently edited tiddlers" TabTimeline
"All" "All tiddlers" TabAll
"Public" "All public tiddlers" [[TiddlySpaceTabs##Public]]
"Private" "All private tiddlers" [[TiddlySpaceTabs##Private]]
"Drafts" "All draft tiddlers" [[TiddlySpaceTabs##Drafts]]
"Tags" "All tags" TabTags
"Spaces" "Tiddlers grouped by space" [[TiddlySpaceTabs##Spaces]]
"Activity" "What people you are following are up to" TabFollowing##Activity
"Following" "People you are following" TabFollowing##Following
"Followers" "People who are following you" TabFollowing##Followers
"Missing" "Missing tiddlers" TabMoreMissing
"Orphans" "Orphaned tiddlers" TabMoreOrphans
"Shadows" "Shadowed tiddlers" TabMoreShadowed
>>
The home space of Dr Dickon Bevington, Consultant in Child and Adolescent Psychiatry at Cambridge and Peterborough (NHS) Foundation Trust, and the Anna Freud Centre, and Fellow of the Collaboration for Leadership and Applied Research in Health and Social Care at Cambridge.
<html><a href="https://picasaweb.google.com/lh/photo/ghBF24kWpifZFQ3ZC5rRWR2aNUBBLLqAsHMVtr8eS-k?feat=embedwebsite"><img src="https://lh5.googleusercontent.com/-7UkGw4-9TMo/T2Pppt1fnQI/AAAAAAAAEFM/8nB6IE62h-8/s800/IMG_0003-1.JPG" height="156" width="250" /></a></html>
This tags a range of the spaces I am currently working on or in... by no means exhaustive, but others are more boring, half-built, or private.
As a general rule, I generally open a Space to help organise any project that I become involved with, with headings (tags) for people, aims, tasks, meetings, etc...
!The Onion
<<image [[OnionLayers]] width:300 height:180>>
* Feelings are like the layers on an onion - there are often OTHER feelings hidden underneath.
* We very rarely ONLY feel happy... There may also be a tiny bit of worry about //"How long will this feeling last?"// underneath.
* We rarely ONLY feel hungry - there may be anger, the wish to treat myself because nobody has noticed what I'm going through, worries, etc. that make this hunger seem stronger, etc, etc.
!Anger
* Who or what are you angry with?
* Are there things that being ANGRY helps you NOT to feel (feeling sad, feeling ashamed, feeling worried?)
* Anger can be a very POSITIVE emotion - if people didn't get angry about the bad things in life, they wouldn't have the energy to change them.
!Fear
* What or who are you fearful of?
* Fear is a natural and healthy feeling - in the right place, at the right volume. Are you fearful about the REALLY important things that threaten life and wellbeing, or about something else?
!Hunger
* Hungry for what?
* It may feel like you are hungry for food, but //maybe// you are hungry for the company of friends you can trust, for peace...?
* Hunger is a natural state, but it is easy to think ''"HUNGER - MUST EAT NOW!"'' when in fact your hunger is really only at 5/10 (not 10/10) - how good at measuring HOW hungry you are? ''Feeling hungry isn't bad for you - not eating enough calories is!''
* Maybe you ARE hungry because you are underweight, or because you skipped a meal, or just didn't eat enough
!Worry
* What are you worried about?
* Can you list ALL you worries on a piece of paper? Too many?! There are an infinite number of worries that we can worry about.
* Which worries would you advise a close friend to spend time sorting out, and which ones would you advise them to pass by?
!Sorry for Myself
* Working hard at something, and feeling Unrecognised, or Unappreciated can leave us feeling sorry for ourselves
* We are often taught not to be self-pitying, as though that is "spoilt" behaviour, or "attention-seeking"
* Having a binge, or taking drugs or alcohol, may be triggered by feeling //"Nobody else will notice me and what I have been through"// - is the real question //"How do I get better relationships with people I can trust, who will notice me? How do I get better at telling people when I need them, or a hug, etc?"//
!Learning and Expectations
* Riding any kind of waves is difficult - if takes real skill, and that doesn't arrive overnight.
* Coping with the kinds of waves of [[Craving]] (to binge, to use substances, etc) that bring people to these pages is something that will take a long time to master.
* Anyone who promises a quick fix is probably not telling the truth, but there is TONS of evidence that people can and do learn to cope, to ride their waves, very successfully.
<<image [[SteeringInStorm]] width:300 height:450>>
* You are probably reading these pages because you have been hit by some really massive waves, and are feeling a bit out of control.
* It is easy in these situations to ask ''//Why can't I do it like him, or her?//''
!Useful reminders:
* When you look at other people, remember that people (including you!) can't possibly __''know''__ what goes on deep inside each others' lives, they can only __''imagine''__. (Maybe that is a good thing, as if not there would be no privacy at all)
* Somebody may act as though they don't have a care in the world, or never get troubled by a [[Craving]], or [[Compulsion]] but we cannot know that other things in their life aren't a struggle for them.
* The waves that you are struggling with are not you, and they are not your fault
* There are lots of reasons WHY some people find themselves in these kinds of difficult waters, but for many there are no simple explanations. Sometimes it is just Bad Luck, and not fair. Sometimes there are more obvious explanations like bad experiences in the past, or stresses in the present, and if these are a big part of what keeps things being difficult then spending time to sort or come to undertand these things can be very important.
* It may be important to think about the ''"WHY?"'' question, but right now that may be less important than getting some control of the ''"WHAT TO DO NOW?"'' question.
!D.I.Y. - Top Tips on wave riding
* Lessons that come from your OWN EXPERIENCE are likely to be especially valuable
* This is really where you should try to record the lessons from previous waves that you've ridden..
** Successfully (//what worked?//)
** Unsuccessfully (//what went wrong?//) - Were there any useful [[Early Warning Signs]] that would be useful for next time?
* ''We __learn more from our mistakes than our successes!__''
* When you get to step [[4. Evaluate]] a lapse is a good opportunity; what is the lesson for next time.
!Resources
* Knowing how risky the territory is - see [[Early Warning Signs]] and [[Mapping the territory]]
* Knowing how strong the wave is - see step [[2. Analyze]]
* Knowing your [[WAVE Crisis Drill]] - the steps to take when a wave is hitting you
* Somewhere to RECORD your learning as a result of Step [[4. Evaluate]]
* A Friend or family member who can trust and who you can talk to about this stuff
* A therapist or worker who can help keep you on track and show you new ideas and skills
I will tag stuff i don't understand with this.
Could be a long list.
If it is short, it is just because the length of the list has overwhelmed me...
Have been trying to get the hang of the [[social discoursive aspects]] of this.
I am trying to understand about TiddlySpace.
There is [[Stuff I don't understand]] - or perhaps that bugs me.
I am also trying to understand how we might best make use of this for AMBIT (see @ambit), which is a [[Mentalizing]] treatment for complex vulnerable multiply-disadvantaged youth.
I am interested in the parallels between some of the features of [[How the human capacity for Mentalizing arises]] and how communication occurs - or might start to be able to occur - in ~TiddlySpace...
[[StyleSheetTiddlySpace]]
#displayArea {background-color: #cccc99; }
body {background-image: url(http://www.unsigneddesign.com/Grab%20Bag/33.jpg);
background-repeat: repeat; background-position: left; backgound-color: transparent; font-family: Helvetica;}
.viewer {
font-size: 1.5em;
font-family: Courier;
border-color: white;
padding: 10px 20px 10px 0px;
text-align: left;
vertical-align: top;
}
.tiddler {
border-top: 0.2em solid;
}
.tiddler {
border-bottom: 1.0em dotted;
}
/*{{{*/
.headerForeground {
position: relative;
padding: 2em 0em 1em 0em;
float: right;
top: 0;
margin-right: 5.3em;
background-color: [[ColorPalette::PrimaryMid]];
text-align: right;
}
.header {
width: 100%; /* for ie */
}
.clearFloat {
clear: both;
}
#contentWrapper {
position: relative;
padding-top: 1px;
top: -1px;
}
.header {
position: relative;
background-color: [[ColorPalette::PrimaryMid]];
}
.siteTitle {
clear: both;
display: block;
}
#sidebarSearch {
padding: 0.8em 1em 1em;
width: 10.5em;
margin: 0.6em 0.6em;
float: right;
position: relative;
}
#sidebarSearch .txtOptionInput {
width: 100%;
margin-top: 5px;
}
#sidebarSearch .searchButton {
padding: 0.2em;
color: [[ColorPalette::Background]];
}
/*}}}*/
/*{{{*/
#sidebar .wizard table {
margin: 0px;
}
#menuBar #sidebarOptions {
margin-right: 0.6em;
}
#sidebarTabs {
position: absolute;
right: 0;
top: 0;
width: 22.2em;
}
.tabset {
padding: 1em 6px 1px 0;
position: relative;
top: 2px;
}
#sidebarTabs .tabsetWrapper .tabset {
float: left;
height: auto;
display: inline;
width: 5.5em;
word-wrap: break-word;
top: 0;
padding: 0 0 1px;
}
#sidebarTabs .tabsetWrapper .tabsetWrapper .tabset {
float: none;
height: auto;
top: 1px;
padding: 0 0 1px;
}
.tab {
margin: 0.1em 0.25em 0 0;
padding: 6px 6px 0;
display: inline-block;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}
#sidebarTabs .tabsetWrapper .tabset .tab {
display: block;
margin: 0 0 1px 0.25em;
padding: 1em 6px 0.5em;
position: relative;
left: 3px;
border-right: 0;
border-bottom: 1px solid [[ColorPalette::TertiaryMid]];
border-color: [[ColorPalette::TertiaryMid]];
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
#sidebarTabs .tabsetWrapper .tabsetWrapper .tabset .tab {
margin: 0.1em 0.25em 0 0;
padding: 6px 6px 0;
display: inline-block;
border-right: 1px solid [[ColorPalette::TertiaryMid]];
border-bottom: 0;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}
.tabContents {
-webkit-border-top-right-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
-moz-border-radius-topright: 6px;
-moz-border-radius-bottomright: 6px;
-moz-border-radius-bottomleft: 6px;
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
}
#sidebarTabs .tabsetWrapper .tabContents {
display: inline;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
border-width: 1px 1px 1px 3px;
float: left;
border-color: [[ColorPalette::TertiaryMid]];
*height: expression(this.scrollHeight < 301? "300px" : "auto");
min-height: 25em;
background-color: [[ColorPalette::TertiaryPale]];
}
#sidebarTabs .tabsetWrapper .tabsetWrapper .tabContents {
border-width: 1px;
display: block;
float: none;
min-height: 0;
-webkit-border-top-right-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
-moz-border-radius-topright: 6px;
-moz-border-radius-bottomright: 6px;
-moz-border-radius-bottomleft: 6px;
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
}
/*}}}*/
/*{{{*/
body {
background: none;
font-family: "Helvetica Neue", Helvetica, Arial;
}
h1,
h2,
h3,
h4,
h5 {
color: black;
border-bottom: none;
}
.tiddler .toolbar a:hover,
.tiddler .toolbar a {
border: none;
background: none;
}
#sidebar {
position: relative !important;
width: 250px !important;
float: right;
margin: 0 0 25px 0;
}
#sidebar h1 {
padding: 0 0 3px 0;
font-size: 18px;
}
#sidebar li {
border-top: 1px dotted #CCC;
}
#sidebar li a {
font-size: 13px;
font-weight: normal;
padding: 2px 0 2px 15px;
display: block;
}
#contentWrapper {
width: 900px;
margin: 30px auto 140px;
padding: 30px 30px 0;
background: white;
background: rgba(255, 255, 255, 0.88);
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
.header {
float: left;
width: 900px;
border-bottom: 1px dotted #CCC;
margin: 0;
background: none;
}
.header h1 {
margin-top: 0px;
color: [[ColorPalette::PrimaryMid]];
font-size: 60px;
font-weight: 600;
text-decoration: none;
border-bottom: none;
letter-spacing: -2px;
text-rendering: optimizeLegibility;
background: none;
}
.header h2 {
font-size: 18px;
font-weight: 200;
padding: 12px 4px 0 0;
color: black;
border-bottom: none;
}
h1,
h2 {
text-decoration: none;
border-bottom: none;
}
#navBar {
float: right;
padding: 12px 0 0;
}
#navBar ul {
height: 50px;
margin-bottom: 2px;
list-style: none;
display: inline;
list-style-type: square;
}
#navBar ul li {
display: inline !important;
list-style: none;
}
#navBar li a {
font-size: 18px;
font-weight: 400;
display: inline-block !important;
padding: 15px;
border-bottom: none;
}
#navBar li a:hover {
color: #04B;
}
#tiddlerDisplay {
width: 900px;
float: left;
border-right: 1px dotted #CCC;
padding: 0 0 30px 0;
min-height: 420px;
overflow: hidden;
}
#displayArea {
margin: 0;
}
.title {
font-family: Georgia, serif;
font-size: 28px;
margin: 30px 0 10px 0;
font-weight: normal;
line-height: 32px;
border-bottom: 1px dotted black;
text-decoration: none;
color: black;
display: inline-block;
}
.subtitle {
font-size: 0.9em;
}
.subtitle ul,
.subtitle li {
display: inline;
padding-left: 0px;
}
.tiddler .viewer {
clear: both;
}
.wikifying {
background-image: url(/loading.gif);
width:50px;
height: 50px;
display: block;
text-indent: -999px;
background-repeat: no-repeat;
}
.sidebarOptions a {
display: inline-block;
padding: 8px;
}
.sidebarOptions {
padding: 8px;
text-align: right;
}
.searchbar {
text-align: right;
}
.searchbar .searchButton {
display: none;
}
/*}}}*/
!Followers
<<followers>>
!Activity
[[Replies and Notifications]]
<<activity>>
!Following
All spaces tagged follow
<<list filter [tag[follow]][sort[title]]>>
<<followSuggestions>>
|''"I don’t ask for your pity, but just for your understanding''|
|''– not even that – no.''|
|''Just for your recognition of me in you''|
|''and the enemy, time, in us all."''|
A Streetcar named Desire
Returning your call, dickontests...
Does this show up, now you are following me?
in reply to @dickon:
<<<
Ok, i have responded to your test post
<<<
Carla Sharp,, Heather Pane, Carolyn Ha, Amanda Venta, Amee B. Patel, Jennifer Sturek,, Peter Fonagy
Theory of Mind and Emotion Regulation Difficulties in Adolescents With Borderline Traits
Journal of the American Academy of Child & Adolescent Psychiatry, Volume 50, Issue 6 , Pages 563-573.e1, June 2011
http://www.jaacap.com/article/S0890-8567(11)00064-5/abstract
!Objective
Dysfunctions in both emotion regulation and social cognition (understanding behavior in mental state terms, theory of mind or mentalizing) have been proposed as explanations for disturbances of interpersonal behavior in borderline personality disorder (BPD). This study aimed to examine mentalizing in adolescents with emerging BPD from a dimensional and categorical point of view, controlling for gender, age, Axis I and Axis II symptoms, and to explore the mediating role of emotion regulation in the relation between theory of mind and borderline traits.
!Method
The newly developed Movie for the Assessment of Social Cognition (MASC) was administered alongside self-report measures of emotion regulation and psychopathology to 111 adolescent inpatients between the ages of 12 to 17 (mean age = 15.5 years; SD = 1.44 years). For categorical analyses borderline diagnosis was determined through semi-structured clinical interview, which showed that 23% of the sample met criteria for BPD.
!Results
Findings suggest a relationship between borderline traits and “hypermentalizing” (excessive, inaccurate mentalizing) independent of age, gender, externalizing, internalizing and psychopathy symptoms. The relation between hypermentalizing and BPD traits was partially mediated by difficulties in emotion regulation, accounting for 43.5% of the hypermentalizing to BPD path.
!Conclusions
Results suggest that in adolescents with borderline personality features the loss of mentalization is more apparent in the emergence of unusual alternative strategies (hypermentalizing) than in the loss of the capacity per se (no mentalizing or undermentalizing). Moreover, for the first time, empirical evidence is provided to support the notion that mentalizing exerts its influence on borderline traits through the mediating role of emotion dysregulation.
See the [[AMBIT manual|http://imp.peermore.com/imp/recipes/imp/tiddlers.wiki]] - this is a 4-step process to shape working interactions in an explicit effort to stimulate and sustain [[Mentalizing]] .
!The four steps are:
*Marking the Task
*Stating the Case
*Mentalizing the Moment
*Returning to Purpose
I would argue that there is relevance in aspects of this in TiddlySpace, if it is to be used as a space for meaningful communication...
As I try to learn my way around TiddlySpace, i wonder if the 'plumbing' of tiddlyweb/tiddlywiki perhaps more closely mimics what we might describe as a [[mentalized|Mentalizing]] conversation?
I think the notions of [[Trusted groups]], [[Inclusion]], and of [[Private and Public spaces]] make //explicit// things that are //implicit// in successful human conversation.
Re. Private spaces: A mentalizing practitioner takes it as absolutely axiomatic that we //cannot read minds// (completely the opposite of [[that irritating american crime series called 'The Mentalist']]), but we can (and try to be) curious and inquisitive about the content of what we do see and hear (or read).
So the way that 'following' allows me to compare another person's (public) thoughts under the same title as mine mirrors this process; it slows down the rush to publish a conversation as if it is 'signed off'.
If it works, then the exchange, adaptation, and co-construction implicit in tiddlyspace will be much closer to live conversation, as people circle around themes, visiting, revisiting, clarifying... much as we refer to the process of //'mentalizing the moment'.//
We use our 'four-step' conversation as a ritual, to deliberately slow down key interactions between team members working with high risk youth, in order to make room for this mentalizing (which often gets left out, especially if anxiety is high.)
What about the return to purpose? Well, that is the point of the interaction, but too often in our interactions we don't define it in the first place!
/***
|''Name''|TiddlerEditablePlugin|
|''Description''|Any elements with a tiddler attribute set and a class tiddlerEditable will allow in place editing|
|''Version''|0.3.5|
***/
//{{{
(function($) {
var extension = config.extensions.tiddlerEditable = {
init: function() {
if(readOnly) {
return;
}
$(".tiddlerEditable, .tiddlerEditable").attr("title", "Double click on this to edit.").dblclick(function(ev) {
var target = ev.target;
var title = $(target).attr("tiddler");
if(!title) {
title = $("[tiddler]", target).attr("tiddler");
tidEl = $("[tiddler]", target)[0];
} else {
tidEl = target;
}
if(!title) {
return;
}
var tiddler = store.getTiddler(title);
var type = tiddler && tiddler.fields['server.content-type'] ? tiddler.fields['server.content-type'] : false;
$(tidEl).empty();
var binary;
if(type && type.indexOf("text/") !== 0) {
binary = true;
}
if(!binary) {
$("<textarea />").focus(function(ev) {
$(ev.target).data("dirty", true);
}).val(store.getTiddlerText(title)).appendTo(target);
} else {
wikify("<<binaryUploadPublic title:\"%0\">>".format(title), tidEl)
}
ev.preventDefault();
return false;
}).mouseover(function(ev) {
$(ev.target).addClass("hover")
}).mouseout(function(ev) {
$(ev.target).removeClass("hover")
});
}
};
$(window).click(function(ev) {
var tag = ev.target.tagName;
if(tag == "TEXTAREA" || tag == "FORM" || tag == "INPUT") {
return;
} else {
var tiddlers = [];
var textareas = $(".tiddlerEditable textarea");
textareas.each(function(i, el) {
var val = $(el).val();
var c = el.parentNode;
var title = $(c).attr("tiddler");
var tiddler = store.getTiddler(title);
if($(el).data("dirty")) {
tiddler.text = val;
if(config.filterHelpers) {
var is = config.filterHelpers.is;
if(is && !is.local(tiddler)) {
delete tiddler.fields['server.etag'];
delete tiddler.fields['server.bag'];
delete tiddler.fields['server.page.revision'];
merge(tiddler.fields, config.defaultCustomFields);
}
}
tiddler = store.saveTiddler(tiddler);
tiddlers.push(tiddler);
} else {
$(c).empty();
wikify(tiddler.text, c, null, tiddler);
}
});
var forms = $(".tiddlerEditable form");
if(forms.length > 0) {
refreshDisplay();
}
if(tiddlers.length > 0) {
autoSaveChanges(null, tiddlers);
}
}
});
_refreshPageTemplate = refreshPageTemplate;
refreshPageTemplate = function() {
_refreshPageTemplate.apply(this, arguments);
extension.init();
}
_refreshDisplay = refreshDisplay;
refreshDisplay = function() {
_refreshDisplay.apply(this, arguments);
extension.init();
}
var r = config.macros.image._renderBinaryImageTiddler;
config.macros.image._renderBinaryImageTiddler = function(place, tiddler) {
$(place).attr("tiddler", tiddler.title);
return r.apply(this, arguments);
}
window.setTimeout(function() {
extension.init();
}, 1000);
})(jQuery);
//}}}
!@tiddlymanuals
This is the 'signpost' to all tiddlymanuals, although two are referred to below.
The URL:
!@@color(red):WWW.TIDDLYMANUALS.COM@@ points at it.
It includes a sort of blog about the progress of the ambit and mbtf manualizations (News for Users), though there is another [[Blog]] as well. Accessible via @tiddlymanuals (among others) are:
!@ambit
The 'core template' AMBIT manual); its local variations are accessible via @tiddlymanuals.
!@ambit-install
Where local teams can set up their own locally-"customisable" version of the AMBIT manual. (Teams that have done this and which are trained in AMBIT have their local versions listed at @tiddlymanuals, and are able to cross-compare and share their developing best practice.)
!@ambit-casus
The local adaptation of AMBIT for the NHS team I work with in Cambridgeshire and a growing number of other local adaptations.
!@mbtf
Mentalization-based treatment for families.
Stuff to do with the wider TiddlySpace Community
Above all, at present, I think that this site @dickon is about me working out quite what this ~TiddlySpace thing is all about and what it can do. I have some ideas, but I am trying to compare the ideas I have had in my head about it, from discussions with the people making it, to what I actually experience now I am here, and what I can do with ~TiddlySpace in real life.
[[On having an empty TiddlySpace tiddler]]
As a beginner (and I have received feedback from other first time users to this effect too) if you click on a link to ~TiddlySpace and find that "the tiddler ~TiddlySpace does not exist yet" this gives the impression of ''unfinished-ness''.
...it strikes the user as odd, and faintly irritating... //"So you've invited me here to look around this ~TiddlySpace place, and you don't have a definition of what it is?!"//
Of course you don't open a book, and expect to find a defintion of what a book is inside it, you just want to get to the point - to read it; but people don't necessarily have so much understanding of TW and ~TiddlySpace... there are things that are pretty familiar, and things that are pretty strange.
Is there a case for this specific Tiddler to be pre-populated (as a shadow tiddler), that a user could subsequently rewrite to taste...?
>"This a preformed //tiddler//, the basic building block of a //tiddlywiki//, which is what you are reading right now. Tiddlywiki and tiddlyspace offer a new way of organising and connecting ideas and communicating, and Tiddlyspace is a way for people to organise their thoughts (tiddlers) so that they are clear which are private and which are public, and to collaborate with others to refine content. You can learn more about this open source resource from....
...Or something like that...
Just a thought, and there are probably many reasons why this wouldn't work...
Obviously, the point of tiddlywiki/space is that the user makes of it what s/he will, but...
>''In reply to TiddlySpace@bauwebijl'' - Yes you are right, of course... TiddlyWiki just does what it is designed to do! I do use the {{{~}}} quite a bit in the AMBIT manual, to remove WikiLinks where they would add to what I would describe as the //"centrifugal"// effects of the format on the reader (good when you want him or her to read //widely// and cover ground, less good when you want them to grasp one area //in depth//)
>It might be interesting to compare a number of different attempts made by people to define succinctly what is TiddlySpace - which I guess is one of the strengths of TiddlySpace, as each person's Space contains their own definition; either a blank, one they have authored, or one they have chosen to include from another space.
!Go to http://tiddlyspace.com
There you can register as a TiddlySpace user and get your own spaces started
/***
|''Name''|TiddlySpaceFollowingSuggestions|
|''Version''|0.2.5dev|
|''Description''|Provides a following macro|
|''Author''|Jon Robson|
|''Requires''|TiddlySpaceFollowingPlugin|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
!Usage
!Code
***/
//{{{
(function($) {
var tweb = config.extensions.tiddlyweb;
var tiddlyspace = config.extensions.tiddlyspace;
var followMacro = config.macros.followTiddlers;
var followSuggestions = config.macros.followSuggestions = {
cache: {},
handler: function(place, macroName, params) {
// to do - limit results
place = $('<div class="suggestions" />').appendTo(place)[0];
var currentSpace = tiddlyspace.currentSpace.name;
var user = params[0] || currentSpace;
var pleaseWait = $("<div class='loading' />").text("please wait..").appendTo(place);
tweb.getUserInfo(function(activeUser) {
if(activeUser.name != tiddlyspace.currentSpace.name) {
pleaseWait.hide();
return;
}
followMacro.getFollowers(function(users) {
// suggestions are followers of people that you follow that you don't follow
var bags = followMacro._getFollowerBags(users);
var _bags = [];
for(var i = 0; i < bags.length; i++) {
_bags.push("bag:%0".format([bags[i]]));
}
var bagString = _bags.join(" OR ");
ajaxReq({
beforeSend: followMacro.beforeSend,
url: "/search?q=(%0)&select=title:!%1&select=title:!@%1".format([bagString, activeUser.name]),
dataType: "json",
success: function(tiddlers) {
pleaseWait.hide();
var suggestions = [];
for(var i = 0; i < tiddlers.length; i++) {
var tiddler = tiddlers[i];
if(tiddler.tags.contains("follow")) {
var title = tiddler.title;
if(title.indexOf("@") === 0) {
title = title.substr(1);
}
if(!users.contains(title)) {
suggestions.pushUnique(title);
}
}
}
$(place).append("<div>suggestions:</div>");
var suggestionArea = $("<div class='suggestionArea' />").appendTo(place)[0];
var id = "more_%0".format([Math.random()]);
var more = $("<div class='moreButton' />").text("more...").appendTo(place).attr("id", id);
followSuggestions.cache[id] = suggestions;
var limit = suggestions.length;
more.click(function(ev) {
var suggestions = config.macros.followSuggestions.cache[id];
var newSuggestions = followSuggestions.suggest(place, suggestions, limit);
config.macros.followSuggestions.cache[id] = newSuggestions;
});
followSuggestions.suggest(place, suggestions, limit);
}
});
}, user);
});
},
randomize: function(a, b) {
if(Math.random() < Math.random()) {
return -1;
} else {
return 1;
}
},
suggest: function(place, suggestions, limit) {
var currentSpace = tiddlyspace.currentSpace.name;
suggestions = suggestions.sort(followSuggestions.randomize);
var suggestionsArea = $(".suggestionArea", place)[0];
if(suggestions.length === 0) {
$("<span />").text("no suggestions..").appendTo(suggestionsArea);
return;
}
limit = limit < suggestions.length ? limit : suggestions.length;
for(var j = 0; j < limit; j++) {
var link = $("<span />").appendTo(suggestionsArea)[0];
var title = suggestions[j];
var newTiddler = '@%0 <<newTiddler title:"@%0" fields:"server.workspace:bags/%1_public" tag:follow label:"follow">>\n'.format([title, currentSpace]);
wikify(newTiddler, link);
}
var newSuggestions = suggestions.slice(limit, suggestions.length);
var more = $(".moreButton", place);
if(newSuggestions.length == 0) {
more.remove();
}
return newSuggestions;
}
};
})(jQuery);
//}}}
/***
|''Name''|TiddlySpaceFollowingWizard|
|''Version''|0.7.0|
|''Description''|Provides a following wizard macro and deleteButton view type|
|''Author''|Jon Robson|
|''Requires''|TiddlySpaceConfig TiddlySpaceFollowingPlugin TiddlySpaceTiddlerIconsPlugin|
|''License''|[[BSD|http://www.opensource.org/licenses/bsd-license.php]]|
!Usage
{{{ <<followWizard>> }}}
!StyleSheet
.followWizard ul,
.followWizard li .siteIcon,
.followWizard li {
list-style: none;
display: inline-block;
}
.followWizard li {
margin-right: 8px;
background-color: #eee;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
padding: 4px;
}
!Code
***/
//{{{
(function($) {
var tweb = config.extensions.tiddlyweb;
var tiddlyspace = config.extensions.tiddlyspace;
var currentSpace = tiddlyspace.currentSpace.name;
var shadows = config.shadowTiddlers;
shadows.FollowersTemplate = "<<view server.bag SiteIcon width:24 height:24 spaceLink:yes label:no>> <<view server.bag spaceLink>>";
shadows.FollowingTemplate = "<<view title SiteIcon width:24 height:24 spaceLink:yes label:no>> <<view title spaceLink>> <<view title deleteButton>>";
var name = "StyleSheetFollowingWizard";
shadows[name] = "/*{{{*/\n%0\n/*}}}*/".
format(store.getTiddlerText(tiddler.title + "##StyleSheet"));
store.addNotification(name, refreshStyles);
var wizard = config.macros.followWizard = {
locale: {
mission: "Which user or space would you like to follow?",
badpermissions: "Only members of the space can maintain followers.",
follow: "follow"
},
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
var locale = wizard.locale;
var container = $("<div />").addClass("followWizard").appendTo(place)[0];
if(!readOnly) {
var form = $("<form />").addClass("followForm").appendTo(container)[0];
$("<span />").text(locale.mission).appendTo(form);
var input = $("<input />").attr("name", "space").attr("type", "text").appendTo(form);
$("<input />").attr("type", "submit").val(locale.follow).appendTo(form).click(function(ev) {
wizard.addFollowing(ev, input.val());
ev.preventDefault();
});
} else {
$(container).addClass("annotation").text(locale.badpermissions);
}
},
addFollowing: function(ev, space) {
var name = tiddlyspace.resolveSpaceName(space);
if(!name) {
alert("That doesn't appear to be a valid space name. Please check and try again.");
return;
}
var title = "@" + name;
var tiddler = store.getTiddler(title);
if(tiddler) {
tiddler.tags.push("follow");
} else {
tiddler = new Tiddler(title);
tiddler.tags.push("follow");
merge(tiddler.fields, config.defaultCustomFields);
}
store.saveTiddler(tiddler);
autoSaveChanges();
}
};
config.macros.view.views.deleteButton = function(value,place,params,wikifier,paramString,tiddler) {
var tid = store.getTiddler(value)
if(tid && config.commands.deleteTiddler.isEnabled(tid)) {
var handler = function(ev) {
config.commands.deleteTiddler.handler(ev,ev.target,value);
};
createTiddlyButton(place, "X", "delete this tiddler", handler);
}
};
})(jQuery);
//}}}
in reply to @cdent and @jrbl
<<<
This tiddler started out as my own thoughts about the meaning of TiddlySpace, as in "What's it for?" Since then some of those thoughts have been capture in TiddlySpaceIdentity@tiddlyspace in @tiddlyspace, using quotes pulled from various sources to identify what we who are making TiddlySpace have had to say about what it is. I think that has helped to identify some of the things that matter, but it also seems like there is a gap between what is being built and what we think we are building.
That's probably the nature of iterative software development, but deserves some attention.
I've written some related thoughts in [[Stocks and Flows]], [[One Tiddler]], [[IBOC]] and [[The Unix Way and I]] but in here I want to explain what I want to be creating with things Tiddly*.
As [[presented in my talk on Manifestopheles|http://peermore.com/present/mft.html]], knowledge is a personal affair. Knowledge can only be inside someone's head. As soon as it leaves the head, is communicated or made into an artifact, it becomes information. When a person learns they incorporate communications and artifacts into their brain, contextualizing information, creating new knowledge.
When a group collaborates, they are working toward a shared goal. If the goal is challenging or unique they will need new knowledge in order to get things done. The group acquires this new knowledge not by sharing knowledge around, that can't be done. Instead they share information, providing opportunities for the participants to gain new knowledge if they are able to access and then contextualize the information.
In a fundamental way the primary purpose of a modern personal computer is to provide access to information and let us arrange it in ways that allow us to contextualize it through reference and comparison and thus make use of it in some way. Software tools, like wikis, augment our innate abilities to compare, contrast and relate information. Research is think on the ground that shows that wikis, in the right conditions, can help a team reify and clarify their shared information into something that looks remarkably like team knowledge.
Hypertext is a great tool for comparing, contrasting and relating. We put things side by side, see how they fit, see how they differ and make conclusions: learn things; //become knowledgeable//. Because hypertext works by reference, we are able to access, traverse and cite vast quantities of information.
Sometimes, though, those references are insufficiently granular. A traditional URI on the web refers to an entire document or resource, not just the part which is relevant as a reference or contextualizer.
In PurpleWiki, and now with TiddlyWeb, my goal is to allow granular access, by reference, to small chunks of content, the exact pieces that matter. In PurpleWiki we called it a node, in TiddlyWiki it is called a Tiddler. Purple broke existing documents down into addressable nodes, while TiddlyWiki builds up documents from tiddlers. TiddlyWeb makes tiddlers first class members of the web. In either case, node or tiddler, the chunk can be referenced and used directly to create larger wholes and support networks of referential information.
TiddlySpace adds to this milieu by respecting and engaging the individual in the collaborative process. Rather than group members working on the same artifacts, they share individual artifacts which are easily compared. Through this sharing they have the opportunity to a) expose their information to feedback b) evolve their information as a result of the feedback.
One of the ways in which we learn, usually learning the most important stuff, is in seeing how our ideas differ from the ideas of those around us. The gaps, conflicts and differences of opinion pave the path to enlightenment. By preserving the individual point of view, we can see the differences and learn from them. If we wash out the individual perspective in a neutral point of view we may act as a useful reference but not one that is particularly generative. We need thesis and antithesis to bring about synthesis, to bring about new learnings.
So, to me: Tiddlers are a tool for people to gather their individual thoughts in small chunks. TiddlyWeb is a tool to make those thoughts accessible in a network. TiddlySpace is a tool to compare thoughts with others, and learn more.
If we want to make those comparisons effective then we must preserve the accessibility and identity of the tiddler.
If we aren't trying to create new learnings, then why bother?
//Incomplete...//
<<<
This is very interesting and I think nails something of what is going on in ~TiddlySpace at present. Group psychologists have referred to phases that any human grouping goes through in its life cycle: ''[[Forming, Storming and Norming]]''. Seems to me that an enormous amount of work has gone into Forming the architecture that makes up tiddlyspace, and that the community is just now beginning to //Storm// - ie engage in productive (we hope and trust!) debate about "what are we here to DO?!"
*I like Chris' emphasis on the primacy of the tiddler (microcontent).
*The key to writing good tiddlywiki seems to me to be about getting the right balance between the ''centripetal'' (keeping it tight, single theme, bitesize) and the ''centrifugal'' (offering the right links out to wider structures, context, etc).
*I am wary of too much emphasis in turning this into another social networking engine - it is about social networking, yes absolutely, but it is mostly about co-construction, and focussed attention to //tasks// (clarifying, building on, ideas and linked information), rather than a chat-enabler, in my book.
*I think that some of this will come clearer as groups emerge within TiddlySpace who are doing this kind of //task-oriented work// - which is separate to the work of constructing ~TiddlySpace itself.
**By the way, when I refer to tasks, I am not saying that the task couldn't be an artistic one
** just as much as @ambit is trying to get a conversation going between teams of people doing 'street level therapy' with vulnerable youth, about the best way to proceed.
/***
|''Name:''|TiddlySpaceIntraSpaceInclusion|
|''Description:''|Provides support for {{{<<tiddler Foo@bar>>}}} and {{{<<tiddler [[Foo]]@bar>>}}}|
|''Author:''|Jon Robson|
|''Source:''|https://github.com/jdlrobson/TiddlyWikiPlugins/raw/master/plugins/TiddlySpaceIntraSpaceInclusion/TiddlySpaceIntraSpaceInclusion.js|
|''Version:''|0.3.8a|
|''License:''|[[BSD License|http://www.opensource.org/licenses/bsd-license.php]] |
|''Comments:''|Please make comments at http://groups.google.co.uk/group/TiddlyWikiDev |
|''~CoreVersion:''|2.4|
***/
//{{{
(function() {
var _tidtext = TiddlyWiki.prototype.getTiddlerText;
var cache = {};
// allmost the same regExp as in TiddlySpaceLinkPlugin but .. no "mg" parameter, because it didn't work for this usecase.
config.textPrimitives.spacenameLinkRegExp = new RegExp(config.textPrimitives.unWikiLink +
"?(" + config.textPrimitives.bareTiddlerLetter + "*)@(" + config.textPrimitives.spaceName + ")", "");
config.textPrimitives.tiddlyLinkSpacenameLinkRegExp = new RegExp("\\[\\[(.*?)(?:\\|(.*?))?\\]\\]@(" + config.textPrimitives.spaceName + ")", "");
TiddlyWiki.prototype.getTiddlerText = function(title, defaultText) {
var ct = config.textPrimitives;
var match = ct.spacenameLinkRegExp.exec(title); // foo@bar
var match2 = ct.tiddlyLinkSpacenameLinkRegExp.exec(title); // [[foo]]@bar
if(match || match2) {
// console.log('inner: ', 'spacename: ', match, 'tiddlyLink: ', match2, 'place: ');
var tidtitle, space;
if(match[1] && match.length === 3) {
tidtitle = match[1];
space = match[2];
} else if(match2 && match2.length === 4) {
tidtitle = match2[1];
space = match2[3];
}
var newtitle = tidtitle + "@" + space;
if(tidtitle && space) {
title = newtitle;
}
if(tidtitle && space && !store.getTiddler(newtitle)) {
var tiddler = new Tiddler(title);
// get the tiddler, where the macro is rendered. //XXX will need more testing
var el = story.findContainingTiddler(place);
var refreshTitle = (el) ? el.getAttribute('tiddler') : null;
tiddler.text = "//retrieving from server//";
tiddler.fields.doNotSave = "true";
tiddler.tags = ["excludeLists", "excludeSearch", "excludeMissing"];
merge(tiddler.fields, config.defaultCustomFields);
tiddler.fields["server.bag"] = space + "_public";
tiddler = store.addTiddler(tiddler);
ajaxReq({ url: "/bags/" + space + "_public/tiddlers/" + tidtitle,
dataType: "json",
success: function(tid) {
var tiddler = store.getTiddler(title);
tiddler.text = tid.text;
store.addTiddler(tiddler);
// store.notify(title,true);
story.refreshTiddler(refreshTitle,null,true);
// story.refreshAllTiddlers(); // hacky but above link doesn't always seem to work!
},
error: function() {
var tiddler = store.getTiddler(title);
tiddler.text = "//error retrieving tiddler {{{" + title + "}}} from space @" + space + "//";
store.addTiddler(tiddler);
// store.notify(title,true);
story.refreshTiddler(refreshTitle,null,true);
// story.refreshAllTiddlers(); // hacky but above link doesn't always seem to work!
}
});
}
}
return _tidtext.apply(this, [title, defaultText]);
}
})();
//}}}
!http://tiddlywiki.com
Hadn't visited for quite a while - what a helpful site it is. Where TW all started from...
See also the extremely helpful [[Google Group for TiddlyWiki|https://groups.google.com/forum/?fromgroups#!forum/tiddlywiki]]
A loose collections of other peoples' plugins and stuff that I find I regularly use, and from where I can grab them and be reminded how to get them to work.
!@dickonstiddlywikitips
|~ViewToolbar|+editTiddler +cloneTiddler changeToPublic changeToPrivate > fields revisions permalink closeOthers < closeTiddler|
|~EditToolbar|+saveTiddler saveDraft -cancelTiddler deleteTiddler|
|~RevisionToolbar|> fields revert|
When Troy said yes to that sly missive
My guess is it slipped in, alongside other post;
Package; attachment; policy; list; RSVP;
Protocol; update; flag; alert; an inbox
In their agora, overflowing. Did it seem
As a big river does, after gathering all the
Upstream spate? A fat brown slick, rolling,
Lazily grinding debris, bric-a-brac, submerged
Shopping trolleys, builders' planks, a child's
Toy, and here, the body of a cardboard horse?
Of course they had no idea what from there
Might burst, just an ache for simple days
Of doing right.
© Dickon Bevington 2013
<<tag RSSFeed>>
#Upload [[proxy.php]] to your site
#Edit and Upload [[allowedsites.txt]]
#Verify your installation. From your tiddlywiki accessed over HTTP go to :
##[[proxy.php?help|proxy.php?help]]
##[[proxy.php?list|proxy.php?list]]
##[[proxy.php?url=http://www.tiddlywiki.com/|proxy.php?url=http://www.tiddlywiki.com/]]
<<binaryUpload edit:title>>
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]] more:popup'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'>posted: <span macro='view modified date'></span> | author: <span macro='view modifier spaceLink'></span> | space: <span macro='view server.bag spaceLink'></span> | tagged with: <span macro='tags'></span> | tagging: <span class='tagging' macro='tagging'></span></div>
<div class='viewer' macro='view text _wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
|bgcolor(lightblue): Welcome to ''__<<tag WAVE>>__''. <br>This is an approach to Coping.<br> You are on the introduction page. You can scroll down<br> to read more, or click the little triangle to see the key chapters |
||
|bgcolor(lightgray): <<image [[HokusaiWave]] width:600 height:400>><br> |
* A wave hits you, that wave passes.
* No wave ever just //keeps on building//, or //arrives and never leaves//. Ever!
!!!''Cravings, Compulsions and strong Feelings are all waves''
* It is the just the same with a [[Craving]], the urge to act on a [[Compulsion]], or any powerful feelings ([[States of Mind]]), like anger, fear, etc.
* All of these [[States of Mind]] come ''and then they go''.
* ''When you are unable to wait the wave out'', you remain under its control.
!!!''Learning how to //ride the waves//''
* This starts with finding ways to hold on and wait for it to pass (see (d) below - the [[WAVE Crisis Drill]]).
* Then you want to gain confidence and skills so that you can:
''(a) Know the places, times, situations where waves are most likely to hit''
|bgcolor(lightblue): <br><<image [[HokusaiWave]] width:600 height:100>><br> |
|bgcolor(lightblue): [[Mapping the territory]] |
''(b) Spot waves approaching before they hit you''
|bgcolor(lightblue): <br><<image [[HokusaiWave]] width:600 height:100>><br> |
|bgcolor(lightblue): [[Early Warning Signs]] |
''(c) Take avoiding action early to miss the wave, or avoid getting hit so hard''
|bgcolor(lightblue): <br><<image [[HokusaiWave]] width:600 height:100>><br> |
|bgcolor(lightblue): [[Steering in stormy waters]] |
''(d) [[WAVE Crisis Drill]]: coping when waves hit''
|bgcolor(lightblue): <br><<image [[HokusaiWave]] width:600 height:100>><br> |
|bgcolor(lightblue): ''@@color(blue):__W__ - @@[[1. Wait]]''<br>''@@color(blue):__A__ - [[2. Analyze]]@@''<br>''@@color(blue):__V__ - [[3. Volunteer]]@@''<br>''@@color(blue):__E__ - [[4. Evaluate]]@@''<br> |
|bgcolor(lightblue): <br><<image [[HokusaiWave]] width:600 height:100>><br> |
|bgcolor(lightblue): ''@@color(blue):__W__ - @@[[1. Wait]]''<br>''@@color(blue):__A__ - [[2. Analyze]]@@''<br>''@@color(blue):__V__ - [[3. Volunteer]]@@''<br>''@@color(blue):__E__ - [[4. Evaluate]]@@''<br> |
see @sib-treatments-literature and @sud-treatments-literature
Co authoring the second edition of this book (Guilford are publishing - due out in late 2012 or 2013) - a massive task. Other authors are Peter Fonagy, David Cottrell, Danya Glaser and Jeannette Phillips.
I am doing the chapters on self injurious behaviour and substance use disorders (see [[Academic (Literature review) Notes]])
I am not sure, still, how this works. In order to "Reply to Tiddler" I seem to have to go back into my tiddlySpace (@dickon), and open up the tiddler with the same title, and then type in it. Seems a bit clumsy - I am missing something?
>I need to check what this 'reply to' button does. Where is the reply posted?
>
>D.
See:
http://www.infed.org/biblio/communities_of_practice.htm - good introductory essay
http://www.ewenger.com/theory/ - by Etienne Wenger himself
It was the fact that it was a //document//, but that it had certain aspects that seemed extraordinarily "three-dimensional": pages (tiddlers) have //depth// insofar as each chunk of content that you write has what I think of as both //centrifugal// force (stimulating interest to go and explore links and tags that offered related material) balanced by //centripetal// force (the intrinsic interest of what is here on this page/tiddler, that holds my attention and delivers what I want/need.)
But more than that, TiddlyWiki has EDGES; this is like other documents I know about (chiefly paper based), and is reassuring in relation to the scary 'anarchy of limitlessness' that, say, Wikipedia has. As a TW could be a thing - downloaded, uploaded - so it was a //definable entity//; there could be a balance of authorial control with the wiki-like sharing and co-construction.
I was writing a large treatment manual at the time (with a great group of co-authors based around the [[Anna Freud Centre|http://annafreud.org]]) at the time, and we were trying to integrate a whole range of "schools" of thinking and practising into a concentrated, integrated set of principles and practices that could 'steer' workers in the field towards more effective practice in doing therapy with some of the most vulnerable, complex, troubled youth around. The "eureka" moment (and it was something like that) was the recognition of a number of things almost simultaneously:
!'Integrative' format
1. That the way to mount all this information was in a TiddlyWiki: this format could emphasise underlying links/commonalities/shared concepts between disparate schools (that had often, in my view, wasted precious energy on "turf wars"... this seemed to me to be a radically //integrative format//, insofar as any tiddler that I wrote automatically begged the questions: //"How does my content fit in with the rest of what is written? How are you going to tag me? What links are you going to place in me, and to me?"//
!Funkier than a book
2. The format (with its promise of embedded video, downloadable documents, clickable links...) offered a much more tempting "front door" to what is conventionally a massively boring kind of book. (Research demonstrates that the "treatment manual" is frequently despised by therapists, who find them rigid, condescending, crushing of creativity and spontaneity, and often ill-fitting to their local setting and cultural context.) Most treatment manuals are not inviting to the casual browser!
!Open source works for therapy, too
3. The whole "open source" ethos that Tiddlywiki abounds with, absolutely fitted with the slant on human behaviour/psychology that we were using as the "integrating principle" in our treatment approach, which is "[[Mentalization]]". The motto of open source programmers ("Release Early, Release Often") fits the mentalization-based therapist's assumption that "I only see with partial vision" and his or her willingness to mark their //best guesses// as just that - hypotheses, to be built on and improved...
!Multiple iterations around a developing shared core
4. The final "Bingo!" moment was the realisation that with TiddlyWiki it was possible to conceive of multiple locally-adapted versions of a centrally-curated 'basic core' offering. Thus local teams (the "small trusted groups" that TiddlySpace refers to) can work out //place- and population-specific iterations// of "Practice-based Evidence" - that fit the more rarefied/less 'attuned' "Evidence-based Practice" into //local settings, local populations//. I think of it as being like adapting a basic car for use in different parts of the world - some places need air-con, others need 4 wheel drive and a good in-cabin heater, still others need an excellent paint job, etc... but all rely on a basic car that basically runs.
With the development of TiddlyWeb and TiddlySpace this vision (no. 4 above) has become increasingly possible, so that now the @ambit core manual is //''included''// in the local versions of just under 20 teams across the UK (see @tiddlymanuals and follow the links for AMBIT), working with diverse populations, and in diverse ways, with "hard to reach" young people.
These teams are beginning to build their own locally-attuned versions of a treatment manual, building on (and often improving on) the ambit 'core'. As time goes on, and evidence is gathered about what works for whom, we hope to bring excellent local adaptations that would have more general relevance into the core, so that they are automatically available to all other local teams including this core.
Wikis for note-taking -
!Mental Health Act (England) - @mha
I like taking lecture notes in TW's, as it forces you to categorise and file information (tagging) in more or less sensible ways - whcih means you are PROCESSING the information you take in as you go.
For instance, see @mha for notes on the role of Section 12 'approved doctor' in relation some training I had on the MHA and MCA - these are only working notes, my memos, and are NOT designed or released as any kind of authoritative general reference.
- @therapeutic-journal
This provides blank (downloadable) proforma for a journal designed to be co-authored by a young person and their keyworker, or therapist...
Obviously you'd want to download a copy before you did that and store it on a USB stick that could be kept safe.
- @quittingstuff
This is in development - a generic downloadable/includable space to act as a workbook for someone trying to quit something. As It gets built it will be building on evidence-based components of practice such as Motivational work, CBT, Mentalization based work. At its heart is the hope that for some the wiki format will add to the stimulation of curiosity about //"how I came to be in this place"// and //"how I might make steps out of it"//
Stuff I am writing gets tagged with this.
<<tag Writing>>
<!DOCTYPE HTML>
<html>
<body style="display:none">
topics: <ul id="topics"></ul>
<button id='addtopic'>add topic</button>
stream:
<ul id="stream"></ul>
<script type='text/javascript' src='/bags/common/tiddlers/jquery.js'></script>
<script type='text/javascript' src='/bags/tiddlyspace/tiddlers/chrjs'></script>
<script src="/twikifier.js" type="text/javascript" charset="utf-8"></script>
<script type='text/javascript'>
$.ajaxSetup({
beforeSend: function(xhr) {
xhr.setRequestHeader("X-ControlView", "false");
}
});
function renderTopic(topic) {
var item = $("<li />").appendTo("#topics");
$("<button class='show' />").text(topic).appendTo(item);
$("<button class='delete'>x</button>").appendTo(item);
return item[0];
}
var host = '/';
var space = "jon";
var active_topics = [];
var current_topic, offset;
function renderTopics() {
var topics = active_topics;
$("#topics").empty();
for(var i = 0; i < topics.length; i++) {
var topic = topics[i];
if(topic) {
renderTopic(topic);
}
}
$("body").show();
}
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
var topicList = new tiddlyweb.Tiddler("Topics", new tiddlyweb.Bag(space + "_public", host));
topicList.get(function(tid) {
active_topics = tid.text.split("\n");
renderTopics(active_topics);
$("#topics .show:first").trigger("click");
},
function() {
active_topics = ["tiddlyspace"];
renderTopics(active_topics)
}
);
$("#addtopic").click(function(ev) {
var text = prompt("What topic would you like to watch?");
if(active_topics.indexOf(text) === -1) {
active_topics.push(text);
}
var el = renderTopic(text);
topicList.text = active_topics.join("\n");
topicList.put(function() {
$("button.show", el).trigger("click");
}, function() {
alert("eek!")
});
});
$("#topics .delete").live("click",function(ev) {
var topic = $(".show", this.parentNode).text();
active_topics.remove(active_topics.indexOf(topic));
renderTopics();
topicList.text = active_topics.join("\n");
topicList.put(function() {}, function() {
alert("eek!")
});
});
w = createWikifier(window, jQuery, { host: host, container: "recipes/" + space + "_public" });
$("#topics .show").live("click",function(ev) {
var tag = $(this).text();
current_topic = tag;
offset = 0;
$("#stream").empty();
var search = new tiddlyweb.Search('tag:"' + tag + '" &fat=y', host);
search.get(function(tiddlers) {
for(var i = 0; i < tiddlers.length; i++) {
var tiddler = tiddlers[i];
var item = $("<li />").appendTo("#stream")[0];
$("<h2 />").text(tiddler.title + ": ").appendTo(item);
$("<div class='text' />").text(tiddler.text).appendTo(item);
$("<div class='author' />").text(tiddler.modifier).appendTo(item);
}
}, function() {
$("<li>no topics :-(</li>").appendTo("#stream");
});
});
$(window).scroll(function(){
if($(window).scrollTop() == $(document).height() - $(window).height()) {
offset += 10;
// find a way to get all tiddlers created before the ones above
console.log("loadMore();");
}
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>@tivity</title>
<link rel="stylesheet" type="text/css"
href="/bags/common/tiddlers/reset.css">
<link rel="stylesheet" type="text/css"
href="http://tiddlyspace.com/bags/tivity-extra_public/tiddlers/activity.css">
</head>
<body>
<div id="message"></div>
<div class="box">
<h1 title="from spaces you follow">▢</h1>
<ul id="bbox" class="tiddlers"></ul>
</div>
<div class="box">
<h1 title="tagged for you">@</h1>
<ul id="atbox" class="tiddlers"></ul>
</div>
<div class="box">
<h1 title="from your friends">☺</h1>
<ul id="fbox" class="tiddlers"></ul>
</div>
<div class="box">
<h1 title="from everybody">∞</h1>
<ul id="upbox" class="tiddlers"></ul>
</div>
<div id="sizer">M</div>
<div id="more">
<input type="text" id="newsub" value="#tag, +modifier or @space">
<button id="addsub">+</button>
</div>
</body>
<script src="/bags/common/tiddlers/jquery.js"></script>
<script src="http://tiddlyspace.com/bags/tivity-extra_public/tiddlers/jquery.timeago.js"></script>
<script src="/status.js"></script>
<script src="http://tiddlyspace.com/bags/tivity-extra_public/tiddlers/tiddlersocket.js"></script>
<script src="http://tiddlyspace.com/bags/tivity-extra_public/tiddlers/activity.js"></script>
</html>
ambit.tiddlyspace.com
ambit-derry-omagh.tiddlyspace.com
ambit-casus.tiddlyspace.com
ambit-kidsco.tiddlyspace.com
ambit-islington-aot.tiddlyspace.com
ambit-islington-exemplar.tiddlyspace.com
ambit-plymouth.tiddlyspace.com
ambit-mac.tiddlyspace.com
ambit-edinburgh.tiddlyspace.com
ambit-amass.tiddlyspace.com
ambit-dasl.tiddlyspace.com
ambit-brathay.tiddlyspace.com
ambit-caldecott.tiddlyspace.com
ambit-offcentre.tiddlyspace.com
ambit-youngminds.tiddlyspace.com
ambit-winch.tiddlyspace.com
ambit-bexley.tiddlyspace.com
ambit-offtherecord.tiddlyspace.com
/**
* @license AngularJS v1.0.8
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document, undefined) {
'use strict';
////////////////////////////////////
/**
* @ngdoc function
* @name angular.lowercase
* @function
*
* @description Converts the specified string to lowercase.
* @param {string} string String to be converted to lowercase.
* @returns {string} Lowercased string.
*/
var lowercase = function(string){return isString(string) ? string.toLowerCase() : string;};
/**
* @ngdoc function
* @name angular.uppercase
* @function
*
* @description Converts the specified string to uppercase.
* @param {string} string String to be converted to uppercase.
* @returns {string} Uppercased string.
*/
var uppercase = function(string){return isString(string) ? string.toUpperCase() : string;};
var manualLowercase = function(s) {
return isString(s)
? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
: s;
};
var manualUppercase = function(s) {
return isString(s)
? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
: s;
};
// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish
// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods
// with correct but slower alternatives.
if ('i' !== 'I'.toLowerCase()) {
lowercase = manualLowercase;
uppercase = manualUppercase;
}
var /** holds major version number for IE or NaN for real browsers */
msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]),
jqLite, // delay binding since jQuery could be loaded after us.
jQuery, // delay binding
slice = [].slice,
push = [].push,
toString = Object.prototype.toString,
/** @name angular */
angular = window.angular || (window.angular = {}),
angularModule,
nodeName_,
uid = ['0', '0', '0'];
/**
* @private
* @param {*} obj
* @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...)
*/
function isArrayLike(obj) {
if (!obj || (typeof obj.length !== 'number')) return false;
// We have on object which has length property. Should we treat it as array?
if (typeof obj.hasOwnProperty != 'function' &&
typeof obj.constructor != 'function') {
// This is here for IE8: it is a bogus object treat it as array;
return true;
} else {
return obj instanceof JQLite || // JQLite
(jQuery && obj instanceof jQuery) || // jQuery
toString.call(obj) !== '[object Object]' || // some browser native object
typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj)
}
}
/**
* @ngdoc function
* @name angular.forEach
* @function
*
* @description
* Invokes the `iterator` function once for each item in `obj` collection, which can be either an
* object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value`
* is the value of an object property or an array element and `key` is the object property key or
* array element index. Specifying a `context` for the function is optional.
*
* Note: this function was previously known as `angular.foreach`.
*
<pre>
var values = {name: 'misko', gender: 'male'};
var log = [];
angular.forEach(values, function(value, key){
this.push(key + ': ' + value);
}, log);
expect(log).toEqual(['name: misko', 'gender:male']);
</pre>
*
* @param {Object|Array} obj Object to iterate over.
* @param {Function} iterator Iterator function.
* @param {Object=} context Object to become context (`this`) for the iterator function.
* @returns {Object|Array} Reference to `obj`.
*/
function forEach(obj, iterator, context) {
var key;
if (obj) {
if (isFunction(obj)){
for (key in obj) {
if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) {
iterator.call(context, obj[key], key);
}
}
} else if (obj.forEach && obj.forEach !== forEach) {
obj.forEach(iterator, context);
} else if (isArrayLike(obj)) {
for (key = 0; key < obj.length; key++)
iterator.call(context, obj[key], key);
} else {
for (key in obj) {
if (obj.hasOwnProperty(key)) {
iterator.call(context, obj[key], key);
}
}
}
}
return obj;
}
function sortedKeys(obj) {
var keys = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
keys.push(key);
}
}
return keys.sort();
}
function forEachSorted(obj, iterator, context) {
var keys = sortedKeys(obj);
for ( var i = 0; i < keys.length; i++) {
iterator.call(context, obj[keys[i]], keys[i]);
}
return keys;
}
/**
* when using forEach the params are value, key, but it is often useful to have key, value.
* @param {function(string, *)} iteratorFn
* @returns {function(*, string)}
*/
function reverseParams(iteratorFn) {
return function(value, key) { iteratorFn(key, value) };
}
/**
* A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric
* characters such as '012ABC'. The reason why we are not using simply a number counter is that
* the number string gets longer over time, and it can also overflow, where as the nextId
* will grow much slower, it is a string, and it will never overflow.
*
* @returns an unique alpha-numeric string
*/
function nextUid() {
var index = uid.length;
var digit;
while(index) {
index--;
digit = uid[index].charCodeAt(0);
if (digit == 57 /*'9'*/) {
uid[index] = 'A';
return uid.join('');
}
if (digit == 90 /*'Z'*/) {
uid[index] = '0';
} else {
uid[index] = String.fromCharCode(digit + 1);
return uid.join('');
}
}
uid.unshift('0');
return uid.join('');
}
/**
* Set or clear the hashkey for an object.
* @param obj object
* @param h the hashkey (!truthy to delete the hashkey)
*/
function setHashKey(obj, h) {
if (h) {
obj.$$hashKey = h;
}
else {
delete obj.$$hashKey;
}
}
/**
* @ngdoc function
* @name angular.extend
* @function
*
* @description
* Extends the destination object `dst` by copying all of the properties from the `src` object(s)
* to `dst`. You can specify multiple `src` objects.
*
* @param {Object} dst Destination object.
* @param {...Object} src Source object(s).
* @returns {Object} Reference to `dst`.
*/
function extend(dst) {
var h = dst.$$hashKey;
forEach(arguments, function(obj){
if (obj !== dst) {
forEach(obj, function(value, key){
dst[key] = value;
});
}
});
setHashKey(dst,h);
return dst;
}
function int(str) {
return parseInt(str, 10);
}
function inherit(parent, extra) {
return extend(new (extend(function() {}, {prototype:parent}))(), extra);
}
/**
* @ngdoc function
* @name angular.noop
* @function
*
* @description
* A function that performs no operations. This function can be useful when writing code in the
* functional style.
<pre>
function foo(callback) {
var result = calculateResult();
(callback || angular.noop)(result);
}
</pre>
*/
function noop() {}
noop.$inject = [];
/**
* @ngdoc function
* @name angular.identity
* @function
*
* @description
* A function that returns its first argument. This function is useful when writing code in the
* functional style.
*
<pre>
function transformer(transformationFn, value) {
return (transformationFn || angular.identity)(value);
};
</pre>
*/
function identity($) {return $;}
identity.$inject = [];
function valueFn(value) {return function() {return value;};}
/**
* @ngdoc function
* @name angular.isUndefined
* @function
*
* @description
* Determines if a reference is undefined.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is undefined.
*/
function isUndefined(value){return typeof value == 'undefined';}
/**
* @ngdoc function
* @name angular.isDefined
* @function
*
* @description
* Determines if a reference is defined.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is defined.
*/
function isDefined(value){return typeof value != 'undefined';}
/**
* @ngdoc function
* @name angular.isObject
* @function
*
* @description
* Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
* considered to be objects.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is an `Object` but not `null`.
*/
function isObject(value){return value != null && typeof value == 'object';}
/**
* @ngdoc function
* @name angular.isString
* @function
*
* @description
* Determines if a reference is a `String`.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `String`.
*/
function isString(value){return typeof value == 'string';}
/**
* @ngdoc function
* @name angular.isNumber
* @function
*
* @description
* Determines if a reference is a `Number`.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `Number`.
*/
function isNumber(value){return typeof value == 'number';}
/**
* @ngdoc function
* @name angular.isDate
* @function
*
* @description
* Determines if a value is a date.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `Date`.
*/
function isDate(value){
return toString.apply(value) == '[object Date]';
}
/**
* @ngdoc function
* @name angular.isArray
* @function
*
* @description
* Determines if a reference is an `Array`.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is an `Array`.
*/
function isArray(value) {
return toString.apply(value) == '[object Array]';
}
/**
* @ngdoc function
* @name angular.isFunction
* @function
*
* @description
* Determines if a reference is a `Function`.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `Function`.
*/
function isFunction(value){return typeof value == 'function';}
/**
* Determines if a value is a regular expression object.
*
* @private
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `RegExp`.
*/
function isRegExp(value) {
return toString.apply(value) == '[object RegExp]';
}
/**
* Checks if `obj` is a window object.
*
* @private
* @param {*} obj Object to check
* @returns {boolean} True if `obj` is a window obj.
*/
function isWindow(obj) {
return obj && obj.document && obj.location && obj.alert && obj.setInterval;
}
function isScope(obj) {
return obj && obj.$evalAsync && obj.$watch;
}
function isFile(obj) {
return toString.apply(obj) === '[object File]';
}
function isBoolean(value) {
return typeof value == 'boolean';
}
var trim = (function() {
// native trim is way faster: http://jsperf.com/angular-trim-test
// but IE doesn't have it... :-(
// TODO: we should move this into IE/ES5 polyfill
if (!String.prototype.trim) {
return function(value) {
return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value;
};
}
return function(value) {
return isString(value) ? value.trim() : value;
};
})();
/**
* @ngdoc function
* @name angular.isElement
* @function
*
* @description
* Determines if a reference is a DOM element (or wrapped jQuery element).
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
*/
function isElement(node) {
return node &&
(node.nodeName // we are a direct element
|| (node.bind && node.find)); // we have a bind and find method part of jQuery API
}
/**
* @param str 'key1,key2,...'
* @returns {object} in the form of {key1:true, key2:true, ...}
*/
function makeMap(str){
var obj = {}, items = str.split(","), i;
for ( i = 0; i < items.length; i++ )
obj[ items[i] ] = true;
return obj;
}
if (msie < 9) {
nodeName_ = function(element) {
element = element.nodeName ? element : element[0];
return (element.scopeName && element.scopeName != 'HTML')
? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName;
};
} else {
nodeName_ = function(element) {
return element.nodeName ? element.nodeName : element[0].nodeName;
};
}
function map(obj, iterator, context) {
var results = [];
forEach(obj, function(value, index, list) {
results.push(iterator.call(context, value, index, list));
});
return results;
}
/**
* @description
* Determines the number of elements in an array, the number of properties an object has, or
* the length of a string.
*
* Note: This function is used to augment the Object type in Angular expressions. See
* {@link angular.Object} for more information about Angular arrays.
*
* @param {Object|Array|string} obj Object, array, or string to inspect.
* @param {boolean} [ownPropsOnly=false] Count only "own" properties in an object
* @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array.
*/
function size(obj, ownPropsOnly) {
var size = 0, key;
if (isArray(obj) || isString(obj)) {
return obj.length;
} else if (isObject(obj)){
for (key in obj)
if (!ownPropsOnly || obj.hasOwnProperty(key))
size++;
}
return size;
}
function includes(array, obj) {
return indexOf(array, obj) != -1;
}
function indexOf(array, obj) {
if (array.indexOf) return array.indexOf(obj);
for ( var i = 0; i < array.length; i++) {
if (obj === array[i]) return i;
}
return -1;
}
function arrayRemove(array, value) {
var index = indexOf(array, value);
if (index >=0)
array.splice(index, 1);
return value;
}
function isLeafNode (node) {
if (node) {
switch (node.nodeName) {
case "OPTION":
case "PRE":
case "TITLE":
return true;
}
}
return false;
}
/**
* @ngdoc function
* @name angular.copy
* @function
*
* @description
* Creates a deep copy of `source`, which should be an object or an array.
*
* * If no destination is supplied, a copy of the object or array is created.
* * If a destination is provided, all of its elements (for array) or properties (for objects)
* are deleted and then all elements/properties from the source are copied to it.
* * If `source` is not an object or array, `source` is returned.
*
* Note: this function is used to augment the Object type in Angular expressions. See
* {@link ng.$filter} for more information about Angular arrays.
*
* @param {*} source The source that will be used to make a copy.
* Can be any type, including primitives, `null`, and `undefined`.
* @param {(Object|Array)=} destination Destination into which the source is copied. If
* provided, must be of the same type as `source`.
* @returns {*} The copy or updated `destination`, if `destination` was specified.
*/
function copy(source, destination){
if (isWindow(source) || isScope(source)) throw Error("Can't copy Window or Scope");
if (!destination) {
destination = source;
if (source) {
if (isArray(source)) {
destination = copy(source, []);
} else if (isDate(source)) {
destination = new Date(source.getTime());
} else if (isRegExp(source)) {
destination = new RegExp(source.source);
} else if (isObject(source)) {
destination = copy(source, {});
}
}
} else {
if (source === destination) throw Error("Can't copy equivalent objects or arrays");
if (isArray(source)) {
destination.length = 0;
for ( var i = 0; i < source.length; i++) {
destination.push(copy(source[i]));
}
} else {
var h = destination.$$hashKey;
forEach(destination, function(value, key){
delete destination[key];
});
for ( var key in source) {
destination[key] = copy(source[key]);
}
setHashKey(destination,h);
}
}
return destination;
}
/**
* Create a shallow copy of an object
*/
function shallowCopy(src, dst) {
dst = dst || {};
for(var key in src) {
if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') {
dst[key] = src[key];
}
}
return dst;
}
/**
* @ngdoc function
* @name angular.equals
* @function
*
* @description
* Determines if two objects or two values are equivalent. Supports value types, regular expressions, arrays and
* objects.
*
* Two objects or values are considered equivalent if at least one of the following is true:
*
* * Both objects or values pass `===` comparison.
* * Both objects or values are of the same type and all of their properties pass `===` comparison.
* * Both values are NaN. (In JavasScript, NaN == NaN => false. But we consider two NaN as equal)
* * Both values represent the same regular expression (In JavasScript,
* /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
* representation matches).
*
* During a property comparision, properties of `function` type and properties with names
* that begin with `$` are ignored.
*
* Scope and DOMWindow objects are being compared only by identify (`===`).
*
* @param {*} o1 Object or value to compare.
* @param {*} o2 Object or value to compare.
* @returns {boolean} True if arguments are equal.
*/
function equals(o1, o2) {
if (o1 === o2) return true;
if (o1 === null || o2 === null) return false;
if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
if (t1 == t2) {
if (t1 == 'object') {
if (isArray(o1)) {
if (!isArray(o2)) return false;
if ((length = o1.length) == o2.length) {
for(key=0; key<length; key++) {
if (!equals(o1[key], o2[key])) return false;
}
return true;
}
} else if (isDate(o1)) {
return isDate(o2) && o1.getTime() == o2.getTime();
} else if (isRegExp(o1) && isRegExp(o2)) {
return o1.toString() == o2.toString();
} else {
if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false;
keySet = {};
for(key in o1) {
if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
if (!equals(o1[key], o2[key])) return false;
keySet[key] = true;
}
for(key in o2) {
if (!keySet[key] &&
key.charAt(0) !== '$' &&
o2[key] !== undefined &&
!isFunction(o2[key])) return false;
}
return true;
}
}
}
return false;
}
function concat(array1, array2, index) {
return array1.concat(slice.call(array2, index));
}
function sliceArgs(args, startIndex) {
return slice.call(args, startIndex || 0);
}
/**
* @ngdoc function
* @name angular.bind
* @function
*
* @description
* Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
* `fn`). You can supply optional `args` that are prebound to the function. This feature is also
* known as [function currying](http://en.wikipedia.org/wiki/Currying).
*
* @param {Object} self Context which `fn` should be evaluated in.
* @param {function()} fn Function to be bound.
* @param {...*} args Optional arguments to be prebound to the `fn` function call.
* @returns {function()} Function that wraps the `fn` with all the specified bindings.
*/
function bind(self, fn) {
var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
if (isFunction(fn) && !(fn instanceof RegExp)) {
return curryArgs.length
? function() {
return arguments.length
? fn.apply(self, curryArgs.concat(slice.call(arguments, 0)))
: fn.apply(self, curryArgs);
}
: function() {
return arguments.length
? fn.apply(self, arguments)
: fn.call(self);
};
} else {
// in IE, native methods are not functions so they cannot be bound (note: they don't need to be)
return fn;
}
}
function toJsonReplacer(key, value) {
var val = value;
if (/^\$+/.test(key)) {
val = undefined;
} else if (isWindow(value)) {
val = '$WINDOW';
} else if (value && document === value) {
val = '$DOCUMENT';
} else if (isScope(value)) {
val = '$SCOPE';
}
return val;
}
/**
* @ngdoc function
* @name angular.toJson
* @function
*
* @description
* Serializes input into a JSON-formatted string. Properties with leading $ characters will be
* stripped since angular uses this notation internally.
*
* @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
* @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace.
* @returns {string|undefined} Jsonified string representing `obj`.
*/
function toJson(obj, pretty) {
if (typeof obj === 'undefined') return undefined;
return JSON.stringify(obj, toJsonReplacer, pretty ? ' ' : null);
}
/**
* @ngdoc function
* @name angular.fromJson
* @function
*
* @description
* Deserializes a JSON string.
*
* @param {string} json JSON string to deserialize.
* @returns {Object|Array|Date|string|number} Deserialized thingy.
*/
function fromJson(json) {
return isString(json)
? JSON.parse(json)
: json;
}
function toBoolean(value) {
if (value && value.length !== 0) {
var v = lowercase("" + value);
value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');
} else {
value = false;
}
return value;
}
/**
* @returns {string} Returns the string representation of the element.
*/
function startingTag(element) {
element = jqLite(element).clone();
try {
// turns out IE does not let you set .html() on elements which
// are not allowed to have children. So we just ignore it.
element.html('');
} catch(e) {}
// As Per DOM Standards
var TEXT_NODE = 3;
var elemHtml = jqLite('<div>').append(element).html();
try {
return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) :
elemHtml.
match(/^(<[^>]+>)/)[1].
replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
} catch(e) {
return lowercase(elemHtml);
}
}
/////////////////////////////////////////////////
/**
* Tries to decode the URI component without throwing an exception.
*
* @private
* @param str value potential URI component to check.
* @returns {boolean} True if `value` can be decoded
* with the decodeURIComponent function.
*/
function tryDecodeURIComponent(value) {
try {
return decodeURIComponent(value);
} catch(e) {
// Ignore any invalid uri component
}
}
/**
* Parses an escaped url query string into key-value pairs.
* @returns Object.<(string|boolean)>
*/
function parseKeyValue(/**string*/keyValue) {
var obj = {}, key_value, key;
forEach((keyValue || "").split('&'), function(keyValue){
if ( keyValue ) {
key_value = keyValue.split('=');
key = tryDecodeURIComponent(key_value[0]);
if ( isDefined(key) ) {
obj[key] = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
}
}
});
return obj;
}
function toKeyValue(obj) {
var parts = [];
forEach(obj, function(value, key) {
parts.push(encodeUriQuery(key, true) + (value === true ? '' : '=' + encodeUriQuery(value, true)));
});
return parts.length ? parts.join('&') : '';
}
/**
* We need our custom method because encodeURIComponent is too agressive and doesn't follow
* http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
* segments:
* segment = *pchar
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* pct-encoded = "%" HEXDIG HEXDIG
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
* / "*" / "+" / "," / ";" / "="
*/
function encodeUriSegment(val) {
return encodeUriQuery(val, true).
replace(/%26/gi, '&').
replace(/%3D/gi, '=').
replace(/%2B/gi, '+');
}
/**
* This method is intended for encoding *key* or *value* parts of query component. We need a custom
* method becuase encodeURIComponent is too agressive and encodes stuff that doesn't have to be
* encoded per http://tools.ietf.org/html/rfc3986:
* query = *( pchar / "/" / "?" )
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* pct-encoded = "%" HEXDIG HEXDIG
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
* / "*" / "+" / "," / ";" / "="
*/
function encodeUriQuery(val, pctEncodeSpaces) {
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
}
/**
* @ngdoc directive
* @name ng.directive:ngApp
*
* @element ANY
* @param {angular.Module} ngApp an optional application
* {@link angular.module module} name to load.
*
* @description
*
* Use this directive to auto-bootstrap an application. Only
* one ngApp directive can be used per HTML document. The directive
* designates the root of the application and is typically placed
* at the root of the page.
*
* The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in an
* HTML document you must manually bootstrap them using {@link angular.bootstrap}.
* Applications cannot be nested.
*
* In the example below if the `ngApp` directive would not be placed
* on the `html` element then the document would not be compiled
* and the `{{ 1+2 }}` would not be resolved to `3`.
*
* `ngApp` is the easiest way to bootstrap an application.
*
<doc:example>
<doc:source>
I can add: 1 + 2 = {{ 1+2 }}
</doc:source>
</doc:example>
*
*/
function angularInit(element, bootstrap) {
var elements = [element],
appElement,
module,
names = ['ng:app', 'ng-app', 'x-ng-app', 'data-ng-app'],
NG_APP_CLASS_REGEXP = /\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;
function append(element) {
element && elements.push(element);
}
forEach(names, function(name) {
names[name] = true;
append(document.getElementById(name));
name = name.replace(':', '\\:');
if (element.querySelectorAll) {
forEach(element.querySelectorAll('.' + name), append);
forEach(element.querySelectorAll('.' + name + '\\:'), append);
forEach(element.querySelectorAll('[' + name + ']'), append);
}
});
forEach(elements, function(element) {
if (!appElement) {
var className = ' ' + element.className + ' ';
var match = NG_APP_CLASS_REGEXP.exec(className);
if (match) {
appElement = element;
module = (match[2] || '').replace(/\s+/g, ',');
} else {
forEach(element.attributes, function(attr) {
if (!appElement && names[attr.name]) {
appElement = element;
module = attr.value;
}
});
}
}
});
if (appElement) {
bootstrap(appElement, module ? [module] : []);
}
}
/**
* @ngdoc function
* @name angular.bootstrap
* @description
* Use this function to manually start up angular application.
*
* See: {@link guide/bootstrap Bootstrap}
*
* Note that ngScenario-based end-to-end tests cannot use this function to bootstrap manually.
* They must use {@link api/ng.directive:ngApp ngApp}.
*
* @param {Element} element DOM element which is the root of angular application.
* @param {Array<String|Function>=} modules an array of module declarations. See: {@link angular.module modules}
* @returns {AUTO.$injector} Returns the newly created injector for this app.
*/
function bootstrap(element, modules) {
var doBootstrap = function() {
element = jqLite(element);
modules = modules || [];
modules.unshift(['$provide', function($provide) {
$provide.value('$rootElement', element);
}]);
modules.unshift('ng');
var injector = createInjector(modules);
injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
function(scope, element, compile, injector) {
scope.$apply(function() {
element.data('$injector', injector);
compile(element)(scope);
});
}]
);
return injector;
};
var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
return doBootstrap();
}
window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
angular.resumeBootstrap = function(extraModules) {
forEach(extraModules, function(module) {
modules.push(module);
});
doBootstrap();
};
}
var SNAKE_CASE_REGEXP = /[A-Z]/g;
function snake_case(name, separator){
separator = separator || '_';
return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
return (pos ? separator : '') + letter.toLowerCase();
});
}
function bindJQuery() {
// bind to jQuery if present;
jQuery = window.jQuery;
// reset to jQuery or default to us.
if (jQuery) {
jqLite = jQuery;
extend(jQuery.fn, {
scope: JQLitePrototype.scope,
controller: JQLitePrototype.controller,
injector: JQLitePrototype.injector,
inheritedData: JQLitePrototype.inheritedData
});
// Method signature: JQLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments)
JQLitePatchJQueryRemove('remove', true, true, false);
JQLitePatchJQueryRemove('empty', false, false, false);
JQLitePatchJQueryRemove('html', false, false, true);
} else {
jqLite = JQLite;
}
angular.element = jqLite;
}
/**
* throw error if the argument is falsy.
*/
function assertArg(arg, name, reason) {
if (!arg) {
throw new Error("Argument '" + (name || '?') + "' is " + (reason || "required"));
}
return arg;
}
function assertArgFn(arg, name, acceptArrayAnnotation) {
if (acceptArrayAnnotation && isArray(arg)) {
arg = arg[arg.length - 1];
}
assertArg(isFunction(arg), name, 'not a function, got ' +
(arg && typeof arg == 'object' ? arg.constructor.name || 'Object' : typeof arg));
return arg;
}
/**
* Return the value accessible from the object by path. Any undefined traversals are ignored
* @param {Object} obj starting object
* @param {string} path path to traverse
* @param {boolean=true} bindFnToScope
* @returns value as accessible by path
*/
//TODO(misko): this function needs to be removed
function getter(obj, path, bindFnToScope) {
if (!path) return obj;
var keys = path.split('.');
var key;
var lastInstance = obj;
var len = keys.length;
for (var i = 0; i < len; i++) {
key = keys[i];
if (obj) {
obj = (lastInstance = obj)[key];
}
}
if (!bindFnToScope && isFunction(obj)) {
return bind(lastInstance, obj);
}
return obj;
}
/**
* @ngdoc interface
* @name angular.Module
* @description
*
* Interface for configuring angular {@link angular.module modules}.
*/
function setupModuleLoader(window) {
function ensure(obj, name, factory) {
return obj[name] || (obj[name] = factory());
}
return ensure(ensure(window, 'angular', Object), 'module', function() {
/** @type {Object.<string, angular.Module>} */
var modules = {};
/**
* @ngdoc function
* @name angular.module
* @description
*
* The `angular.module` is a global place for creating and registering Angular modules. All
* modules (angular core or 3rd party) that should be available to an application must be
* registered using this mechanism.
*
*
* # Module
*
* A module is a collection of services, directives, filters, and configuration information.
* `angular.module` is used to configure the {@link AUTO.$injector $injector}.
*
* <pre>
* // Create a new module
* var myModule = angular.module('myModule', []);
*
* // register a new service
* myModule.value('appName', 'MyCoolApp');
*
* // configure existing services inside initialization blocks.
* myModule.config(function($locationProvider) {
* // Configure existing providers
* $locationProvider.hashPrefix('!');
* });
* </pre>
*
* Then you can create an injector and load your modules like this:
*
* <pre>
* var injector = angular.injector(['ng', 'MyModule'])
* </pre>
*
* However it's more likely that you'll just use
* {@link ng.directive:ngApp ngApp} or
* {@link angular.bootstrap} to simplify this process for you.
*
* @param {!string} name The name of the module to create or retrieve.
* @param {Array.<string>=} requires If specified then new module is being created. If unspecified then the
* the module is being retrieved for further configuration.
* @param {Function} configFn Optional configuration function for the module. Same as
* {@link angular.Module#config Module#config()}.
* @returns {module} new module with the {@link angular.Module} api.
*/
return function module(name, requires, configFn) {
if (requires && modules.hasOwnProperty(name)) {
modules[name] = null;
}
return ensure(modules, name, function() {
if (!requires) {
throw Error('No module: ' + name);
}
/** @type {!Array.<Array.<*>>} */
var invokeQueue = [];
/** @type {!Array.<Function>} */
var runBlocks = [];
var config = invokeLater('$injector', 'invoke');
/** @type {angular.Module} */
var moduleInstance = {
// Private state
_invokeQueue: invokeQueue,
_runBlocks: runBlocks,
/**
* @ngdoc property
* @name angular.Module#requires
* @propertyOf angular.Module
* @returns {Array.<string>} List of module names which must be loaded before this module.
* @description
* Holds the list of modules which the injector will load before the current module is loaded.
*/
requires: requires,
/**
* @ngdoc property
* @name angular.Module#name
* @propertyOf angular.Module
* @returns {string} Name of the module.
* @description
*/
name: name,
/**
* @ngdoc method
* @name angular.Module#provider
* @methodOf angular.Module
* @param {string} name service name
* @param {Function} providerType Construction function for creating new instance of the service.
* @description
* See {@link AUTO.$provide#provider $provide.provider()}.
*/
provider: invokeLater('$provide', 'provider'),
/**
* @ngdoc method
* @name angular.Module#factory
* @methodOf angular.Module
* @param {string} name service name
* @param {Function} providerFunction Function for creating new instance of the service.
* @description
* See {@link AUTO.$provide#factory $provide.factory()}.
*/
factory: invokeLater('$provide', 'factory'),
/**
* @ngdoc method
* @name angular.Module#service
* @methodOf angular.Module
* @param {string} name service name
* @param {Function} constructor A constructor function that will be instantiated.
* @description
* See {@link AUTO.$provide#service $provide.service()}.
*/
service: invokeLater('$provide', 'service'),
/**
* @ngdoc method
* @name angular.Module#value
* @methodOf angular.Module
* @param {string} name service name
* @param {*} object Service instance object.
* @description
* See {@link AUTO.$provide#value $provide.value()}.
*/
value: invokeLater('$provide', 'value'),
/**
* @ngdoc method
* @name angular.Module#constant
* @methodOf angular.Module
* @param {string} name constant name
* @param {*} object Constant value.
* @description
* Because the constant are fixed, they get applied before other provide methods.
* See {@link AUTO.$provide#constant $provide.constant()}.
*/
constant: invokeLater('$provide', 'constant', 'unshift'),
/**
* @ngdoc method
* @name angular.Module#filter
* @methodOf angular.Module
* @param {string} name Filter name.
* @param {Function} filterFactory Factory function for creating new instance of filter.
* @description
* See {@link ng.$filterProvider#register $filterProvider.register()}.
*/
filter: invokeLater('$filterProvider', 'register'),
/**
* @ngdoc method
* @name angular.Module#controller
* @methodOf angular.Module
* @param {string} name Controller name.
* @param {Function} constructor Controller constructor function.
* @description
* See {@link ng.$controllerProvider#register $controllerProvider.register()}.
*/
controller: invokeLater('$controllerProvider', 'register'),
/**
* @ngdoc method
* @name angular.Module#directive
* @methodOf angular.Module
* @param {string} name directive name
* @param {Function} directiveFactory Factory function for creating new instance of
* directives.
* @description
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
*/
directive: invokeLater('$compileProvider', 'directive'),
/**
* @ngdoc method
* @name angular.Module#config
* @methodOf angular.Module
* @param {Function} configFn Execute this function on module load. Useful for service
* configuration.
* @description
* Use this method to register work which needs to be performed on module loading.
*/
config: config,
/**
* @ngdoc method
* @name angular.Module#run
* @methodOf angular.Module
* @param {Function} initializationFn Execute this function after injector creation.
* Useful for application initialization.
* @description
* Use this method to register work which should be performed when the injector is done
* loading all modules.
*/
run: function(block) {
runBlocks.push(block);
return this;
}
};
if (configFn) {
config(configFn);
}
return moduleInstance;
/**
* @param {string} provider
* @param {string} method
* @param {String=} insertMethod
* @returns {angular.Module}
*/
function invokeLater(provider, method, insertMethod) {
return function() {
invokeQueue[insertMethod || 'push']([provider, method, arguments]);
return moduleInstance;
}
}
});
};
});
}
/**
* @ngdoc property
* @name angular.version
* @description
* An object that contains information about the current AngularJS version. This object has the
* following properties:
*
* - `full` – `{string}` – Full version string, such as "0.9.18".
* - `major` – `{number}` – Major version number, such as "0".
* - `minor` – `{number}` – Minor version number, such as "9".
* - `dot` – `{number}` – Dot version number, such as "18".
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
*/
var version = {
full: '1.0.8', // all of these placeholder strings will be replaced by grunt's
major: 1, // package task
minor: 0,
dot: 8,
codeName: 'bubble-burst'
};
function publishExternalAPI(angular){
extend(angular, {
'bootstrap': bootstrap,
'copy': copy,
'extend': extend,
'equals': equals,
'element': jqLite,
'forEach': forEach,
'injector': createInjector,
'noop':noop,
'bind':bind,
'toJson': toJson,
'fromJson': fromJson,
'identity':identity,
'isUndefined': isUndefined,
'isDefined': isDefined,
'isString': isString,
'isFunction': isFunction,
'isObject': isObject,
'isNumber': isNumber,
'isElement': isElement,
'isArray': isArray,
'version': version,
'isDate': isDate,
'lowercase': lowercase,
'uppercase': uppercase,
'callbacks': {counter: 0}
});
angularModule = setupModuleLoader(window);
try {
angularModule('ngLocale');
} catch (e) {
angularModule('ngLocale', []).provider('$locale', $LocaleProvider);
}
angularModule('ng', ['ngLocale'], ['$provide',
function ngModule($provide) {
$provide.provider('$compile', $CompileProvider).
directive({
a: htmlAnchorDirective,
input: inputDirective,
textarea: inputDirective,
form: formDirective,
script: scriptDirective,
select: selectDirective,
style: styleDirective,
option: optionDirective,
ngBind: ngBindDirective,
ngBindHtmlUnsafe: ngBindHtmlUnsafeDirective,
ngBindTemplate: ngBindTemplateDirective,
ngClass: ngClassDirective,
ngClassEven: ngClassEvenDirective,
ngClassOdd: ngClassOddDirective,
ngCsp: ngCspDirective,
ngCloak: ngCloakDirective,
ngController: ngControllerDirective,
ngForm: ngFormDirective,
ngHide: ngHideDirective,
ngInclude: ngIncludeDirective,
ngInit: ngInitDirective,
ngNonBindable: ngNonBindableDirective,
ngPluralize: ngPluralizeDirective,
ngRepeat: ngRepeatDirective,
ngShow: ngShowDirective,
ngStyle: ngStyleDirective,
ngSwitch: ngSwitchDirective,
ngSwitchWhen: ngSwitchWhenDirective,
ngSwitchDefault: ngSwitchDefaultDirective,
ngOptions: ngOptionsDirective,
ngView: ngViewDirective,
ngTransclude: ngTranscludeDirective,
ngModel: ngModelDirective,
ngList: ngListDirective,
ngChange: ngChangeDirective,
required: requiredDirective,
ngRequired: requiredDirective,
ngValue: ngValueDirective
}).
directive(ngAttributeAliasDirectives).
directive(ngEventDirectives);
$provide.provider({
$anchorScroll: $AnchorScrollProvider,
$browser: $BrowserProvider,
$cacheFactory: $CacheFactoryProvider,
$controller: $ControllerProvider,
$document: $DocumentProvider,
$exceptionHandler: $ExceptionHandlerProvider,
$filter: $FilterProvider,
$interpolate: $InterpolateProvider,
$http: $HttpProvider,
$httpBackend: $HttpBackendProvider,
$location: $LocationProvider,
$log: $LogProvider,
$parse: $ParseProvider,
$route: $RouteProvider,
$routeParams: $RouteParamsProvider,
$rootScope: $RootScopeProvider,
$q: $QProvider,
$sniffer: $SnifferProvider,
$templateCache: $TemplateCacheProvider,
$timeout: $TimeoutProvider,
$window: $WindowProvider
});
}
]);
}
//////////////////////////////////
//JQLite
//////////////////////////////////
/**
* @ngdoc function
* @name angular.element
* @function
*
* @description
* Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
* `angular.element` can be either an alias for [jQuery](http://api.jquery.com/jQuery/) function, if
* jQuery is available, or a function that wraps the element or string in Angular's jQuery lite
* implementation (commonly referred to as jqLite).
*
* Real jQuery always takes precedence over jqLite, provided it was loaded before `DOMContentLoaded`
* event fired.
*
* jqLite is a tiny, API-compatible subset of jQuery that allows
* Angular to manipulate the DOM. jqLite implements only the most commonly needed functionality
* within a very small footprint, so only a subset of the jQuery API - methods, arguments and
* invocation styles - are supported.
*
* Note: All element references in Angular are always wrapped with jQuery or jqLite; they are never
* raw DOM references.
*
* ## Angular's jqLite
* Angular's lite version of jQuery provides only the following jQuery methods:
*
* - [addClass()](http://api.jquery.com/addClass/)
* - [after()](http://api.jquery.com/after/)
* - [append()](http://api.jquery.com/append/)
* - [attr()](http://api.jquery.com/attr/)
* - [bind()](http://api.jquery.com/bind/) - Does not support namespaces
* - [children()](http://api.jquery.com/children/) - Does not support selectors
* - [clone()](http://api.jquery.com/clone/)
* - [contents()](http://api.jquery.com/contents/)
* - [css()](http://api.jquery.com/css/)
* - [data()](http://api.jquery.com/data/)
* - [eq()](http://api.jquery.com/eq/)
* - [find()](http://api.jquery.com/find/) - Limited to lookups by tag name
* - [hasClass()](http://api.jquery.com/hasClass/)
* - [html()](http://api.jquery.com/html/)
* - [next()](http://api.jquery.com/next/) - Does not support selectors
* - [parent()](http://api.jquery.com/parent/) - Does not support selectors
* - [prepend()](http://api.jquery.com/prepend/)
* - [prop()](http://api.jquery.com/prop/)
* - [ready()](http://api.jquery.com/ready/)
* - [remove()](http://api.jquery.com/remove/)
* - [removeAttr()](http://api.jquery.com/removeAttr/)
* - [removeClass()](http://api.jquery.com/removeClass/)
* - [removeData()](http://api.jquery.com/removeData/)
* - [replaceWith()](http://api.jquery.com/replaceWith/)
* - [text()](http://api.jquery.com/text/)
* - [toggleClass()](http://api.jquery.com/toggleClass/)
* - [triggerHandler()](http://api.jquery.com/triggerHandler/) - Doesn't pass native event objects to handlers.
* - [unbind()](http://api.jquery.com/unbind/) - Does not support namespaces
* - [val()](http://api.jquery.com/val/)
* - [wrap()](http://api.jquery.com/wrap/)
*
* ## jQuery/jqLite Extras
* Angular also provides the following additional methods and events to both jQuery and jqLite:
*
* ### Events
* - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event
* on all DOM nodes being removed. This can be used to clean up and 3rd party bindings to the DOM
* element before it is removed.
* ### Methods
* - `controller(name)` - retrieves the controller of the current element or its parent. By default
* retrieves controller associated with the `ngController` directive. If `name` is provided as
* camelCase directive name, then the controller for this directive will be retrieved (e.g.
* `'ngModel'`).
* - `injector()` - retrieves the injector of the current element or its parent.
* - `scope()` - retrieves the {@link api/ng.$rootScope.Scope scope} of the current
* element or its parent.
* - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
* parent element is reached.
*
* @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.
* @returns {Object} jQuery object.
*/
var jqCache = JQLite.cache = {},
jqName = JQLite.expando = 'ng-' + new Date().getTime(),
jqId = 1,
addEventListenerFn = (window.document.addEventListener
? function(element, type, fn) {element.addEventListener(type, fn, false);}
: function(element, type, fn) {element.attachEvent('on' + type, fn);}),
removeEventListenerFn = (window.document.removeEventListener
? function(element, type, fn) {element.removeEventListener(type, fn, false); }
: function(element, type, fn) {element.detachEvent('on' + type, fn); });
function jqNextId() { return ++jqId; }
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
/**
* Converts snake_case to camelCase.
* Also there is special case for Moz prefix starting with upper case letter.
* @param name Name to normalize
*/
function camelCase(name) {
return name.
replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
return offset ? letter.toUpperCase() : letter;
}).
replace(MOZ_HACK_REGEXP, 'Moz$1');
}
/////////////////////////////////////////////
// jQuery mutation patch
//
// In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a
// $destroy event on all DOM nodes being removed.
//
/////////////////////////////////////////////
function JQLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments) {
var originalJqFn = jQuery.fn[name];
originalJqFn = originalJqFn.$original || originalJqFn;
removePatch.$original = originalJqFn;
jQuery.fn[name] = removePatch;
function removePatch(param) {
var list = filterElems && param ? [this.filter(param)] : [this],
fireEvent = dispatchThis,
set, setIndex, setLength,
element, childIndex, childLength, children;
if (!getterIfNoArguments || param != null) {
while(list.length) {
set = list.shift();
for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) {
element = jqLite(set[setIndex]);
if (fireEvent) {
element.triggerHandler('$destroy');
} else {
fireEvent = !fireEvent;
}
for(childIndex = 0, childLength = (children = element.children()).length;
childIndex < childLength;
childIndex++) {
list.push(jQuery(children[childIndex]));
}
}
}
}
return originalJqFn.apply(this, arguments);
}
}
/////////////////////////////////////////////
function JQLite(element) {
if (element instanceof JQLite) {
return element;
}
if (!(this instanceof JQLite)) {
if (isString(element) && element.charAt(0) != '<') {
throw Error('selectors not implemented');
}
return new JQLite(element);
}
if (isString(element)) {
var div = document.createElement('div');
// Read about the NoScope elements here:
// http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
div.innerHTML = '<div> </div>' + element; // IE insanity to make NoScope elements work!
div.removeChild(div.firstChild); // remove the superfluous div
JQLiteAddNodes(this, div.childNodes);
this.remove(); // detach the elements from the temporary DOM div.
} else {
JQLiteAddNodes(this, element);
}
}
function JQLiteClone(element) {
return element.cloneNode(true);
}
function JQLiteDealoc(element){
JQLiteRemoveData(element);
for ( var i = 0, children = element.childNodes || []; i < children.length; i++) {
JQLiteDealoc(children[i]);
}
}
function JQLiteUnbind(element, type, fn) {
var events = JQLiteExpandoStore(element, 'events'),
handle = JQLiteExpandoStore(element, 'handle');
if (!handle) return; //no listeners registered
if (isUndefined(type)) {
forEach(events, function(eventHandler, type) {
removeEventListenerFn(element, type, eventHandler);
delete events[type];
});
} else {
if (isUndefined(fn)) {
removeEventListenerFn(element, type, events[type]);
delete events[type];
} else {
arrayRemove(events[type] || [], fn);
}
}
}
function JQLiteRemoveData(element) {
var expandoId = element[jqName],
expandoStore = jqCache[expandoId];
if (expandoStore) {
if (expandoStore.handle) {
expandoStore.events.$destroy && expandoStore.handle({}, '$destroy');
JQLiteUnbind(element);
}
delete jqCache[expandoId];
element[jqName] = undefined; // ie does not allow deletion of attributes on elements.
}
}
function JQLiteExpandoStore(element, key, value) {
var expandoId = element[jqName],
expandoStore = jqCache[expandoId || -1];
if (isDefined(value)) {
if (!expandoStore) {
element[jqName] = expandoId = jqNextId();
expandoStore = jqCache[expandoId] = {};
}
expandoStore[key] = value;
} else {
return expandoStore && expandoStore[key];
}
}
function JQLiteData(element, key, value) {
var data = JQLiteExpandoStore(element, 'data'),
isSetter = isDefined(value),
keyDefined = !isSetter && isDefined(key),
isSimpleGetter = keyDefined && !isObject(key);
if (!data && !isSimpleGetter) {
JQLiteExpandoStore(element, 'data', data = {});
}
if (isSetter) {
data[key] = value;
} else {
if (keyDefined) {
if (isSimpleGetter) {
// don't create data in this case.
return data && data[key];
} else {
extend(data, key);
}
} else {
return data;
}
}
}
function JQLiteHasClass(element, selector) {
return ((" " + element.className + " ").replace(/[\n\t]/g, " ").
indexOf( " " + selector + " " ) > -1);
}
function JQLiteRemoveClass(element, cssClasses) {
if (cssClasses) {
forEach(cssClasses.split(' '), function(cssClass) {
element.className = trim(
(" " + element.className + " ")
.replace(/[\n\t]/g, " ")
.replace(" " + trim(cssClass) + " ", " ")
);
});
}
}
function JQLiteAddClass(element, cssClasses) {
if (cssClasses) {
forEach(cssClasses.split(' '), function(cssClass) {
if (!JQLiteHasClass(element, cssClass)) {
element.className = trim(element.className + ' ' + trim(cssClass));
}
});
}
}
function JQLiteAddNodes(root, elements) {
if (elements) {
elements = (!elements.nodeName && isDefined(elements.length) && !isWindow(elements))
? elements
: [ elements ];
for(var i=0; i < elements.length; i++) {
root.push(elements[i]);
}
}
}
function JQLiteController(element, name) {
return JQLiteInheritedData(element, '$' + (name || 'ngController' ) + 'Controller');
}
function JQLiteInheritedData(element, name, value) {
element = jqLite(element);
// if element is the document object work with the html element instead
// this makes $(document).scope() possible
if(element[0].nodeType == 9) {
element = element.find('html');
}
while (element.length) {
if (value = element.data(name)) return value;
element = element.parent();
}
}
//////////////////////////////////////////
// Functions which are declared directly.
//////////////////////////////////////////
var JQLitePrototype = JQLite.prototype = {
ready: function(fn) {
var fired = false;
function trigger() {
if (fired) return;
fired = true;
fn();
}
this.bind('DOMContentLoaded', trigger); // works for modern browsers and IE9
// we can not use jqLite since we are not done loading and jQuery could be loaded later.
JQLite(window).bind('load', trigger); // fallback to window.onload for others
},
toString: function() {
var value = [];
forEach(this, function(e){ value.push('' + e);});
return '[' + value.join(', ') + ']';
},
eq: function(index) {
return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);
},
length: 0,
push: push,
sort: [].sort,
splice: [].splice
};
//////////////////////////////////////////
// Functions iterating getter/setters.
// these functions return self on setter and
// value on get.
//////////////////////////////////////////
var BOOLEAN_ATTR = {};
forEach('multiple,selected,checked,disabled,readOnly,required'.split(','), function(value) {
BOOLEAN_ATTR[lowercase(value)] = value;
});
var BOOLEAN_ELEMENTS = {};
forEach('input,select,option,textarea,button,form'.split(','), function(value) {
BOOLEAN_ELEMENTS[uppercase(value)] = true;
});
function getBooleanAttrName(element, name) {
// check dom last since we will most likely fail on name
var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
// booleanAttr is here twice to minimize DOM access
return booleanAttr && BOOLEAN_ELEMENTS[element.nodeName] && booleanAttr;
}
forEach({
data: JQLiteData,
inheritedData: JQLiteInheritedData,
scope: function(element) {
return JQLiteInheritedData(element, '$scope');
},
controller: JQLiteController ,
injector: function(element) {
return JQLiteInheritedData(element, '$injector');
},
removeAttr: function(element,name) {
element.removeAttribute(name);
},
hasClass: JQLiteHasClass,
css: function(element, name, value) {
name = camelCase(name);
if (isDefined(value)) {
element.style[name] = value;
} else {
var val;
if (msie <= 8) {
// this is some IE specific weirdness that jQuery 1.6.4 does not sure why
val = element.currentStyle && element.currentStyle[name];
if (val === '') val = 'auto';
}
val = val || element.style[name];
if (msie <= 8) {
// jquery weirdness :-/
val = (val === '') ? undefined : val;
}
return val;
}
},
attr: function(element, name, value){
var lowercasedName = lowercase(name);
if (BOOLEAN_ATTR[lowercasedName]) {
if (isDefined(value)) {
if (!!value) {
element[name] = true;
element.setAttribute(name, lowercasedName);
} else {
element[name] = false;
element.removeAttribute(lowercasedName);
}
} else {
return (element[name] ||
(element.attributes.getNamedItem(name)|| noop).specified)
? lowercasedName
: undefined;
}
} else if (isDefined(value)) {
element.setAttribute(name, value);
} else if (element.getAttribute) {
// the extra argument "2" is to get the right thing for a.href in IE, see jQuery code
// some elements (e.g. Document) don't have get attribute, so return undefined
var ret = element.getAttribute(name, 2);
// normalize non-existing attributes to undefined (as jQuery)
return ret === null ? undefined : ret;
}
},
prop: function(element, name, value) {
if (isDefined(value)) {
element[name] = value;
} else {
return element[name];
}
},
text: extend((msie < 9)
? function(element, value) {
if (element.nodeType == 1 /** Element */) {
if (isUndefined(value))
return element.innerText;
element.innerText = value;
} else {
if (isUndefined(value))
return element.nodeValue;
element.nodeValue = value;
}
}
: function(element, value) {
if (isUndefined(value)) {
return element.textContent;
}
element.textContent = value;
}, {$dv:''}),
val: function(element, value) {
if (isUndefined(value)) {
if (nodeName_(element) === 'SELECT' && element.multiple) {
var result = [];
forEach(element.options, function (option) {
if (option.selected) {
result.push(option.value || option.text);
}
});
return result.length === 0 ? null : result;
}
return element.value;
}
element.value = value;
},
html: function(element, value) {
if (isUndefined(value)) {
return element.innerHTML;
}
for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {
JQLiteDealoc(childNodes[i]);
}
element.innerHTML = value;
}
}, function(fn, name){
/**
* Properties: writes return selection, reads return first value
*/
JQLite.prototype[name] = function(arg1, arg2) {
var i, key;
// JQLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
// in a way that survives minification.
if (((fn.length == 2 && (fn !== JQLiteHasClass && fn !== JQLiteController)) ? arg1 : arg2) === undefined) {
if (isObject(arg1)) {
// we are a write, but the object properties are the key/values
for(i=0; i < this.length; i++) {
if (fn === JQLiteData) {
// data() takes the whole object in jQuery
fn(this[i], arg1);
} else {
for (key in arg1) {
fn(this[i], key, arg1[key]);
}
}
}
// return self for chaining
return this;
} else {
// we are a read, so read the first child.
if (this.length)
return fn(this[0], arg1, arg2);
}
} else {
// we are a write, so apply to all children
for(i=0; i < this.length; i++) {
fn(this[i], arg1, arg2);
}
// return self for chaining
return this;
}
return fn.$dv;
};
});
function createEventHandler(element, events) {
var eventHandler = function (event, type) {
if (!event.preventDefault) {
event.preventDefault = function() {
event.returnValue = false; //ie
};
}
if (!event.stopPropagation) {
event.stopPropagation = function() {
event.cancelBubble = true; //ie
};
}
if (!event.target) {
event.target = event.srcElement || document;
}
if (isUndefined(event.defaultPrevented)) {
var prevent = event.preventDefault;
event.preventDefault = function() {
event.defaultPrevented = true;
prevent.call(event);
};
event.defaultPrevented = false;
}
event.isDefaultPrevented = function() {
return event.defaultPrevented;
};
forEach(events[type || event.type], function(fn) {
fn.call(element, event);
});
// Remove monkey-patched methods (IE),
// as they would cause memory leaks in IE8.
if (msie <= 8) {
// IE7/8 does not allow to delete property on native object
event.preventDefault = null;
event.stopPropagation = null;
event.isDefaultPrevented = null;
} else {
// It shouldn't affect normal browsers (native methods are defined on prototype).
delete event.preventDefault;
delete event.stopPropagation;
delete event.isDefaultPrevented;
}
};
eventHandler.elem = element;
return eventHandler;
}
//////////////////////////////////////////
// Functions iterating traversal.
// These functions chain results into a single
// selector.
//////////////////////////////////////////
forEach({
removeData: JQLiteRemoveData,
dealoc: JQLiteDealoc,
bind: function bindFn(element, type, fn){
var events = JQLiteExpandoStore(element, 'events'),
handle = JQLiteExpandoStore(element, 'handle');
if (!events) JQLiteExpandoStore(element, 'events', events = {});
if (!handle) JQLiteExpandoStore(element, 'handle', handle = createEventHandler(element, events));
forEach(type.split(' '), function(type){
var eventFns = events[type];
if (!eventFns) {
if (type == 'mouseenter' || type == 'mouseleave') {
var contains = document.body.contains || document.body.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
events[type] = [];
// Refer to jQuery's implementation of mouseenter & mouseleave
// Read about mouseenter and mouseleave:
// http://www.quirksmode.org/js/events_mouse.html#link8
var eventmap = { mouseleave : "mouseout", mouseenter : "mouseover"}
bindFn(element, eventmap[type], function(event) {
var ret, target = this, related = event.relatedTarget;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !contains(target, related)) ){
handle(event, type);
}
});
} else {
addEventListenerFn(element, type, handle);
events[type] = [];
}
eventFns = events[type]
}
eventFns.push(fn);
});
},
unbind: JQLiteUnbind,
replaceWith: function(element, replaceNode) {
var index, parent = element.parentNode;
JQLiteDealoc(element);
forEach(new JQLite(replaceNode), function(node){
if (index) {
parent.insertBefore(node, index.nextSibling);
} else {
parent.replaceChild(node, element);
}
index = node;
});
},
children: function(element) {
var children = [];
forEach(element.childNodes, function(element){
if (element.nodeType === 1)
children.push(element);
});
return children;
},
contents: function(element) {
return element.childNodes || [];
},
append: function(element, node) {
forEach(new JQLite(node), function(child){
if (element.nodeType === 1)
element.appendChild(child);
});
},
prepend: function(element, node) {
if (element.nodeType === 1) {
var index = element.firstChild;
forEach(new JQLite(node), function(child){
element.insertBefore(child, index);
});
}
},
wrap: function(element, wrapNode) {
wrapNode = jqLite(wrapNode)[0];
var parent = element.parentNode;
if (parent) {
parent.replaceChild(wrapNode, element);
}
wrapNode.appendChild(element);
},
remove: function(element) {
JQLiteDealoc(element);
var parent = element.parentNode;
if (parent) parent.removeChild(element);
},
after: function(element, newElement) {
var index = element, parent = element.parentNode;
forEach(new JQLite(newElement), function(node){
parent.insertBefore(node, index.nextSibling);
index = node;
});
},
addClass: JQLiteAddClass,
removeClass: JQLiteRemoveClass,
toggleClass: function(element, selector, condition) {
if (isUndefined(condition)) {
condition = !JQLiteHasClass(element, selector);
}
(condition ? JQLiteAddClass : JQLiteRemoveClass)(element, selector);
},
parent: function(element) {
var parent = element.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
next: function(element) {
if (element.nextElementSibling) {
return element.nextElementSibling;
}
// IE8 doesn't have nextElementSibling
var elm = element.nextSibling;
while (elm != null && elm.nodeType !== 1) {
elm = elm.nextSibling;
}
return elm;
},
find: function(element, selector) {
return element.getElementsByTagName(selector);
},
clone: JQLiteClone,
triggerHandler: function(element, eventName) {
var eventFns = (JQLiteExpandoStore(element, 'events') || {})[eventName];
forEach(eventFns, function(fn) {
fn.call(element, null);
});
}
}, function(fn, name){
/**
* chaining functions
*/
JQLite.prototype[name] = function(arg1, arg2) {
var value;
for(var i=0; i < this.length; i++) {
if (value == undefined) {
value = fn(this[i], arg1, arg2);
if (value !== undefined) {
// any function which returns a value needs to be wrapped
value = jqLite(value);
}
} else {
JQLiteAddNodes(value, fn(this[i], arg1, arg2));
}
}
return value == undefined ? this : value;
};
});
/**
* Computes a hash of an 'obj'.
* Hash of a:
* string is string
* number is number as string
* object is either result of calling $$hashKey function on the object or uniquely generated id,
* that is also assigned to the $$hashKey property of the object.
*
* @param obj
* @returns {string} hash string such that the same input will have the same hash string.
* The resulting string key is in 'type:hashKey' format.
*/
function hashKey(obj) {
var objType = typeof obj,
key;
if (objType == 'object' && obj !== null) {
if (typeof (key = obj.$$hashKey) == 'function') {
// must invoke on object to keep the right this
key = obj.$$hashKey();
} else if (key === undefined) {
key = obj.$$hashKey = nextUid();
}
} else {
key = obj;
}
return objType + ':' + key;
}
/**
* HashMap which can use objects as keys
*/
function HashMap(array){
forEach(array, this.put, this);
}
HashMap.prototype = {
/**
* Store key value pair
* @param key key to store can be any type
* @param value value to store can be any type
*/
put: function(key, value) {
this[hashKey(key)] = value;
},
/**
* @param key
* @returns the value for the key
*/
get: function(key) {
return this[hashKey(key)];
},
/**
* Remove the key/value pair
* @param key
*/
remove: function(key) {
var value = this[key = hashKey(key)];
delete this[key];
return value;
}
};
/**
* A map where multiple values can be added to the same key such that they form a queue.
* @returns {HashQueueMap}
*/
function HashQueueMap() {}
HashQueueMap.prototype = {
/**
* Same as array push, but using an array as the value for the hash
*/
push: function(key, value) {
var array = this[key = hashKey(key)];
if (!array) {
this[key] = [value];
} else {
array.push(value);
}
},
/**
* Same as array shift, but using an array as the value for the hash
*/
shift: function(key) {
var array = this[key = hashKey(key)];
if (array) {
if (array.length == 1) {
delete this[key];
return array[0];
} else {
return array.shift();
}
}
},
/**
* return the first item without deleting it
*/
peek: function(key) {
var array = this[hashKey(key)];
if (array) {
return array[0];
}
}
};
/**
* @ngdoc function
* @name angular.injector
* @function
*
* @description
* Creates an injector function that can be used for retrieving services as well as for
* dependency injection (see {@link guide/di dependency injection}).
*
* @param {Array.<string|Function>} modules A list of module functions or their aliases. See
* {@link angular.module}. The `ng` module must be explicitly added.
* @returns {function()} Injector function. See {@link AUTO.$injector $injector}.
*
* @example
* Typical usage
* <pre>
* // create an injector
* var $injector = angular.injector(['ng']);
*
* // use the injector to kick off your application
* // use the type inference to auto inject arguments, or use implicit injection
* $injector.invoke(function($rootScope, $compile, $document){
* $compile($document)($rootScope);
* $rootScope.$digest();
* });
* </pre>
*/
/**
* @ngdoc overview
* @name AUTO
* @description
*
* Implicit module which gets automatically added to each {@link AUTO.$injector $injector}.
*/
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
var FN_ARG_SPLIT = /,/;
var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
function annotate(fn) {
var $inject,
fnText,
argDecl,
last;
if (typeof fn == 'function') {
if (!($inject = fn.$inject)) {
$inject = [];
fnText = fn.toString().replace(STRIP_COMMENTS, '');
argDecl = fnText.match(FN_ARGS);
forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
arg.replace(FN_ARG, function(all, underscore, name){
$inject.push(name);
});
});
fn.$inject = $inject;
}
} else if (isArray(fn)) {
last = fn.length - 1;
assertArgFn(fn[last], 'fn');
$inject = fn.slice(0, last);
} else {
assertArgFn(fn, 'fn', true);
}
return $inject;
}
///////////////////////////////////////
/**
* @ngdoc object
* @name AUTO.$injector
* @function
*
* @description
*
* `$injector` is used to retrieve object instances as defined by
* {@link AUTO.$provide provider}, instantiate types, invoke methods,
* and load modules.
*
* The following always holds true:
*
* <pre>
* var $injector = angular.injector();
* expect($injector.get('$injector')).toBe($injector);
* expect($injector.invoke(function($injector){
* return $injector;
* }).toBe($injector);
* </pre>
*
* # Injection Function Annotation
*
* JavaScript does not have annotations, and annotations are needed for dependency injection. The
* following are all valid ways of annotating function with injection arguments and are equivalent.
*
* <pre>
* // inferred (only works if code not minified/obfuscated)
* $injector.invoke(function(serviceA){});
*
* // annotated
* function explicit(serviceA) {};
* explicit.$inject = ['serviceA'];
* $injector.invoke(explicit);
*
* // inline
* $injector.invoke(['serviceA', function(serviceA){}]);
* </pre>
*
* ## Inference
*
* In JavaScript calling `toString()` on a function returns the function definition. The definition can then be
* parsed and the function arguments can be extracted. *NOTE:* This does not work with minification, and obfuscation
* tools since these tools change the argument names.
*
* ## `$inject` Annotation
* By adding a `$inject` property onto a function the injection parameters can be specified.
*
* ## Inline
* As an array of injection names, where the last item in the array is the function to call.
*/
/**
* @ngdoc method
* @name AUTO.$injector#get
* @methodOf AUTO.$injector
*
* @description
* Return an instance of the service.
*
* @param {string} name The name of the instance to retrieve.
* @return {*} The instance.
*/
/**
* @ngdoc method
* @name AUTO.$injector#invoke
* @methodOf AUTO.$injector
*
* @description
* Invoke the method and supply the method arguments from the `$injector`.
*
* @param {!function} fn The function to invoke. The function arguments come form the function annotation.
* @param {Object=} self The `this` for the invoked method.
* @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before
* the `$injector` is consulted.
* @returns {*} the value returned by the invoked `fn` function.
*/
/**
* @ngdoc method
* @name AUTO.$injector#instantiate
* @methodOf AUTO.$injector
* @description
* Create a new instance of JS type. The method takes a constructor function invokes the new operator and supplies
* all of the arguments to the constructor function as specified by the constructor annotation.
*
* @param {function} Type Annotated constructor function.
* @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before
* the `$injector` is consulted.
* @returns {Object} new instance of `Type`.
*/
/**
* @ngdoc method
* @name AUTO.$injector#annotate
* @methodOf AUTO.$injector
*
* @description
* Returns an array of service names which the function is requesting for injection. This API is used by the injector
* to determine which services need to be injected into the function when the function is invoked. There are three
* ways in which the function can be annotated with the needed dependencies.
*
* # Argument names
*
* The simplest form is to extract the dependencies from the arguments of the function. This is done by converting
* the function into a string using `toString()` method and extracting the argument names.
* <pre>
* // Given
* function MyController($scope, $route) {
* // ...
* }
*
* // Then
* expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
* </pre>
*
* This method does not work with code minfication / obfuscation. For this reason the following annotation strategies
* are supported.
*
* # The `$inject` property
*
* If a function has an `$inject` property and its value is an array of strings, then the strings represent names of
* services to be injected into the function.
* <pre>
* // Given
* var MyController = function(obfuscatedScope, obfuscatedRoute) {
* // ...
* }
* // Define function dependencies
* MyController.$inject = ['$scope', '$route'];
*
* // Then
* expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
* </pre>
*
* # The array notation
*
* It is often desirable to inline Injected functions and that's when setting the `$inject` property is very
* inconvenient. In these situations using the array notation to specify the dependencies in a way that survives
* minification is a better choice:
*
* <pre>
* // We wish to write this (not minification / obfuscation safe)
* injector.invoke(function($compile, $rootScope) {
* // ...
* });
*
* // We are forced to write break inlining
* var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
* // ...
* };
* tmpFn.$inject = ['$compile', '$rootScope'];
* injector.invoke(tmpFn);
*
* // To better support inline function the inline annotation is supported
* injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
* // ...
* }]);
*
* // Therefore
* expect(injector.annotate(
* ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
* ).toEqual(['$compile', '$rootScope']);
* </pre>
*
* @param {function|Array.<string|Function>} fn Function for which dependent service names need to be retrieved as described
* above.
*
* @returns {Array.<string>} The names of the services which the function requires.
*/
/**
* @ngdoc object
* @name AUTO.$provide
*
* @description
*
* Use `$provide` to register new providers with the `$injector`. The providers are the factories for the instance.
* The providers share the same name as the instance they create with `Provider` suffixed to them.
*
* A provider is an object with a `$get()` method. The injector calls the `$get` method to create a new instance of
* a service. The Provider can have additional methods which would allow for configuration of the provider.
*
* <pre>
* function GreetProvider() {
* var salutation = 'Hello';
*
* this.salutation = function(text) {
* salutation = text;
* };
*
* this.$get = function() {
* return function (name) {
* return salutation + ' ' + name + '!';
* };
* };
* }
*
* describe('Greeter', function(){
*
* beforeEach(module(function($provide) {
* $provide.provider('greet', GreetProvider);
* }));
*
* it('should greet', inject(function(greet) {
* expect(greet('angular')).toEqual('Hello angular!');
* }));
*
* it('should allow configuration of salutation', function() {
* module(function(greetProvider) {
* greetProvider.salutation('Ahoj');
* });
* inject(function(greet) {
* expect(greet('angular')).toEqual('Ahoj angular!');
* });
* });
* </pre>
*/
/**
* @ngdoc method
* @name AUTO.$provide#provider
* @methodOf AUTO.$provide
* @description
*
* Register a provider for a service. The providers can be retrieved and can have additional configuration methods.
*
* @param {string} name The name of the instance. NOTE: the provider will be available under `name + 'Provider'` key.
* @param {(Object|function())} provider If the provider is:
*
* - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
* {@link AUTO.$injector#invoke $injector.invoke()} when an instance needs to be created.
* - `Constructor`: a new instance of the provider will be created using
* {@link AUTO.$injector#instantiate $injector.instantiate()}, then treated as `object`.
*
* @returns {Object} registered provider instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#factory
* @methodOf AUTO.$provide
* @description
*
* A short hand for configuring services if only `$get` method is required.
*
* @param {string} name The name of the instance.
* @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand for
* `$provide.provider(name, {$get: $getFn})`.
* @returns {Object} registered provider instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#service
* @methodOf AUTO.$provide
* @description
*
* A short hand for registering service of given class.
*
* @param {string} name The name of the instance.
* @param {Function} constructor A class (constructor function) that will be instantiated.
* @returns {Object} registered provider instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#value
* @methodOf AUTO.$provide
* @description
*
* A short hand for configuring services if the `$get` method is a constant.
*
* @param {string} name The name of the instance.
* @param {*} value The value.
* @returns {Object} registered provider instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#constant
* @methodOf AUTO.$provide
* @description
*
* A constant value, but unlike {@link AUTO.$provide#value value} it can be injected
* into configuration function (other modules) and it is not interceptable by
* {@link AUTO.$provide#decorator decorator}.
*
* @param {string} name The name of the constant.
* @param {*} value The constant value.
* @returns {Object} registered instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#decorator
* @methodOf AUTO.$provide
* @description
*
* Decoration of service, allows the decorator to intercept the service instance creation. The
* returned instance may be the original instance, or a new instance which delegates to the
* original instance.
*
* @param {string} name The name of the service to decorate.
* @param {function()} decorator This function will be invoked when the service needs to be
* instantiated. The function is called using the {@link AUTO.$injector#invoke
* injector.invoke} method and is therefore fully injectable. Local injection arguments:
*
* * `$delegate` - The original service instance, which can be monkey patched, configured,
* decorated or delegated to.
*/
function createInjector(modulesToLoad) {
var INSTANTIATING = {},
providerSuffix = 'Provider',
path = [],
loadedModules = new HashMap(),
providerCache = {
$provide: {
provider: supportObject(provider),
factory: supportObject(factory),
service: supportObject(service),
value: supportObject(value),
constant: supportObject(constant),
decorator: decorator
}
},
providerInjector = createInternalInjector(providerCache, function() {
throw Error("Unknown provider: " + path.join(' <- '));
}),
instanceCache = {},
instanceInjector = (instanceCache.$injector =
createInternalInjector(instanceCache, function(servicename) {
var provider = providerInjector.get(servicename + providerSuffix);
return instanceInjector.invoke(provider.$get, provider);
}));
forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); });
return instanceInjector;
////////////////////////////////////
// $provider
////////////////////////////////////
function supportObject(delegate) {
return function(key, value) {
if (isObject(key)) {
forEach(key, reverseParams(delegate));
} else {
return delegate(key, value);
}
}
}
function provider(name, provider_) {
if (isFunction(provider_) || isArray(provider_)) {
provider_ = providerInjector.instantiate(provider_);
}
if (!provider_.$get) {
throw Error('Provider ' + name + ' must define $get factory method.');
}
return providerCache[name + providerSuffix] = provider_;
}
function factory(name, factoryFn) { return provider(name, { $get: factoryFn }); }
function service(name, constructor) {
return factory(name, ['$injector', function($injector) {
return $injector.instantiate(constructor);
}]);
}
function value(name, value) { return factory(name, valueFn(value)); }
function constant(name, value) {
providerCache[name] = value;
instanceCache[name] = value;
}
function decorator(serviceName, decorFn) {
var origProvider = providerInjector.get(serviceName + providerSuffix),
orig$get = origProvider.$get;
origProvider.$get = function() {
var origInstance = instanceInjector.invoke(orig$get, origProvider);
return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});
};
}
////////////////////////////////////
// Module Loading
////////////////////////////////////
function loadModules(modulesToLoad){
var runBlocks = [];
forEach(modulesToLoad, function(module) {
if (loadedModules.get(module)) return;
loadedModules.put(module, true);
if (isString(module)) {
var moduleFn = angularModule(module);
runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
try {
for(var invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {
var invokeArgs = invokeQueue[i],
provider = invokeArgs[0] == '$injector'
? providerInjector
: providerInjector.get(invokeArgs[0]);
provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
}
} catch (e) {
if (e.message) e.message += ' from ' + module;
throw e;
}
} else if (isFunction(module)) {
try {
runBlocks.push(providerInjector.invoke(module));
} catch (e) {
if (e.message) e.message += ' from ' + module;
throw e;
}
} else if (isArray(module)) {
try {
runBlocks.push(providerInjector.invoke(module));
} catch (e) {
if (e.message) e.message += ' from ' + String(module[module.length - 1]);
throw e;
}
} else {
assertArgFn(module, 'module');
}
});
return runBlocks;
}
////////////////////////////////////
// internal Injector
////////////////////////////////////
function createInternalInjector(cache, factory) {
function getService(serviceName) {
if (typeof serviceName !== 'string') {
throw Error('Service name expected');
}
if (cache.hasOwnProperty(serviceName)) {
if (cache[serviceName] === INSTANTIATING) {
throw Error('Circular dependency: ' + path.join(' <- '));
}
return cache[serviceName];
} else {
try {
path.unshift(serviceName);
cache[serviceName] = INSTANTIATING;
return cache[serviceName] = factory(serviceName);
} finally {
path.shift();
}
}
}
function invoke(fn, self, locals){
var args = [],
$inject = annotate(fn),
length, i,
key;
for(i = 0, length = $inject.length; i < length; i++) {
key = $inject[i];
args.push(
locals && locals.hasOwnProperty(key)
? locals[key]
: getService(key)
);
}
if (!fn.$inject) {
// this means that we must be an array.
fn = fn[length];
}
// Performance optimization: http://jsperf.com/apply-vs-call-vs-invoke
switch (self ? -1 : args.length) {
case 0: return fn();
case 1: return fn(args[0]);
case 2: return fn(args[0], args[1]);
case 3: return fn(args[0], args[1], args[2]);
case 4: return fn(args[0], args[1], args[2], args[3]);
case 5: return fn(args[0], args[1], args[2], args[3], args[4]);
case 6: return fn(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
case 8: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
case 9: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
case 10: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
default: return fn.apply(self, args);
}
}
function instantiate(Type, locals) {
var Constructor = function() {},
instance, returnedValue;
// Check if Type is annotated and use just the given function at n-1 as parameter
// e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;
instance = new Constructor();
returnedValue = invoke(Type, instance, locals);
return isObject(returnedValue) ? returnedValue : instance;
}
return {
invoke: invoke,
instantiate: instantiate,
get: getService,
annotate: annotate
};
}
}
/**
* @ngdoc function
* @name ng.$anchorScroll
* @requires $window
* @requires $location
* @requires $rootScope
*
* @description
* When called, it checks current value of `$location.hash()` and scroll to related element,
* according to rules specified in
* {@link http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document Html5 spec}.
*
* It also watches the `$location.hash()` and scroll whenever it changes to match any anchor.
* This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`.
*/
function $AnchorScrollProvider() {
var autoScrollingEnabled = true;
this.disableAutoScrolling = function() {
autoScrollingEnabled = false;
};
this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
var document = $window.document;
// helper function to get first anchor from a NodeList
// can't use filter.filter, as it accepts only instances of Array
// and IE can't convert NodeList to an array using [].slice
// TODO(vojta): use filter if we change it to accept lists as well
function getFirstAnchor(list) {
var result = null;
forEach(list, function(element) {
if (!result && lowercase(element.nodeName) === 'a') result = element;
});
return result;
}
function scroll() {
var hash = $location.hash(), elm;
// empty hash, scroll to the top of the page
if (!hash) $window.scrollTo(0, 0);
// element with given id
else if ((elm = document.getElementById(hash))) elm.scrollIntoView();
// first anchor with given name :-D
else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();
// no element and hash == 'top', scroll to the top of the page
else if (hash === 'top') $window.scrollTo(0, 0);
}
// does not scroll when user clicks on anchor link that is currently on
// (no url change, no $location.hash() change), browser native does scroll
if (autoScrollingEnabled) {
$rootScope.$watch(function autoScrollWatch() {return $location.hash();},
function autoScrollWatchAction() {
$rootScope.$evalAsync(scroll);
});
}
return scroll;
}];
}
/**
* ! This is a private undocumented service !
*
* @name ng.$browser
* @requires $log
* @description
* This object has two goals:
*
* - hide all the global state in the browser caused by the window object
* - abstract away all the browser specific features and inconsistencies
*
* For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`
* service, which can be used for convenient testing of the application without the interaction with
* the real browser apis.
*/
/**
* @param {object} window The global window object.
* @param {object} document jQuery wrapped document.
* @param {function()} XHR XMLHttpRequest constructor.
* @param {object} $log console.log or an object with the same interface.
* @param {object} $sniffer $sniffer service
*/
function Browser(window, document, $log, $sniffer) {
var self = this,
rawDocument = document[0],
location = window.location,
history = window.history,
setTimeout = window.setTimeout,
clearTimeout = window.clearTimeout,
pendingDeferIds = {};
self.isMock = false;
var outstandingRequestCount = 0;
var outstandingRequestCallbacks = [];
// TODO(vojta): remove this temporary api
self.$$completeOutstandingRequest = completeOutstandingRequest;
self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
/**
* Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
* counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
*/
function completeOutstandingRequest(fn) {
try {
fn.apply(null, sliceArgs(arguments, 1));
} finally {
outstandingRequestCount--;
if (outstandingRequestCount === 0) {
while(outstandingRequestCallbacks.length) {
try {
outstandingRequestCallbacks.pop()();
} catch (e) {
$log.error(e);
}
}
}
}
}
/**
* @private
* Note: this method is used only by scenario runner
* TODO(vojta): prefix this method with $$ ?
* @param {function()} callback Function that will be called when no outstanding request
*/
self.notifyWhenNoOutstandingRequests = function(callback) {
// force browser to execute all pollFns - this is needed so that cookies and other pollers fire
// at some deterministic time in respect to the test runner's actions. Leaving things up to the
// regular poller would result in flaky tests.
forEach(pollFns, function(pollFn){ pollFn(); });
if (outstandingRequestCount === 0) {
callback();
} else {
outstandingRequestCallbacks.push(callback);
}
};
//////////////////////////////////////////////////////////////
// Poll Watcher API
//////////////////////////////////////////////////////////////
var pollFns = [],
pollTimeout;
/**
* @name ng.$browser#addPollFn
* @methodOf ng.$browser
*
* @param {function()} fn Poll function to add
*
* @description
* Adds a function to the list of functions that poller periodically executes,
* and starts polling if not started yet.
*
* @returns {function()} the added function
*/
self.addPollFn = function(fn) {
if (isUndefined(pollTimeout)) startPoller(100, setTimeout);
pollFns.push(fn);
return fn;
};
/**
* @param {number} interval How often should browser call poll functions (ms)
* @param {function()} setTimeout Reference to a real or fake `setTimeout` function.
*
* @description
* Configures the poller to run in the specified intervals, using the specified
* setTimeout fn and kicks it off.
*/
function startPoller(interval, setTimeout) {
(function check() {
forEach(pollFns, function(pollFn){ pollFn(); });
pollTimeout = setTimeout(check, interval);
})();
}
//////////////////////////////////////////////////////////////
// URL API
//////////////////////////////////////////////////////////////
var lastBrowserUrl = location.href,
baseElement = document.find('base'),
replacedUrl = null;
/**
* @name ng.$browser#url
* @methodOf ng.$browser
*
* @description
* GETTER:
* Without any argument, this method just returns current value of location.href.
*
* SETTER:
* With at least one argument, this method sets url to new value.
* If html5 history api supported, pushState/replaceState is used, otherwise
* location.href/location.replace is used.
* Returns its own instance to allow chaining
*
* NOTE: this api is intended for use only by the $location service. Please use the
* {@link ng.$location $location service} to change url.
*
* @param {string} url New url (when used as setter)
* @param {boolean=} replace Should new url replace current history record ?
*/
self.url = function(url, replace) {
// setter
if (url) {
if (lastBrowserUrl == url) return;
lastBrowserUrl = url;
if ($sniffer.history) {
if (replace) history.replaceState(null, '', url);
else {
history.pushState(null, '', url);
// Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462
baseElement.attr('href', baseElement.attr('href'));
}
} else {
if (replace) {
location.replace(url);
replacedUrl = url;
} else {
location.href = url;
replacedUrl = null;
}
}
return self;
// getter
} else {
// - the replacedUrl is a workaround for an IE8-9 issue with location.replace method that doesn't update
// location.href synchronously
// - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
return replacedUrl || location.href.replace(/%27/g,"'");
}
};
var urlChangeListeners = [],
urlChangeInit = false;
function fireUrlChange() {
if (lastBrowserUrl == self.url()) return;
lastBrowserUrl = self.url();
forEach(urlChangeListeners, function(listener) {
listener(self.url());
});
}
/**
* @name ng.$browser#onUrlChange
* @methodOf ng.$browser
* @TODO(vojta): refactor to use node's syntax for events
*
* @description
* Register callback function that will be called, when url changes.
*
* It's only called when the url is changed by outside of angular:
* - user types different url into address bar
* - user clicks on history (forward/back) button
* - user clicks on a link
*
* It's not called when url is changed by $browser.url() method
*
* The listener gets called with new url as parameter.
*
* NOTE: this api is intended for use only by the $location service. Please use the
* {@link ng.$location $location service} to monitor url changes in angular apps.
*
* @param {function(string)} listener Listener function to be called when url changes.
* @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.
*/
self.onUrlChange = function(callback) {
if (!urlChangeInit) {
// We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
// don't fire popstate when user change the address bar and don't fire hashchange when url
// changed by push/replaceState
// html5 history api - popstate event
if ($sniffer.history) jqLite(window).bind('popstate', fireUrlChange);
// hashchange event
if ($sniffer.hashchange) jqLite(window).bind('hashchange', fireUrlChange);
// polling
else self.addPollFn(fireUrlChange);
urlChangeInit = true;
}
urlChangeListeners.push(callback);
return callback;
};
//////////////////////////////////////////////////////////////
// Misc API
//////////////////////////////////////////////////////////////
/**
* Returns current <base href>
* (always relative - without domain)
*
* @returns {string=}
*/
self.baseHref = function() {
var href = baseElement.attr('href');
return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : '';
};
//////////////////////////////////////////////////////////////
// Cookies API
//////////////////////////////////////////////////////////////
var lastCookies = {};
var lastCookieString = '';
var cookiePath = self.baseHref();
/**
* @name ng.$browser#cookies
* @methodOf ng.$browser
*
* @param {string=} name Cookie name
* @param {string=} value Cokkie value
*
* @description
* The cookies method provides a 'private' low level access to browser cookies.
* It is not meant to be used directly, use the $cookie service instead.
*
* The return values vary depending on the arguments that the method was called with as follows:
* <ul>
* <li>cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify it</li>
* <li>cookies(name, value) -> set name to value, if value is undefined delete the cookie</li>
* <li>cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that way)</li>
* </ul>
*
* @returns {Object} Hash of all cookies (if called without any parameter)
*/
self.cookies = function(name, value) {
var cookieLength, cookieArray, cookie, i, index;
if (name) {
if (value === undefined) {
rawDocument.cookie = escape(name) + "=;path=" + cookiePath + ";expires=Thu, 01 Jan 1970 00:00:00 GMT";
} else {
if (isString(value)) {
cookieLength = (rawDocument.cookie = escape(name) + '=' + escape(value) + ';path=' + cookiePath).length + 1;
// per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
// - 300 cookies
// - 20 cookies per unique domain
// - 4096 bytes per cookie
if (cookieLength > 4096) {
$log.warn("Cookie '"+ name +"' possibly not set or overflowed because it was too large ("+
cookieLength + " > 4096 bytes)!");
}
}
}
} else {
if (rawDocument.cookie !== lastCookieString) {
lastCookieString = rawDocument.cookie;
cookieArray = lastCookieString.split("; ");
lastCookies = {};
for (i = 0; i < cookieArray.length; i++) {
cookie = cookieArray[i];
index = cookie.indexOf('=');
if (index > 0) { //ignore nameless cookies
var name = unescape(cookie.substring(0, index));
// the first value that is seen for a cookie is the most
// specific one. values for the same cookie name that
// follow are for less specific paths.
if (lastCookies[name] === undefined) {
lastCookies[name] = unescape(cookie.substring(index + 1));
}
}
}
}
return lastCookies;
}
};
/**
* @name ng.$browser#defer
* @methodOf ng.$browser
* @param {function()} fn A function, who's execution should be defered.
* @param {number=} [delay=0] of milliseconds to defer the function execution.
* @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.
*
* @description
* Executes a fn asynchroniously via `setTimeout(fn, delay)`.
*
* Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using
* `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed
* via `$browser.defer.flush()`.
*
*/
self.defer = function(fn, delay) {
var timeoutId;
outstandingRequestCount++;
timeoutId = setTimeout(function() {
delete pendingDeferIds[timeoutId];
completeOutstandingRequest(fn);
}, delay || 0);
pendingDeferIds[timeoutId] = true;
return timeoutId;
};
/**
* @name ng.$browser#defer.cancel
* @methodOf ng.$browser.defer
*
* @description
* Cancels a defered task identified with `deferId`.
*
* @param {*} deferId Token returned by the `$browser.defer` function.
* @returns {boolean} Returns `true` if the task hasn't executed yet and was successfuly canceled.
*/
self.defer.cancel = function(deferId) {
if (pendingDeferIds[deferId]) {
delete pendingDeferIds[deferId];
clearTimeout(deferId);
completeOutstandingRequest(noop);
return true;
}
return false;
};
}
function $BrowserProvider(){
this.$get = ['$window', '$log', '$sniffer', '$document',
function( $window, $log, $sniffer, $document){
return new Browser($window, $document, $log, $sniffer);
}];
}
/**
* @ngdoc object
* @name ng.$cacheFactory
*
* @description
* Factory that constructs cache objects and gives access to them.
*
* <pre>
*
* var cache = $cacheFactory('cacheId');
* expect($cacheFactory.get('cacheId')).toBe(cache);
* expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
*
* cache.put("key", "value");
* cache.put("another key", "another value");
*
* expect(cache.info()).toEqual({id: 'cacheId', size: 2}); // Since we've specified no options on creation
*
* </pre>
*
*
* @param {string} cacheId Name or id of the newly created cache.
* @param {object=} options Options object that specifies the cache behavior. Properties:
*
* - `{number=}` `capacity` — turns the cache into LRU cache.
*
* @returns {object} Newly created cache object with the following set of methods:
*
* - `{object}` `info()` — Returns id, size, and options of cache.
* - `{void}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache.
* - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
* - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
* - `{void}` `removeAll()` — Removes all cached values.
* - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
*
*/
function $CacheFactoryProvider() {
this.$get = function() {
var caches = {};
function cacheFactory(cacheId, options) {
if (cacheId in caches) {
throw Error('cacheId ' + cacheId + ' taken');
}
var size = 0,
stats = extend({}, options, {id: cacheId}),
data = {},
capacity = (options && options.capacity) || Number.MAX_VALUE,
lruHash = {},
freshEnd = null,
staleEnd = null;
return caches[cacheId] = {
put: function(key, value) {
var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
refresh(lruEntry);
if (isUndefined(value)) return;
if (!(key in data)) size++;
data[key] = value;
if (size > capacity) {
this.remove(staleEnd.key);
}
},
get: function(key) {
var lruEntry = lruHash[key];
if (!lruEntry) return;
refresh(lruEntry);
return data[key];
},
remove: function(key) {
var lruEntry = lruHash[key];
if (!lruEntry) return;
if (lruEntry == freshEnd) freshEnd = lruEntry.p;
if (lruEntry == staleEnd) staleEnd = lruEntry.n;
link(lruEntry.n,lruEntry.p);
delete lruHash[key];
delete data[key];
size--;
},
removeAll: function() {
data = {};
size = 0;
lruHash = {};
freshEnd = staleEnd = null;
},
destroy: function() {
data = null;
stats = null;
lruHash = null;
delete caches[cacheId];
},
info: function() {
return extend({}, stats, {size: size});
}
};
/**
* makes the `entry` the freshEnd of the LRU linked list
*/
function refresh(entry) {
if (entry != freshEnd) {
if (!staleEnd) {
staleEnd = entry;
} else if (staleEnd == entry) {
staleEnd = entry.n;
}
link(entry.n, entry.p);
link(entry, freshEnd);
freshEnd = entry;
freshEnd.n = null;
}
}
/**
* bidirectionally links two entries of the LRU linked list
*/
function link(nextEntry, prevEntry) {
if (nextEntry != prevEntry) {
if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
}
}
}
/**
* @ngdoc method
* @name ng.$cacheFactory#info
* @methodOf ng.$cacheFactory
*
* @description
* Get information about all the of the caches that have been created
*
* @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`
*/
cacheFactory.info = function() {
var info = {};
forEach(caches, function(cache, cacheId) {
info[cacheId] = cache.info();
});
return info;
};
/**
* @ngdoc method
* @name ng.$cacheFactory#get
* @methodOf ng.$cacheFactory
*
* @description
* Get access to a cache object by the `cacheId` used when it was created.
*
* @param {string} cacheId Name or id of a cache to access.
* @returns {object} Cache object identified by the cacheId or undefined if no such cache.
*/
cacheFactory.get = function(cacheId) {
return caches[cacheId];
};
return cacheFactory;
};
}
/**
* @ngdoc object
* @name ng.$templateCache
*
* @description
* The first time a template is used, it is loaded in the template cache for quick retrieval. You can
* load templates directly into the cache in a `script` tag, or by consuming the `$templateCache`
* service directly.
*
* Adding via the `script` tag:
* <pre>
* <html ng-app>
* <head>
* <script type="text/ng-template" id="templateId.html">
* This is the content of the template
* </script>
* </head>
* ...
* </html>
* </pre>
*
* **Note:** the `script` tag containing the template does not need to be included in the `head` of the document, but
* it must be below the `ng-app` definition.
*
* Adding via the $templateCache service:
*
* <pre>
* var myApp = angular.module('myApp', []);
* myApp.run(function($templateCache) {
* $templateCache.put('templateId.html', 'This is the content of the template');
* });
* </pre>
*
* To retrieve the template later, simply use it in your HTML:
* <pre>
* <div ng-include=" 'templateId.html' "></div>
* </pre>
*
* or get it via Javascript:
* <pre>
* $templateCache.get('templateId.html')
* </pre>
*
* See {@link ng.$cacheFactory $cacheFactory}.
*
*/
function $TemplateCacheProvider() {
this.$get = ['$cacheFactory', function($cacheFactory) {
return $cacheFactory('templates');
}];
}
/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
*
* DOM-related variables:
*
* - "node" - DOM Node
* - "element" - DOM Element or Node
* - "$node" or "$element" - jqLite-wrapped node or element
*
*
* Compiler related stuff:
*
* - "linkFn" - linking fn of a single directive
* - "nodeLinkFn" - function that aggregates all linking fns for a particular node
* - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node
* - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList)
*/
var NON_ASSIGNABLE_MODEL_EXPRESSION = 'Non-assignable model expression: ';
/**
* @ngdoc function
* @name ng.$compile
* @function
*
* @description
* Compiles a piece of HTML string or DOM into a template and produces a template function, which
* can then be used to link {@link ng.$rootScope.Scope scope} and the template together.
*
* The compilation is a process of walking the DOM tree and trying to match DOM elements to
* {@link ng.$compileProvider#directive directives}. For each match it
* executes corresponding template function and collects the
* instance functions into a single template function which is then returned.
*
* The template function can then be used once to produce the view or as it is the case with
* {@link ng.directive:ngRepeat repeater} many-times, in which
* case each call results in a view that is a DOM clone of the original template.
*
<doc:example module="compile">
<doc:source>
<script>
// declare a new module, and inject the $compileProvider
angular.module('compile', [], function($compileProvider) {
// configure new 'compile' directive by passing a directive
// factory function. The factory function injects the '$compile'
$compileProvider.directive('compile', function($compile) {
// directive factory creates a link function
return function(scope, element, attrs) {
scope.$watch(
function(scope) {
// watch the 'compile' expression for changes
return scope.$eval(attrs.compile);
},
function(value) {
// when the 'compile' expression changes
// assign it into the current DOM
element.html(value);
// compile the new DOM and link it to the current
// scope.
// NOTE: we only compile .childNodes so that
// we don't get into infinite loop compiling ourselves
$compile(element.contents())(scope);
}
);
};
})
});
function Ctrl($scope) {
$scope.name = 'Angular';
$scope.html = 'Hello {{name}}';
}
</script>
<div ng-controller="Ctrl">
<input ng-model="name"> <br>
<textarea ng-model="html"></textarea> <br>
<div compile="html"></div>
</div>
</doc:source>
<doc:scenario>
it('should auto compile', function() {
expect(element('div[compile]').text()).toBe('Hello Angular');
input('html').enter('{{name}}!');
expect(element('div[compile]').text()).toBe('Angular!');
});
</doc:scenario>
</doc:example>
*
*
* @param {string|DOMElement} element Element or HTML string to compile into a template function.
* @param {function(angular.Scope[, cloneAttachFn]} transclude function available to directives.
* @param {number} maxPriority only apply directives lower then given priority (Only effects the
* root element(s), not their children)
* @returns {function(scope[, cloneAttachFn])} a link function which is used to bind template
* (a DOM element/tree) to a scope. Where:
*
* * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.
* * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
* `template` and call the `cloneAttachFn` function allowing the caller to attach the
* cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
* called as: <br> `cloneAttachFn(clonedElement, scope)` where:
*
* * `clonedElement` - is a clone of the original `element` passed into the compiler.
* * `scope` - is the current scope with which the linking function is working with.
*
* Calling the linking function returns the element of the template. It is either the original element
* passed in, or the clone of the element if the `cloneAttachFn` is provided.
*
* After linking the view is not updated until after a call to $digest which typically is done by
* Angular automatically.
*
* If you need access to the bound view, there are two ways to do it:
*
* - If you are not asking the linking function to clone the template, create the DOM element(s)
* before you send them to the compiler and keep this reference around.
* <pre>
* var element = $compile('<p>{{total}}</p>')(scope);
* </pre>
*
* - if on the other hand, you need the element to be cloned, the view reference from the original
* example would not point to the clone, but rather to the original template that was cloned. In
* this case, you can access the clone via the cloneAttachFn:
* <pre>
* var templateHTML = angular.element('<p>{{total}}</p>'),
* scope = ....;
*
* var clonedElement = $compile(templateHTML)(scope, function(clonedElement, scope) {
* //attach the clone to DOM document at the right place
* });
*
* //now we have reference to the cloned DOM via `clone`
* </pre>
*
*
* For information on how the compiler works, see the
* {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
*/
/**
* @ngdoc service
* @name ng.$compileProvider
* @function
*
* @description
*/
$CompileProvider.$inject = ['$provide'];
function $CompileProvider($provide) {
var hasDirectives = {},
Suffix = 'Directive',
COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/,
MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ',
urlSanitizationWhitelist = /^\s*(https?|ftp|mailto|file):/;
/**
* @ngdoc function
* @name ng.$compileProvider#directive
* @methodOf ng.$compileProvider
* @function
*
* @description
* Register a new directive with the compiler.
*
* @param {string} name Name of the directive in camel-case. (ie <code>ngBind</code> which will match as
* <code>ng-bind</code>).
* @param {function|Array} directiveFactory An injectable directive factory function. See {@link guide/directive} for more
* info.
* @returns {ng.$compileProvider} Self for chaining.
*/
this.directive = function registerDirective(name, directiveFactory) {
if (isString(name)) {
assertArg(directiveFactory, 'directive');
if (!hasDirectives.hasOwnProperty(name)) {
hasDirectives[name] = [];
$provide.factory(name + Suffix, ['$injector', '$exceptionHandler',
function($injector, $exceptionHandler) {
var directives = [];
forEach(hasDirectives[name], function(directiveFactory) {
try {
var directive = $injector.invoke(directiveFactory);
if (isFunction(directive)) {
directive = { compile: valueFn(directive) };
} else if (!directive.compile && directive.link) {
directive.compile = valueFn(directive.link);
}
directive.priority = directive.priority || 0;
directive.name = directive.name || name;
directive.require = directive.require || (directive.controller && directive.name);
directive.restrict = directive.restrict || 'A';
directives.push(directive);
} catch (e) {
$exceptionHandler(e);
}
});
return directives;
}]);
}
hasDirectives[name].push(directiveFactory);
} else {
forEach(name, reverseParams(registerDirective));
}
return this;
};
/**
* @ngdoc function
* @name ng.$compileProvider#urlSanitizationWhitelist
* @methodOf ng.$compileProvider
* @function
*
* @description
* Retrieves or overrides the default regular expression that is used for whitelisting of safe
* urls during a[href] sanitization.
*
* The sanitization is a security measure aimed at prevent XSS attacks via html links.
*
* Any url about to be assigned to a[href] via data-binding is first normalized and turned into an
* absolute url. Afterwards the url is matched against the `urlSanitizationWhitelist` regular
* expression. If a match is found the original url is written into the dom. Otherwise the
* absolute url is prefixed with `'unsafe:'` string and only then it is written into the DOM.
*
* @param {RegExp=} regexp New regexp to whitelist urls with.
* @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
* chaining otherwise.
*/
this.urlSanitizationWhitelist = function(regexp) {
if (isDefined(regexp)) {
urlSanitizationWhitelist = regexp;
return this;
}
return urlSanitizationWhitelist;
};
this.$get = [
'$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse',
'$controller', '$rootScope', '$document',
function($injector, $interpolate, $exceptionHandler, $http, $templateCache, $parse,
$controller, $rootScope, $document) {
var Attributes = function(element, attr) {
this.$$element = element;
this.$attr = attr || {};
};
Attributes.prototype = {
$normalize: directiveNormalize,
/**
* Set a normalized attribute on the element in a way such that all directives
* can share the attribute. This function properly handles boolean attributes.
* @param {string} key Normalized key. (ie ngAttribute)
* @param {string|boolean} value The value to set. If `null` attribute will be deleted.
* @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.
* Defaults to true.
* @param {string=} attrName Optional none normalized name. Defaults to key.
*/
$set: function(key, value, writeAttr, attrName) {
var booleanKey = getBooleanAttrName(this.$$element[0], key),
$$observers = this.$$observers,
normalizedVal;
if (booleanKey) {
this.$$element.prop(key, value);
attrName = booleanKey;
}
this[key] = value;
// translate normalized key to actual key
if (attrName) {
this.$attr[key] = attrName;
} else {
attrName = this.$attr[key];
if (!attrName) {
this.$attr[key] = attrName = snake_case(key, '-');
}
}
// sanitize a[href] values
if (nodeName_(this.$$element[0]) === 'A' && key === 'href') {
urlSanitizationNode.setAttribute('href', value);
// href property always returns normalized absolute url, so we can match against that
normalizedVal = urlSanitizationNode.href;
if (normalizedVal !== '' && !normalizedVal.match(urlSanitizationWhitelist)) {
this[key] = value = 'unsafe:' + normalizedVal;
}
}
if (writeAttr !== false) {
if (value === null || value === undefined) {
this.$$element.removeAttr(attrName);
} else {
this.$$element.attr(attrName, value);
}
}
// fire observers
$$observers && forEach($$observers[key], function(fn) {
try {
fn(value);
} catch (e) {
$exceptionHandler(e);
}
});
},
/**
* Observe an interpolated attribute.
* The observer will never be called, if given attribute is not interpolated.
*
* @param {string} key Normalized key. (ie ngAttribute) .
* @param {function(*)} fn Function that will be called whenever the attribute value changes.
* @returns {function(*)} the `fn` Function passed in.
*/
$observe: function(key, fn) {
var attrs = this,
$$observers = (attrs.$$observers || (attrs.$$observers = {})),
listeners = ($$observers[key] || ($$observers[key] = []));
listeners.push(fn);
$rootScope.$evalAsync(function() {
if (!listeners.$$inter) {
// no one registered attribute interpolation function, so lets call it manually
fn(attrs[key]);
}
});
return fn;
}
};
var urlSanitizationNode = $document[0].createElement('a'),
startSymbol = $interpolate.startSymbol(),
endSymbol = $interpolate.endSymbol(),
denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
? identity
: function denormalizeTemplate(template) {
return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
};
return compile;
//================================
function compile($compileNodes, transcludeFn, maxPriority) {
if (!($compileNodes instanceof jqLite)) {
// jquery always rewraps, whereas we need to preserve the original selector so that we can modify it.
$compileNodes = jqLite($compileNodes);
}
// We can not compile top level text elements since text nodes can be merged and we will
// not be able to attach scope data to them, so we will wrap them in <span>
forEach($compileNodes, function(node, index){
if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\S+/) /* non-empty */ ) {
$compileNodes[index] = jqLite(node).wrap('<span></span>').parent()[0];
}
});
var compositeLinkFn = compileNodes($compileNodes, transcludeFn, $compileNodes, maxPriority);
return function publicLinkFn(scope, cloneConnectFn){
assertArg(scope, 'scope');
// important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
// and sometimes changes the structure of the DOM.
var $linkNode = cloneConnectFn
? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
: $compileNodes;
// Attach scope only to non-text nodes.
for(var i = 0, ii = $linkNode.length; i<ii; i++) {
var node = $linkNode[i];
if (node.nodeType == 1 /* element */ || node.nodeType == 9 /* document */) {
$linkNode.eq(i).data('$scope', scope);
}
}
safeAddClass($linkNode, 'ng-scope');
if (cloneConnectFn) cloneConnectFn($linkNode, scope);
if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode);
return $linkNode;
};
}
function wrongMode(localName, mode) {
throw Error("Unsupported '" + mode + "' for '" + localName + "'.");
}
function safeAddClass($element, className) {
try {
$element.addClass(className);
} catch(e) {
// ignore, since it means that we are trying to set class on
// SVG element, where class name is read-only.
}
}
/**
* Compile function matches each node in nodeList against the directives. Once all directives
* for a particular node are collected their compile functions are executed. The compile
* functions return values - the linking functions - are combined into a composite linking
* function, which is the a linking function for the node.
*
* @param {NodeList} nodeList an array of nodes or NodeList to compile
* @param {function(angular.Scope[, cloneAttachFn]} transcludeFn A linking function, where the
* scope argument is auto-generated to the new child of the transcluded parent scope.
* @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then the
* rootElement must be set the jqLite collection of the compile root. This is
* needed so that the jqLite collection items can be replaced with widgets.
* @param {number=} max directive priority
* @returns {?function} A composite linking function of all of the matched directives or null.
*/
function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority) {
var linkFns = [],
nodeLinkFn, childLinkFn, directives, attrs, linkFnFound;
for(var i = 0; i < nodeList.length; i++) {
attrs = new Attributes();
// we must always refer to nodeList[i] since the nodes can be replaced underneath us.
directives = collectDirectives(nodeList[i], [], attrs, maxPriority);
nodeLinkFn = (directives.length)
? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement)
: null;
childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes || !nodeList[i].childNodes.length)
? null
: compileNodes(nodeList[i].childNodes,
nodeLinkFn ? nodeLinkFn.transclude : transcludeFn);
linkFns.push(nodeLinkFn);
linkFns.push(childLinkFn);
linkFnFound = (linkFnFound || nodeLinkFn || childLinkFn);
}
// return a linking function if we have found anything, null otherwise
return linkFnFound ? compositeLinkFn : null;
function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) {
var nodeLinkFn, childLinkFn, node, childScope, childTranscludeFn, i, ii, n;
// copy nodeList so that linking doesn't break due to live list updates.
var stableNodeList = [];
for (i = 0, ii = nodeList.length; i < ii; i++) {
stableNodeList.push(nodeList[i]);
}
for(i = 0, n = 0, ii = linkFns.length; i < ii; n++) {
node = stableNodeList[n];
nodeLinkFn = linkFns[i++];
childLinkFn = linkFns[i++];
if (nodeLinkFn) {
if (nodeLinkFn.scope) {
childScope = scope.$new(isObject(nodeLinkFn.scope));
jqLite(node).data('$scope', childScope);
} else {
childScope = scope;
}
childTranscludeFn = nodeLinkFn.transclude;
if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) {
nodeLinkFn(childLinkFn, childScope, node, $rootElement,
(function(transcludeFn) {
return function(cloneFn) {
var transcludeScope = scope.$new();
transcludeScope.$$transcluded = true;
return transcludeFn(transcludeScope, cloneFn).
bind('$destroy', bind(transcludeScope, transcludeScope.$destroy));
};
})(childTranscludeFn || transcludeFn)
);
} else {
nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn);
}
} else if (childLinkFn) {
childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn);
}
}
}
}
/**
* Looks for directives on the given node and adds them to the directive collection which is
* sorted.
*
* @param node Node to search.
* @param directives An array to which the directives are added to. This array is sorted before
* the function returns.
* @param attrs The shared attrs object which is used to populate the normalized attributes.
* @param {number=} maxPriority Max directive priority.
*/
function collectDirectives(node, directives, attrs, maxPriority) {
var nodeType = node.nodeType,
attrsMap = attrs.$attr,
match,
className;
switch(nodeType) {
case 1: /* Element */
// use the node name: <directive>
addDirective(directives,
directiveNormalize(nodeName_(node).toLowerCase()), 'E', maxPriority);
// iterate over the attributes
for (var attr, name, nName, value, nAttrs = node.attributes,
j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
attr = nAttrs[j];
if (!msie || msie >= 8 || attr.specified) {
name = attr.name;
nName = directiveNormalize(name.toLowerCase());
attrsMap[nName] = name;
attrs[nName] = value = trim((msie && name == 'href')
? decodeURIComponent(node.getAttribute(name, 2))
: attr.value);
if (getBooleanAttrName(node, nName)) {
attrs[nName] = true; // presence means true
}
addAttrInterpolateDirective(node, directives, value, nName);
addDirective(directives, nName, 'A', maxPriority);
}
}
// use class as directive
className = node.className;
if (isString(className) && className !== '') {
while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {
nName = directiveNormalize(match[2]);
if (addDirective(directives, nName, 'C', maxPriority)) {
attrs[nName] = trim(match[3]);
}
className = className.substr(match.index + match[0].length);
}
}
break;
case 3: /* Text Node */
addTextInterpolateDirective(directives, node.nodeValue);
break;
case 8: /* Comment */
try {
match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
if (match) {
nName = directiveNormalize(match[1]);
if (addDirective(directives, nName, 'M', maxPriority)) {
attrs[nName] = trim(match[2]);
}
}
} catch (e) {
// turns out that under some circumstances IE9 throws errors when one attempts to read comment's node value.
// Just ignore it and continue. (Can't seem to reproduce in test case.)
}
break;
}
directives.sort(byPriority);
return directives;
}
/**
* Once the directives have been collected, their compile functions are executed. This method
* is responsible for inlining directive templates as well as terminating the application
* of the directives if the terminal directive has been reached.
*
* @param {Array} directives Array of collected directives to execute their compile function.
* this needs to be pre-sorted by priority order.
* @param {Node} compileNode The raw DOM node to apply the compile functions to
* @param {Object} templateAttrs The shared attribute function
* @param {function(angular.Scope[, cloneAttachFn]} transcludeFn A linking function, where the
* scope argument is auto-generated to the new child of the transcluded parent scope.
* @param {JQLite} jqCollection If we are working on the root of the compile tree then this
* argument has the root jqLite array so that we can replace nodes on it.
* @returns linkFn
*/
function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, jqCollection) {
var terminalPriority = -Number.MAX_VALUE,
preLinkFns = [],
postLinkFns = [],
newScopeDirective = null,
newIsolateScopeDirective = null,
templateDirective = null,
$compileNode = templateAttrs.$$element = jqLite(compileNode),
directive,
directiveName,
$template,
transcludeDirective,
childTranscludeFn = transcludeFn,
controllerDirectives,
linkFn,
directiveValue;
// executes all directives on the current element
for(var i = 0, ii = directives.length; i < ii; i++) {
directive = directives[i];
$template = undefined;
if (terminalPriority > directive.priority) {
break; // prevent further processing of directives
}
if (directiveValue = directive.scope) {
assertNoDuplicate('isolated scope', newIsolateScopeDirective, directive, $compileNode);
if (isObject(directiveValue)) {
safeAddClass($compileNode, 'ng-isolate-scope');
newIsolateScopeDirective = directive;
}
safeAddClass($compileNode, 'ng-scope');
newScopeDirective = newScopeDirective || directive;
}
directiveName = directive.name;
if (directiveValue = directive.controller) {
controllerDirectives = controllerDirectives || {};
assertNoDuplicate("'" + directiveName + "' controller",
controllerDirectives[directiveName], directive, $compileNode);
controllerDirectives[directiveName] = directive;
}
if (directiveValue = directive.transclude) {
assertNoDuplicate('transclusion', transcludeDirective, directive, $compileNode);
transcludeDirective = directive;
terminalPriority = directive.priority;
if (directiveValue == 'element') {
$template = jqLite(compileNode);
$compileNode = templateAttrs.$$element =
jqLite(document.createComment(' ' + directiveName + ': ' + templateAttrs[directiveName] + ' '));
compileNode = $compileNode[0];
replaceWith(jqCollection, jqLite($template[0]), compileNode);
childTranscludeFn = compile($template, transcludeFn, terminalPriority);
} else {
$template = jqLite(JQLiteClone(compileNode)).contents();
$compileNode.html(''); // clear contents
childTranscludeFn = compile($template, transcludeFn);
}
}
if ((directiveValue = directive.template)) {
assertNoDuplicate('template', templateDirective, directive, $compileNode);
templateDirective = directive;
directiveValue = denormalizeTemplate(directiveValue);
if (directive.replace) {
$template = jqLite('<div>' +
trim(directiveValue) +
'</div>').contents();
compileNode = $template[0];
if ($template.length != 1 || compileNode.nodeType !== 1) {
throw new Error(MULTI_ROOT_TEMPLATE_ERROR + directiveValue);
}
replaceWith(jqCollection, $compileNode, compileNode);
var newTemplateAttrs = {$attr: {}};
// combine directives from the original node and from the template:
// - take the array of directives for this element
// - split it into two parts, those that were already applied and those that weren't
// - collect directives from the template, add them to the second group and sort them
// - append the second group with new directives to the first group
directives = directives.concat(
collectDirectives(
compileNode,
directives.splice(i + 1, directives.length - (i + 1)),
newTemplateAttrs
)
);
mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
ii = directives.length;
} else {
$compileNode.html(directiveValue);
}
}
if (directive.templateUrl) {
assertNoDuplicate('template', templateDirective, directive, $compileNode);
templateDirective = directive;
nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i),
nodeLinkFn, $compileNode, templateAttrs, jqCollection, directive.replace,
childTranscludeFn);
ii = directives.length;
} else if (directive.compile) {
try {
linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
if (isFunction(linkFn)) {
addLinkFns(null, linkFn);
} else if (linkFn) {
addLinkFns(linkFn.pre, linkFn.post);
}
} catch (e) {
$exceptionHandler(e, startingTag($compileNode));
}
}
if (directive.terminal) {
nodeLinkFn.terminal = true;
terminalPriority = Math.max(terminalPriority, directive.priority);
}
}
nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope;
nodeLinkFn.transclude = transcludeDirective && childTranscludeFn;
// might be normal or delayed nodeLinkFn depending on if templateUrl is present
return nodeLinkFn;
////////////////////
function addLinkFns(pre, post) {
if (pre) {
pre.require = directive.require;
preLinkFns.push(pre);
}
if (post) {
post.require = directive.require;
postLinkFns.push(post);
}
}
function getControllers(require, $element) {
var value, retrievalMethod = 'data', optional = false;
if (isString(require)) {
while((value = require.charAt(0)) == '^' || value == '?') {
require = require.substr(1);
if (value == '^') {
retrievalMethod = 'inheritedData';
}
optional = optional || value == '?';
}
value = $element[retrievalMethod]('$' + require + 'Controller');
if (!value && !optional) {
throw Error("No controller: " + require);
}
return value;
} else if (isArray(require)) {
value = [];
forEach(require, function(require) {
value.push(getControllers(require, $element));
});
}
return value;
}
function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
var attrs, $element, i, ii, linkFn, controller;
if (compileNode === linkNode) {
attrs = templateAttrs;
} else {
attrs = shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
}
$element = attrs.$$element;
if (newIsolateScopeDirective) {
var LOCAL_REGEXP = /^\s*([@=&])\s*(\w*)\s*$/;
var parentScope = scope.$parent || scope;
forEach(newIsolateScopeDirective.scope, function(definiton, scopeName) {
var match = definiton.match(LOCAL_REGEXP) || [],
attrName = match[2]|| scopeName,
mode = match[1], // @, =, or &
lastValue,
parentGet, parentSet;
scope.$$isolateBindings[scopeName] = mode + attrName;
switch (mode) {
case '@': {
attrs.$observe(attrName, function(value) {
scope[scopeName] = value;
});
attrs.$$observers[attrName].$$scope = parentScope;
break;
}
case '=': {
parentGet = $parse(attrs[attrName]);
parentSet = parentGet.assign || function() {
// reset the change, or we will throw this exception on every $digest
lastValue = scope[scopeName] = parentGet(parentScope);
throw Error(NON_ASSIGNABLE_MODEL_EXPRESSION + attrs[attrName] +
' (directive: ' + newIsolateScopeDirective.name + ')');
};
lastValue = scope[scopeName] = parentGet(parentScope);
scope.$watch(function parentValueWatch() {
var parentValue = parentGet(parentScope);
if (parentValue !== scope[scopeName]) {
// we are out of sync and need to copy
if (parentValue !== lastValue) {
// parent changed and it has precedence
lastValue = scope[scopeName] = parentValue;
} else {
// if the parent can be assigned then do so
parentSet(parentScope, parentValue = lastValue = scope[scopeName]);
}
}
return parentValue;
});
break;
}
case '&': {
parentGet = $parse(attrs[attrName]);
scope[scopeName] = function(locals) {
return parentGet(parentScope, locals);
};
break;
}
default: {
throw Error('Invalid isolate scope definition for directive ' +
newIsolateScopeDirective.name + ': ' + definiton);
}
}
});
}
if (controllerDirectives) {
forEach(controllerDirectives, function(directive) {
var locals = {
$scope: scope,
$element: $element,
$attrs: attrs,
$transclude: boundTranscludeFn
};
controller = directive.controller;
if (controller == '@') {
controller = attrs[directive.name];
}
$element.data(
'$' + directive.name + 'Controller',
$controller(controller, locals));
});
}
// PRELINKING
for(i = 0, ii = preLinkFns.length; i < ii; i++) {
try {
linkFn = preLinkFns[i];
linkFn(scope, $element, attrs,
linkFn.require && getControllers(linkFn.require, $element));
} catch (e) {
$exceptionHandler(e, startingTag($element));
}
}
// RECURSION
childLinkFn && childLinkFn(scope, linkNode.childNodes, undefined, boundTranscludeFn);
// POSTLINKING
for(i = 0, ii = postLinkFns.length; i < ii; i++) {
try {
linkFn = postLinkFns[i];
linkFn(scope, $element, attrs,
linkFn.require && getControllers(linkFn.require, $element));
} catch (e) {
$exceptionHandler(e, startingTag($element));
}
}
}
}
/**
* looks up the directive and decorates it with exception handling and proper parameters. We
* call this the boundDirective.
*
* @param {string} name name of the directive to look up.
* @param {string} location The directive must be found in specific format.
* String containing any of theses characters:
*
* * `E`: element name
* * `A': attribute
* * `C`: class
* * `M`: comment
* @returns true if directive was added.
*/
function addDirective(tDirectives, name, location, maxPriority) {
var match = false;
if (hasDirectives.hasOwnProperty(name)) {
for(var directive, directives = $injector.get(name + Suffix),
i = 0, ii = directives.length; i<ii; i++) {
try {
directive = directives[i];
if ( (maxPriority === undefined || maxPriority > directive.priority) &&
directive.restrict.indexOf(location) != -1) {
tDirectives.push(directive);
match = true;
}
} catch(e) { $exceptionHandler(e); }
}
}
return match;
}
/**
* When the element is replaced with HTML template then the new attributes
* on the template need to be merged with the existing attributes in the DOM.
* The desired effect is to have both of the attributes present.
*
* @param {object} dst destination attributes (original DOM)
* @param {object} src source attributes (from the directive template)
*/
function mergeTemplateAttributes(dst, src) {
var srcAttr = src.$attr,
dstAttr = dst.$attr,
$element = dst.$$element;
// reapply the old attributes to the new element
forEach(dst, function(value, key) {
if (key.charAt(0) != '$') {
if (src[key]) {
value += (key === 'style' ? ';' : ' ') + src[key];
}
dst.$set(key, value, true, srcAttr[key]);
}
});
// copy the new attributes on the old attrs object
forEach(src, function(value, key) {
if (key == 'class') {
safeAddClass($element, value);
dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
} else if (key == 'style') {
$element.attr('style', $element.attr('style') + ';' + value);
} else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
dst[key] = value;
dstAttr[key] = srcAttr[key];
}
});
}
function compileTemplateUrl(directives, beforeTemplateNodeLinkFn, $compileNode, tAttrs,
$rootElement, replace, childTranscludeFn) {
var linkQueue = [],
afterTemplateNodeLinkFn,
afterTemplateChildLinkFn,
beforeTemplateCompileNode = $compileNode[0],
origAsyncDirective = directives.shift(),
// The fact that we have to copy and patch the directive seems wrong!
derivedSyncDirective = extend({}, origAsyncDirective, {
controller: null, templateUrl: null, transclude: null, scope: null
});
$compileNode.html('');
$http.get(origAsyncDirective.templateUrl, {cache: $templateCache}).
success(function(content) {
var compileNode, tempTemplateAttrs, $template;
content = denormalizeTemplate(content);
if (replace) {
$template = jqLite('<div>' + trim(content) + '</div>').contents();
compileNode = $template[0];
if ($template.length != 1 || compileNode.nodeType !== 1) {
throw new Error(MULTI_ROOT_TEMPLATE_ERROR + content);
}
tempTemplateAttrs = {$attr: {}};
replaceWith($rootElement, $compileNode, compileNode);
collectDirectives(compileNode, directives, tempTemplateAttrs);
mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
} else {
compileNode = beforeTemplateCompileNode;
$compileNode.html(content);
}
directives.unshift(derivedSyncDirective);
afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, childTranscludeFn);
afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);
while(linkQueue.length) {
var controller = linkQueue.pop(),
linkRootElement = linkQueue.pop(),
beforeTemplateLinkNode = linkQueue.pop(),
scope = linkQueue.pop(),
linkNode = compileNode;
if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
// it was cloned therefore we have to clone as well.
linkNode = JQLiteClone(compileNode);
replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
}
afterTemplateNodeLinkFn(function() {
beforeTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, controller);
}, scope, linkNode, $rootElement, controller);
}
linkQueue = null;
}).
error(function(response, code, headers, config) {
throw Error('Failed to load template: ' + config.url);
});
return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, controller) {
if (linkQueue) {
linkQueue.push(scope);
linkQueue.push(node);
linkQueue.push(rootElement);
linkQueue.push(controller);
} else {
afterTemplateNodeLinkFn(function() {
beforeTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, controller);
}, scope, node, rootElement, controller);
}
};
}
/**
* Sorting function for bound directives.
*/
function byPriority(a, b) {
return b.priority - a.priority;
}
function assertNoDuplicate(what, previousDirective, directive, element) {
if (previousDirective) {
throw Error('Multiple directives [' + previousDirective.name + ', ' +
directive.name + '] asking for ' + what + ' on: ' + startingTag(element));
}
}
function addTextInterpolateDirective(directives, text) {
var interpolateFn = $interpolate(text, true);
if (interpolateFn) {
directives.push({
priority: 0,
compile: valueFn(function textInterpolateLinkFn(scope, node) {
var parent = node.parent(),
bindings = parent.data('$binding') || [];
bindings.push(interpolateFn);
safeAddClass(parent.data('$binding', bindings), 'ng-binding');
scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
node[0].nodeValue = value;
});
})
});
}
}
function addAttrInterpolateDirective(node, directives, value, name) {
var interpolateFn = $interpolate(value, true);
// no interpolation found -> ignore
if (!interpolateFn) return;
directives.push({
priority: 100,
compile: valueFn(function attrInterpolateLinkFn(scope, element, attr) {
var $$observers = (attr.$$observers || (attr.$$observers = {}));
if (name === 'class') {
// we need to interpolate classes again, in the case the element was replaced
// and therefore the two class attrs got merged - we want to interpolate the result
interpolateFn = $interpolate(attr[name], true);
}
attr[name] = undefined;
($$observers[name] || ($$observers[name] = [])).$$inter = true;
(attr.$$observers && attr.$$observers[name].$$scope || scope).
$watch(interpolateFn, function interpolateFnWatchAction(value) {
attr.$set(name, value);
});
})
});
}
/**
* This is a special jqLite.replaceWith, which can replace items which
* have no parents, provided that the containing jqLite collection is provided.
*
* @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
* in the root of the tree.
* @param {JqLite} $element The jqLite element which we are going to replace. We keep the shell,
* but replace its DOM node reference.
* @param {Node} newNode The new DOM node.
*/
function replaceWith($rootElement, $element, newNode) {
var oldNode = $element[0],
parent = oldNode.parentNode,
i, ii;
if ($rootElement) {
for(i = 0, ii = $rootElement.length; i < ii; i++) {
if ($rootElement[i] == oldNode) {
$rootElement[i] = newNode;
break;
}
}
}
if (parent) {
parent.replaceChild(newNode, oldNode);
}
newNode[jqLite.expando] = oldNode[jqLite.expando];
$element[0] = newNode;
}
}];
}
var PREFIX_REGEXP = /^(x[\:\-_]|data[\:\-_])/i;
/**
* Converts all accepted directives format into proper directive name.
* All of these will become 'myDirective':
* my:DiRective
* my-directive
* x-my-directive
* data-my:directive
*
* Also there is special case for Moz prefix starting with upper case letter.
* @param name Name to normalize
*/
function directiveNormalize(name) {
return camelCase(name.replace(PREFIX_REGEXP, ''));
}
/**
* @ngdoc object
* @name ng.$compile.directive.Attributes
* @description
*
* A shared object between directive compile / linking functions which contains normalized DOM element
* attributes. The the values reflect current binding state `{{ }}`. The normalization is needed
* since all of these are treated as equivalent in Angular:
*
* <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
*/
/**
* @ngdoc property
* @name ng.$compile.directive.Attributes#$attr
* @propertyOf ng.$compile.directive.Attributes
* @returns {object} A map of DOM element attribute names to the normalized name. This is
* needed to do reverse lookup from normalized name back to actual name.
*/
/**
* @ngdoc function
* @name ng.$compile.directive.Attributes#$set
* @methodOf ng.$compile.directive.Attributes
* @function
*
* @description
* Set DOM element attribute value.
*
*
* @param {string} name Normalized element attribute name of the property to modify. The name is
* revers translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
* property to the original name.
* @param {string} value Value to set the attribute to.
*/
/**
* Closure compiler type information
*/
function nodesetLinkingFn(
/* angular.Scope */ scope,
/* NodeList */ nodeList,
/* Element */ rootElement,
/* function(Function) */ boundTranscludeFn
){}
function directiveLinkingFn(
/* nodesetLinkingFn */ nodesetLinkingFn,
/* angular.Scope */ scope,
/* Node */ node,
/* Element */ rootElement,
/* function(Function) */ boundTranscludeFn
){}
/**
* @ngdoc object
* @name ng.$controllerProvider
* @description
* The {@link ng.$controller $controller service} is used by Angular to create new
* controllers.
*
* This provider allows controller registration via the
* {@link ng.$controllerProvider#register register} method.
*/
function $ControllerProvider() {
var controllers = {};
/**
* @ngdoc function
* @name ng.$controllerProvider#register
* @methodOf ng.$controllerProvider
* @param {string} name Controller name
* @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI
* annotations in the array notation).
*/
this.register = function(name, constructor) {
if (isObject(name)) {
extend(controllers, name)
} else {
controllers[name] = constructor;
}
};
this.$get = ['$injector', '$window', function($injector, $window) {
/**
* @ngdoc function
* @name ng.$controller
* @requires $injector
*
* @param {Function|string} constructor If called with a function then it's considered to be the
* controller constructor function. Otherwise it's considered to be a string which is used
* to retrieve the controller constructor using the following steps:
*
* * check if a controller with given name is registered via `$controllerProvider`
* * check if evaluating the string on the current scope returns a constructor
* * check `window[constructor]` on the global `window` object
*
* @param {Object} locals Injection locals for Controller.
* @return {Object} Instance of given controller.
*
* @description
* `$controller` service is responsible for instantiating controllers.
*
* It's just a simple call to {@link AUTO.$injector $injector}, but extracted into
* a service, so that one can override this service with {@link https://gist.github.com/1649788
* BC version}.
*/
return function(constructor, locals) {
if(isString(constructor)) {
var name = constructor;
constructor = controllers.hasOwnProperty(name)
? controllers[name]
: getter(locals.$scope, name, true) || getter($window, name, true);
assertArgFn(constructor, name, true);
}
return $injector.instantiate(constructor, locals);
};
}];
}
/**
* @ngdoc object
* @name ng.$document
* @requires $window
*
* @description
* A {@link angular.element jQuery (lite)}-wrapped reference to the browser's `window.document`
* element.
*/
function $DocumentProvider(){
this.$get = ['$window', function(window){
return jqLite(window.document);
}];
}
/**
* @ngdoc function
* @name ng.$exceptionHandler
* @requires $log
*
* @description
* Any uncaught exception in angular expressions is delegated to this service.
* The default implementation simply delegates to `$log.error` which logs it into
* the browser console.
*
* In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
* {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
*
* @param {Error} exception Exception associated with the error.
* @param {string=} cause optional information about the context in which
* the error was thrown.
*
*/
function $ExceptionHandlerProvider() {
this.$get = ['$log', function($log) {
return function(exception, cause) {
$log.error.apply($log, arguments);
};
}];
}
/**
* @ngdoc object
* @name ng.$interpolateProvider
* @function
*
* @description
*
* Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
*/
function $InterpolateProvider() {
var startSymbol = '{{';
var endSymbol = '}}';
/**
* @ngdoc method
* @name ng.$interpolateProvider#startSymbol
* @methodOf ng.$interpolateProvider
* @description
* Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
*
* @param {string=} value new value to set the starting symbol to.
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
*/
this.startSymbol = function(value){
if (value) {
startSymbol = value;
return this;
} else {
return startSymbol;
}
};
/**
* @ngdoc method
* @name ng.$interpolateProvider#endSymbol
* @methodOf ng.$interpolateProvider
* @description
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
*
* @param {string=} value new value to set the ending symbol to.
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
*/
this.endSymbol = function(value){
if (value) {
endSymbol = value;
return this;
} else {
return endSymbol;
}
};
this.$get = ['$parse', function($parse) {
var startSymbolLength = startSymbol.length,
endSymbolLength = endSymbol.length;
/**
* @ngdoc function
* @name ng.$interpolate
* @function
*
* @requires $parse
*
* @description
*
* Compiles a string with markup into an interpolation function. This service is used by the
* HTML {@link ng.$compile $compile} service for data binding. See
* {@link ng.$interpolateProvider $interpolateProvider} for configuring the
* interpolation markup.
*
*
<pre>
var $interpolate = ...; // injected
var exp = $interpolate('Hello {{name}}!');
expect(exp({name:'Angular'}).toEqual('Hello Angular!');
</pre>
*
*
* @param {string} text The text with markup to interpolate.
* @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
* embedded expression in order to return an interpolation function. Strings with no
* embedded expression will return null for the interpolation function.
* @returns {function(context)} an interpolation function which is used to compute the interpolated
* string. The function has these parameters:
*
* * `context`: an object against which any expressions embedded in the strings are evaluated
* against.
*
*/
function $interpolate(text, mustHaveExpression) {
var startIndex,
endIndex,
index = 0,
parts = [],
length = text.length,
hasInterpolation = false,
fn,
exp,
concat = [];
while(index < length) {
if ( ((startIndex = text.indexOf(startSymbol, index)) != -1) &&
((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1) ) {
(index != startIndex) && parts.push(text.substring(index, startIndex));
parts.push(fn = $parse(exp = text.substring(startIndex + startSymbolLength, endIndex)));
fn.exp = exp;
index = endIndex + endSymbolLength;
hasInterpolation = true;
} else {
// we did not find anything, so we have to add the remainder to the parts array
(index != length) && parts.push(text.substring(index));
index = length;
}
}
if (!(length = parts.length)) {
// we added, nothing, must have been an empty string.
parts.push('');
length = 1;
}
if (!mustHaveExpression || hasInterpolation) {
concat.length = length;
fn = function(context) {
for(var i = 0, ii = length, part; i<ii; i++) {
if (typeof (part = parts[i]) == 'function') {
part = part(context);
if (part == null || part == undefined) {
part = '';
} else if (typeof part != 'string') {
part = toJson(part);
}
}
concat[i] = part;
}
return concat.join('');
};
fn.exp = text;
fn.parts = parts;
return fn;
}
}
/**
* @ngdoc method
* @name ng.$interpolate#startSymbol
* @methodOf ng.$interpolate
* @description
* Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
*
* Use {@link ng.$interpolateProvider#startSymbol $interpolateProvider#startSymbol} to change
* the symbol.
*
* @returns {string} start symbol.
*/
$interpolate.startSymbol = function() {
return startSymbol;
}
/**
* @ngdoc method
* @name ng.$interpolate#endSymbol
* @methodOf ng.$interpolate
* @description
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
*
* Use {@link ng.$interpolateProvider#endSymbol $interpolateProvider#endSymbol} to change
* the symbol.
*
* @returns {string} start symbol.
*/
$interpolate.endSymbol = function() {
return endSymbol;
}
return $interpolate;
}];
}
var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?(\{?[\w\.-]*\}?)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
PATH_MATCH = /^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,
HASH_MATCH = PATH_MATCH,
DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
/**
* Encode path using encodeUriSegment, ignoring forward slashes
*
* @param {string} path Path to encode
* @returns {string}
*/
function encodePath(path) {
var segments = path.split('/'),
i = segments.length;
while (i--) {
segments[i] = encodeUriSegment(segments[i]);
}
return segments.join('/');
}
function stripHash(url) {
return url.split('#')[0];
}
function matchUrl(url, obj) {
var match = URL_MATCH.exec(url);
match = {
protocol: match[1],
host: match[3],
port: int(match[5]) || DEFAULT_PORTS[match[1]] || null,
path: match[6] || '/',
search: match[8],
hash: match[10]
};
if (obj) {
obj.$$protocol = match.protocol;
obj.$$host = match.host;
obj.$$port = match.port;
}
return match;
}
function composeProtocolHostPort(protocol, host, port) {
return protocol + '://' + host + (port == DEFAULT_PORTS[protocol] ? '' : ':' + port);
}
function pathPrefixFromBase(basePath) {
return basePath.substr(0, basePath.lastIndexOf('/'));
}
function convertToHtml5Url(url, basePath, hashPrefix) {
var match = matchUrl(url);
// already html5 url
if (decodeURIComponent(match.path) != basePath || isUndefined(match.hash) ||
match.hash.indexOf(hashPrefix) !== 0) {
return url;
// convert hashbang url -> html5 url
} else {
return composeProtocolHostPort(match.protocol, match.host, match.port) +
pathPrefixFromBase(basePath) + match.hash.substr(hashPrefix.length);
}
}
function convertToHashbangUrl(url, basePath, hashPrefix) {
var match = matchUrl(url);
// already hashbang url
if (decodeURIComponent(match.path) == basePath && !isUndefined(match.hash) &&
match.hash.indexOf(hashPrefix) === 0) {
return url;
// convert html5 url -> hashbang url
} else {
var search = match.search && '?' + match.search || '',
hash = match.hash && '#' + match.hash || '',
pathPrefix = pathPrefixFromBase(basePath),
path = match.path.substr(pathPrefix.length);
if (match.path.indexOf(pathPrefix) !== 0) {
throw Error('Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !');
}
return composeProtocolHostPort(match.protocol, match.host, match.port) + basePath +
'#' + hashPrefix + path + search + hash;
}
}
/**
* LocationUrl represents an url
* This object is exposed as $location service when HTML5 mode is enabled and supported
*
* @constructor
* @param {string} url HTML5 url
* @param {string} pathPrefix
*/
function LocationUrl(url, pathPrefix, appBaseUrl) {
pathPrefix = pathPrefix || '';
/**
* Parse given html5 (regular) url string into properties
* @param {string} newAbsoluteUrl HTML5 url
* @private
*/
this.$$parse = function(newAbsoluteUrl) {
var match = matchUrl(newAbsoluteUrl, this);
if (match.path.indexOf(pathPrefix) !== 0) {
throw Error('Invalid url "' + newAbsoluteUrl + '", missing path prefix "' + pathPrefix + '" !');
}
this.$$path = decodeURIComponent(match.path.substr(pathPrefix.length));
this.$$search = parseKeyValue(match.search);
this.$$hash = match.hash && decodeURIComponent(match.hash) || '';
this.$$compose();
};
/**
* Compose url and update `absUrl` property
* @private
*/
this.$$compose = function() {
var search = toKeyValue(this.$$search),
hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
this.$$absUrl = composeProtocolHostPort(this.$$protocol, this.$$host, this.$$port) +
pathPrefix + this.$$url;
};
this.$$rewriteAppUrl = function(absoluteLinkUrl) {
if(absoluteLinkUrl.indexOf(appBaseUrl) == 0) {
return absoluteLinkUrl;
}
}
this.$$parse(url);
}
/**
* LocationHashbangUrl represents url
* This object is exposed as $location service when html5 history api is disabled or not supported
*
* @constructor
* @param {string} url Legacy url
* @param {string} hashPrefix Prefix for hash part (containing path and search)
*/
function LocationHashbangUrl(url, hashPrefix, appBaseUrl) {
var basePath;
/**
* Parse given hashbang url into properties
* @param {string} url Hashbang url
* @private
*/
this.$$parse = function(url) {
var match = matchUrl(url, this);
if (match.hash && match.hash.indexOf(hashPrefix) !== 0) {
throw Error('Invalid url "' + url + '", missing hash prefix "' + hashPrefix + '" !');
}
basePath = match.path + (match.search ? '?' + match.search : '');
match = HASH_MATCH.exec((match.hash || '').substr(hashPrefix.length));
if (match[1]) {
this.$$path = (match[1].charAt(0) == '/' ? '' : '/') + decodeURIComponent(match[1]);
} else {
this.$$path = '';
}
this.$$search = parseKeyValue(match[3]);
this.$$hash = match[5] && decodeURIComponent(match[5]) || '';
this.$$compose();
};
/**
* Compose hashbang url and update `absUrl` property
* @private
*/
this.$$compose = function() {
var search = toKeyValue(this.$$search),
hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
this.$$absUrl = composeProtocolHostPort(this.$$protocol, this.$$host, this.$$port) +
basePath + (this.$$url ? '#' + hashPrefix + this.$$url : '');
};
this.$$rewriteAppUrl = function(absoluteLinkUrl) {
if(absoluteLinkUrl.indexOf(appBaseUrl) == 0) {
return absoluteLinkUrl;
}
}
this.$$parse(url);
}
LocationUrl.prototype = {
/**
* Has any change been replacing ?
* @private
*/
$$replace: false,
/**
* @ngdoc method
* @name ng.$location#absUrl
* @methodOf ng.$location
*
* @description
* This method is getter only.
*
* Return full url representation with all segments encoded according to rules specified in
* {@link http://www.ietf.org/rfc/rfc3986.txt RFC 3986}.
*
* @return {string} full url
*/
absUrl: locationGetter('$$absUrl'),
/**
* @ngdoc method
* @name ng.$location#url
* @methodOf ng.$location
*
* @description
* This method is getter / setter.
*
* Return url (e.g. `/path?a=b#hash`) when called without any parameter.
*
* Change path, search and hash, when called with parameter and return `$location`.
*
* @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
* @return {string} url
*/
url: function(url, replace) {
if (isUndefined(url))
return this.$$url;
var match = PATH_MATCH.exec(url);
if (match[1]) this.path(decodeURIComponent(match[1]));
if (match[2] || match[1]) this.search(match[3] || '');
this.hash(match[5] || '', replace);
return this;
},
/**
* @ngdoc method
* @name ng.$location#protocol
* @methodOf ng.$location
*
* @description
* This method is getter only.
*
* Return protocol of current url.
*
* @return {string} protocol of current url
*/
protocol: locationGetter('$$protocol'),
/**
* @ngdoc method
* @name ng.$location#host
* @methodOf ng.$location
*
* @description
* This method is getter only.
*
* Return host of current url.
*
* @return {string} host of current url.
*/
host: locationGetter('$$host'),
/**
* @ngdoc method
* @name ng.$location#port
* @methodOf ng.$location
*
* @description
* This method is getter only.
*
* Return port of current url.
*
* @return {Number} port
*/
port: locationGetter('$$port'),
/**
* @ngdoc method
* @name ng.$location#path
* @methodOf ng.$location
*
* @description
* This method is getter / setter.
*
* Return path of current url when called without any parameter.
*
* Change path when called with parameter and return `$location`.
*
* Note: Path should always begin with forward slash (/), this method will add the forward slash
* if it is missing.
*
* @param {string=} path New path
* @return {string} path
*/
path: locationGetterSetter('$$path', function(path) {
return path.charAt(0) == '/' ? path : '/' + path;
}),
/**
* @ngdoc method
* @name ng.$location#search
* @methodOf ng.$location
*
* @description
* This method is getter / setter.
*
* Return search part (as object) of current url when called without any parameter.
*
* Change search part when called with parameter and return `$location`.
*
* @param {string|object<string,string>=} search New search params - string or hash object
* @param {string=} paramValue If `search` is a string, then `paramValue` will override only a
* single search parameter. If the value is `null`, the parameter will be deleted.
*
* @return {string} search
*/
search: function(search, paramValue) {
if (isUndefined(search))
return this.$$search;
if (isDefined(paramValue)) {
if (paramValue === null) {
delete this.$$search[search];
} else {
this.$$search[search] = paramValue;
}
} else {
this.$$search = isString(search) ? parseKeyValue(search) : search;
}
this.$$compose();
return this;
},
/**
* @ngdoc method
* @name ng.$location#hash
* @methodOf ng.$location
*
* @description
* This method is getter / setter.
*
* Return hash fragment when called without any parameter.
*
* Change hash fragment when called with parameter and return `$location`.
*
* @param {string=} hash New hash fragment
* @return {string} hash
*/
hash: locationGetterSetter('$$hash', identity),
/**
* @ngdoc method
* @name ng.$location#replace
* @methodOf ng.$location
*
* @description
* If called, all changes to $location during current `$digest` will be replacing current history
* record, instead of adding new one.
*/
replace: function() {
this.$$replace = true;
return this;
}
};
LocationHashbangUrl.prototype = inherit(LocationUrl.prototype);
function LocationHashbangInHtml5Url(url, hashPrefix, appBaseUrl, baseExtra) {
LocationHashbangUrl.apply(this, arguments);
this.$$rewriteAppUrl = function(absoluteLinkUrl) {
if (absoluteLinkUrl.indexOf(appBaseUrl) == 0) {
return appBaseUrl + baseExtra + '#' + hashPrefix + absoluteLinkUrl.substr(appBaseUrl.length);
}
}
}
LocationHashbangInHtml5Url.prototype = inherit(LocationHashbangUrl.prototype);
function locationGetter(property) {
return function() {
return this[property];
};
}
function locationGetterSetter(property, preprocess) {
return function(value) {
if (isUndefined(value))
return this[property];
this[property] = preprocess(value);
this.$$compose();
return this;
};
}
/**
* @ngdoc object
* @name ng.$location
*
* @requires $browser
* @requires $sniffer
* @requires $rootElement
*
* @description
* The $location service parses the URL in the browser address bar (based on the
* {@link https://developer.mozilla.org/en/window.location window.location}) and makes the URL
* available to your application. Changes to the URL in the address bar are reflected into
* $location service and changes to $location are reflected into the browser address bar.
*
* **The $location service:**
*
* - Exposes the current URL in the browser address bar, so you can
* - Watch and observe the URL.
* - Change the URL.
* - Synchronizes the URL with the browser when the user
* - Changes the address bar.
* - Clicks the back or forward button (or clicks a History link).
* - Clicks on a link.
* - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
*
* For more information see {@link guide/dev_guide.services.$location Developer Guide: Angular
* Services: Using $location}
*/
/**
* @ngdoc object
* @name ng.$locationProvider
* @description
* Use the `$locationProvider` to configure how the application deep linking paths are stored.
*/
function $LocationProvider(){
var hashPrefix = '',
html5Mode = false;
/**
* @ngdoc property
* @name ng.$locationProvider#hashPrefix
* @methodOf ng.$locationProvider
* @description
* @param {string=} prefix Prefix for hash part (containing path and search)
* @returns {*} current value if used as getter or itself (chaining) if used as setter
*/
this.hashPrefix = function(prefix) {
if (isDefined(prefix)) {
hashPrefix = prefix;
return this;
} else {
return hashPrefix;
}
};
/**
* @ngdoc property
* @name ng.$locationProvider#html5Mode
* @methodOf ng.$locationProvider
* @description
* @param {string=} mode Use HTML5 strategy if available.
* @returns {*} current value if used as getter or itself (chaining) if used as setter
*/
this.html5Mode = function(mode) {
if (isDefined(mode)) {
html5Mode = mode;
return this;
} else {
return html5Mode;
}
};
this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement',
function( $rootScope, $browser, $sniffer, $rootElement) {
var $location,
basePath,
pathPrefix,
initUrl = $browser.url(),
initUrlParts = matchUrl(initUrl),
appBaseUrl;
if (html5Mode) {
basePath = $browser.baseHref() || '/';
pathPrefix = pathPrefixFromBase(basePath);
appBaseUrl =
composeProtocolHostPort(initUrlParts.protocol, initUrlParts.host, initUrlParts.port) +
pathPrefix + '/';
if ($sniffer.history) {
$location = new LocationUrl(
convertToHtml5Url(initUrl, basePath, hashPrefix),
pathPrefix, appBaseUrl);
} else {
$location = new LocationHashbangInHtml5Url(
convertToHashbangUrl(initUrl, basePath, hashPrefix),
hashPrefix, appBaseUrl, basePath.substr(pathPrefix.length + 1));
}
} else {
appBaseUrl =
composeProtocolHostPort(initUrlParts.protocol, initUrlParts.host, initUrlParts.port) +
(initUrlParts.path || '') +
(initUrlParts.search ? ('?' + initUrlParts.search) : '') +
'#' + hashPrefix + '/';
$location = new LocationHashbangUrl(initUrl, hashPrefix, appBaseUrl);
}
$rootElement.bind('click', function(event) {
// TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
// currently we open nice url link and redirect then
if (event.ctrlKey || event.metaKey || event.which == 2) return;
var elm = jqLite(event.target);
// traverse the DOM up to find first A tag
while (lowercase(elm[0].nodeName) !== 'a') {
// ignore rewriting if no A tag (reached root element, or no parent - removed from document)
if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
}
var absHref = elm.prop('href'),
rewrittenUrl = $location.$$rewriteAppUrl(absHref);
if (absHref && !elm.attr('target') && rewrittenUrl) {
// update location manually
$location.$$parse(rewrittenUrl);
$rootScope.$apply();
event.preventDefault();
// hack to work around FF6 bug 684208 when scenario runner clicks on links
window.angular['ff-684208-preventDefault'] = true;
}
});
// rewrite hashbang url <> html5 url
if ($location.absUrl() != initUrl) {
$browser.url($location.absUrl(), true);
}
// update $location when $browser url changes
$browser.onUrlChange(function(newUrl) {
if ($location.absUrl() != newUrl) {
if ($rootScope.$broadcast('$locationChangeStart', newUrl, $location.absUrl()).defaultPrevented) {
$browser.url($location.absUrl());
return;
}
$rootScope.$evalAsync(function() {
var oldUrl = $location.absUrl();
$location.$$parse(newUrl);
afterLocationChange(oldUrl);
});
if (!$rootScope.$$phase) $rootScope.$digest();
}
});
// update browser
var changeCounter = 0;
$rootScope.$watch(function $locationWatch() {
var oldUrl = $browser.url();
var currentReplace = $location.$$replace;
if (!changeCounter || oldUrl != $location.absUrl()) {
changeCounter++;
$rootScope.$evalAsync(function() {
if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl).
defaultPrevented) {
$location.$$parse(oldUrl);
} else {
$browser.url($location.absUrl(), currentReplace);
afterLocationChange(oldUrl);
}
});
}
$location.$$replace = false;
return changeCounter;
});
return $location;
function afterLocationChange(oldUrl) {
$rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl);
}
}];
}
/**
* @ngdoc object
* @name ng.$log
* @requires $window
*
* @description
* Simple service for logging. Default implementation writes the message
* into the browser's console (if present).
*
* The main purpose of this service is to simplify debugging and troubleshooting.
*
* @example
<example>
<file name="script.js">
function LogCtrl($scope, $log) {
$scope.$log = $log;
$scope.message = 'Hello World!';
}
</file>
<file name="index.html">
<div ng-controller="LogCtrl">
<p>Reload this page with open console, enter text and hit the log button...</p>
Message:
<input type="text" ng-model="message"/>
<button ng-click="$log.log(message)">log</button>
<button ng-click="$log.warn(message)">warn</button>
<button ng-click="$log.info(message)">info</button>
<button ng-click="$log.error(message)">error</button>
</div>
</file>
</example>
*/
function $LogProvider(){
this.$get = ['$window', function($window){
return {
/**
* @ngdoc method
* @name ng.$log#log
* @methodOf ng.$log
*
* @description
* Write a log message
*/
log: consoleLog('log'),
/**
* @ngdoc method
* @name ng.$log#warn
* @methodOf ng.$log
*
* @description
* Write a warning message
*/
warn: consoleLog('warn'),
/**
* @ngdoc method
* @name ng.$log#info
* @methodOf ng.$log
*
* @description
* Write an information message
*/
info: consoleLog('info'),
/**
* @ngdoc method
* @name ng.$log#error
* @methodOf ng.$log
*
* @description
* Write an error message
*/
error: consoleLog('error')
};
function formatError(arg) {
if (arg instanceof Error) {
if (arg.stack) {
arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
? 'Error: ' + arg.message + '\n' + arg.stack
: arg.stack;
} else if (arg.sourceURL) {
arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
}
}
return arg;
}
function consoleLog(type) {
var console = $window.console || {},
logFn = console[type] || console.log || noop;
if (logFn.apply) {
return function() {
var args = [];
forEach(arguments, function(arg) {
args.push(formatError(arg));
});
return logFn.apply(console, args);
};
}
// we are IE which either doesn't have window.console => this is noop and we do nothing,
// or we are IE where console.log doesn't have apply so we log at least first 2 args
return function(arg1, arg2) {
logFn(arg1, arg2);
}
}
}];
}
var OPERATORS = {
'null':function(){return null;},
'true':function(){return true;},
'false':function(){return false;},
undefined:noop,
'+':function(self, locals, a,b){
a=a(self, locals); b=b(self, locals);
if (isDefined(a)) {
if (isDefined(b)) {
return a + b;
}
return a;
}
return isDefined(b)?b:undefined;},
'-':function(self, locals, a,b){a=a(self, locals); b=b(self, locals); return (isDefined(a)?a:0)-(isDefined(b)?b:0);},
'*':function(self, locals, a,b){return a(self, locals)*b(self, locals);},
'/':function(self, locals, a,b){return a(self, locals)/b(self, locals);},
'%':function(self, locals, a,b){return a(self, locals)%b(self, locals);},
'^':function(self, locals, a,b){return a(self, locals)^b(self, locals);},
'=':noop,
'==':function(self, locals, a,b){return a(self, locals)==b(self, locals);},
'!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);},
'<':function(self, locals, a,b){return a(self, locals)<b(self, locals);},
'>':function(self, locals, a,b){return a(self, locals)>b(self, locals);},
'<=':function(self, locals, a,b){return a(self, locals)<=b(self, locals);},
'>=':function(self, locals, a,b){return a(self, locals)>=b(self, locals);},
'&&':function(self, locals, a,b){return a(self, locals)&&b(self, locals);},
'||':function(self, locals, a,b){return a(self, locals)||b(self, locals);},
'&':function(self, locals, a,b){return a(self, locals)&b(self, locals);},
// '|':function(self, locals, a,b){return a|b;},
'|':function(self, locals, a,b){return b(self, locals)(self, locals, a(self, locals));},
'!':function(self, locals, a){return !a(self, locals);}
};
var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
function lex(text, csp){
var tokens = [],
token,
index = 0,
json = [],
ch,
lastCh = ':'; // can start regexp
while (index < text.length) {
ch = text.charAt(index);
if (is('"\'')) {
readString(ch);
} else if (isNumber(ch) || is('.') && isNumber(peek())) {
readNumber();
} else if (isIdent(ch)) {
readIdent();
// identifiers can only be if the preceding char was a { or ,
if (was('{,') && json[0]=='{' &&
(token=tokens[tokens.length-1])) {
token.json = token.text.indexOf('.') == -1;
}
} else if (is('(){}[].,;:')) {
tokens.push({
index:index,
text:ch,
json:(was(':[,') && is('{[')) || is('}]:,')
});
if (is('{[')) json.unshift(ch);
if (is('}]')) json.shift();
index++;
} else if (isWhitespace(ch)) {
index++;
continue;
} else {
var ch2 = ch + peek(),
fn = OPERATORS[ch],
fn2 = OPERATORS[ch2];
if (fn2) {
tokens.push({index:index, text:ch2, fn:fn2});
index += 2;
} else if (fn) {
tokens.push({index:index, text:ch, fn:fn, json: was('[,:') && is('+-')});
index += 1;
} else {
throwError("Unexpected next character ", index, index+1);
}
}
lastCh = ch;
}
return tokens;
function is(chars) {
return chars.indexOf(ch) != -1;
}
function was(chars) {
return chars.indexOf(lastCh) != -1;
}
function peek() {
return index + 1 < text.length ? text.charAt(index + 1) : false;
}
function isNumber(ch) {
return '0' <= ch && ch <= '9';
}
function isWhitespace(ch) {
return ch == ' ' || ch == '\r' || ch == '\t' ||
ch == '\n' || ch == '\v' || ch == '\u00A0'; // IE treats non-breaking space as \u00A0
}
function isIdent(ch) {
return 'a' <= ch && ch <= 'z' ||
'A' <= ch && ch <= 'Z' ||
'_' == ch || ch == '$';
}
function isExpOperator(ch) {
return ch == '-' || ch == '+' || isNumber(ch);
}
function throwError(error, start, end) {
end = end || index;
throw Error("Lexer Error: " + error + " at column" +
(isDefined(start)
? "s " + start + "-" + index + " [" + text.substring(start, end) + "]"
: " " + end) +
" in expression [" + text + "].");
}
function readNumber() {
var number = "";
var start = index;
while (index < text.length) {
var ch = lowercase(text.charAt(index));
if (ch == '.' || isNumber(ch)) {
number += ch;
} else {
var peekCh = peek();
if (ch == 'e' && isExpOperator(peekCh)) {
number += ch;
} else if (isExpOperator(ch) &&
peekCh && isNumber(peekCh) &&
number.charAt(number.length - 1) == 'e') {
number += ch;
} else if (isExpOperator(ch) &&
(!peekCh || !isNumber(peekCh)) &&
number.charAt(number.length - 1) == 'e') {
throwError('Invalid exponent');
} else {
break;
}
}
index++;
}
number = 1 * number;
tokens.push({index:start, text:number, json:true,
fn:function() {return number;}});
}
function readIdent() {
var ident = "",
start = index,
lastDot, peekIndex, methodName, ch;
while (index < text.length) {
ch = text.charAt(index);
if (ch == '.' || isIdent(ch) || isNumber(ch)) {
if (ch == '.') lastDot = index;
ident += ch;
} else {
break;
}
index++;
}
//check if this is not a method invocation and if it is back out to last dot
if (lastDot) {
peekIndex = index;
while(peekIndex < text.length) {
ch = text.charAt(peekIndex);
if (ch == '(') {
methodName = ident.substr(lastDot - start + 1);
ident = ident.substr(0, lastDot - start);
index = peekIndex;
break;
}
if(isWhitespace(ch)) {
peekIndex++;
} else {
break;
}
}
}
var token = {
index:start,
text:ident
};
if (OPERATORS.hasOwnProperty(ident)) {
token.fn = token.json = OPERATORS[ident];
} else {
var getter = getterFn(ident, csp);
token.fn = extend(function(self, locals) {
return (getter(self, locals));
}, {
assign: function(self, value) {
return setter(self, ident, value);
}
});
}
tokens.push(token);
if (methodName) {
tokens.push({
index:lastDot,
text: '.',
json: false
});
tokens.push({
index: lastDot + 1,
text: methodName,
json: false
});
}
}
function readString(quote) {
var start = index;
index++;
var string = "";
var rawString = quote;
var escape = false;
while (index < text.length) {
var ch = text.charAt(index);
rawString += ch;
if (escape) {
if (ch == 'u') {
var hex = text.substring(index + 1, index + 5);
if (!hex.match(/[\da-f]{4}/i))
throwError( "Invalid unicode escape [\\u" + hex + "]");
index += 4;
string += String.fromCharCode(parseInt(hex, 16));
} else {
var rep = ESCAPE[ch];
if (rep) {
string += rep;
} else {
string += ch;
}
}
escape = false;
} else if (ch == '\\') {
escape = true;
} else if (ch == quote) {
index++;
tokens.push({
index:start,
text:rawString,
string:string,
json:true,
fn:function() { return string; }
});
return;
} else {
string += ch;
}
index++;
}
throwError("Unterminated quote", start);
}
}
/////////////////////////////////////////
function parser(text, json, $filter, csp){
var ZERO = valueFn(0),
value,
tokens = lex(text, csp),
assignment = _assignment,
functionCall = _functionCall,
fieldAccess = _fieldAccess,
objectIndex = _objectIndex,
filterChain = _filterChain;
if(json){
// The extra level of aliasing is here, just in case the lexer misses something, so that
// we prevent any accidental execution in JSON.
assignment = logicalOR;
functionCall =
fieldAccess =
objectIndex =
filterChain =
function() { throwError("is not valid json", {text:text, index:0}); };
value = primary();
} else {
value = statements();
}
if (tokens.length !== 0) {
throwError("is an unexpected token", tokens[0]);
}
return value;
///////////////////////////////////
function throwError(msg, token) {
throw Error("Syntax Error: Token '" + token.text +
"' " + msg + " at column " +
(token.index + 1) + " of the expression [" +
text + "] starting at [" + text.substring(token.index) + "].");
}
function peekToken() {
if (tokens.length === 0)
throw Error("Unexpected end of expression: " + text);
return tokens[0];
}
function peek(e1, e2, e3, e4) {
if (tokens.length > 0) {
var token = tokens[0];
var t = token.text;
if (t==e1 || t==e2 || t==e3 || t==e4 ||
(!e1 && !e2 && !e3 && !e4)) {
return token;
}
}
return false;
}
function expect(e1, e2, e3, e4){
var token = peek(e1, e2, e3, e4);
if (token) {
if (json && !token.json) {
throwError("is not valid json", token);
}
tokens.shift();
return token;
}
return false;
}
function consume(e1){
if (!expect(e1)) {
throwError("is unexpected, expecting [" + e1 + "]", peek());
}
}
function unaryFn(fn, right) {
return function(self, locals) {
return fn(self, locals, right);
};
}
function binaryFn(left, fn, right) {
return function(self, locals) {
return fn(self, locals, left, right);
};
}
function statements() {
var statements = [];
while(true) {
if (tokens.length > 0 && !peek('}', ')', ';', ']'))
statements.push(filterChain());
if (!expect(';')) {
// optimize for the common case where there is only one statement.
// TODO(size): maybe we should not support multiple statements?
return statements.length == 1
? statements[0]
: function(self, locals){
var value;
for ( var i = 0; i < statements.length; i++) {
var statement = statements[i];
if (statement)
value = statement(self, locals);
}
return value;
};
}
}
}
function _filterChain() {
var left = expression();
var token;
while(true) {
if ((token = expect('|'))) {
left = binaryFn(left, token.fn, filter());
} else {
return left;
}
}
}
function filter() {
var token = expect();
var fn = $filter(token.text);
var argsFn = [];
while(true) {
if ((token = expect(':'))) {
argsFn.push(expression());
} else {
var fnInvoke = function(self, locals, input){
var args = [input];
for ( var i = 0; i < argsFn.length; i++) {
args.push(argsFn[i](self, locals));
}
return fn.apply(self, args);
};
return function() {
return fnInvoke;
};
}
}
}
function expression() {
return assignment();
}
function _assignment() {
var left = logicalOR();
var right;
var token;
if ((token = expect('='))) {
if (!left.assign) {
throwError("implies assignment but [" +
text.substring(0, token.index) + "] can not be assigned to", token);
}
right = logicalOR();
return function(scope, locals){
return left.assign(scope, right(scope, locals), locals);
};
} else {
return left;
}
}
function logicalOR() {
var left = logicalAND();
var token;
while(true) {
if ((token = expect('||'))) {
left = binaryFn(left, token.fn, logicalAND());
} else {
return left;
}
}
}
function logicalAND() {
var left = equality();
var token;
if ((token = expect('&&'))) {
left = binaryFn(left, token.fn, logicalAND());
}
return left;
}
function equality() {
var left = relational();
var token;
if ((token = expect('==','!='))) {
left = binaryFn(left, token.fn, equality());
}
return left;
}
function relational() {
var left = additive();
var token;
if ((token = expect('<', '>', '<=', '>='))) {
left = binaryFn(left, token.fn, relational());
}
return left;
}
function additive() {
var left = multiplicative();
var token;
while ((token = expect('+','-'))) {
left = binaryFn(left, token.fn, multiplicative());
}
return left;
}
function multiplicative() {
var left = unary();
var token;
while ((token = expect('*','/','%'))) {
left = binaryFn(left, token.fn, unary());
}
return left;
}
function unary() {
var token;
if (expect('+')) {
return primary();
} else if ((token = expect('-'))) {
return binaryFn(ZERO, token.fn, unary());
} else if ((token = expect('!'))) {
return unaryFn(token.fn, unary());
} else {
return primary();
}
}
function primary() {
var primary;
if (expect('(')) {
primary = filterChain();
consume(')');
} else if (expect('[')) {
primary = arrayDeclaration();
} else if (expect('{')) {
primary = object();
} else {
var token = expect();
primary = token.fn;
if (!primary) {
throwError("not a primary expression", token);
}
}
var next, context;
while ((next = expect('(', '[', '.'))) {
if (next.text === '(') {
primary = functionCall(primary, context);
context = null;
} else if (next.text === '[') {
context = primary;
primary = objectIndex(primary);
} else if (next.text === '.') {
context = primary;
primary = fieldAccess(primary);
} else {
throwError("IMPOSSIBLE");
}
}
return primary;
}
function _fieldAccess(object) {
var field = expect().text;
var getter = getterFn(field, csp);
return extend(
function(scope, locals, self) {
return getter(self || object(scope, locals), locals);
},
{
assign:function(scope, value, locals) {
return setter(object(scope, locals), field, value);
}
}
);
}
function _objectIndex(obj) {
var indexFn = expression();
consume(']');
return extend(
function(self, locals){
var o = obj(self, locals),
i = indexFn(self, locals),
v, p;
if (!o) return undefined;
v = o[i];
if (v && v.then) {
p = v;
if (!('$$v' in v)) {
p.$$v = undefined;
p.then(function(val) { p.$$v = val; });
}
v = v.$$v;
}
return v;
}, {
assign:function(self, value, locals){
return obj(self, locals)[indexFn(self, locals)] = value;
}
});
}
function _functionCall(fn, contextGetter) {
var argsFn = [];
if (peekToken().text != ')') {
do {
argsFn.push(expression());
} while (expect(','));
}
consume(')');
return function(scope, locals){
var args = [],
context = contextGetter ? contextGetter(scope, locals) : scope;
for ( var i = 0; i < argsFn.length; i++) {
args.push(argsFn[i](scope, locals));
}
var fnPtr = fn(scope, locals, context) || noop;
// IE stupidity!
return fnPtr.apply
? fnPtr.apply(context, args)
: fnPtr(args[0], args[1], args[2], args[3], args[4]);
};
}
// This is used with json array declaration
function arrayDeclaration () {
var elementFns = [];
if (peekToken().text != ']') {
do {
elementFns.push(expression());
} while (expect(','));
}
consume(']');
return function(self, locals){
var array = [];
for ( var i = 0; i < elementFns.length; i++) {
array.push(elementFns[i](self, locals));
}
return array;
};
}
function object () {
var keyValues = [];
if (peekToken().text != '}') {
do {
var token = expect(),
key = token.string || token.text;
consume(":");
var value = expression();
keyValues.push({key:key, value:value});
} while (expect(','));
}
consume('}');
return function(self, locals){
var object = {};
for ( var i = 0; i < keyValues.length; i++) {
var keyValue = keyValues[i];
object[keyValue.key] = keyValue.value(self, locals);
}
return object;
};
}
}
//////////////////////////////////////////////////
// Parser helper functions
//////////////////////////////////////////////////
function setter(obj, path, setValue) {
var element = path.split('.');
for (var i = 0; element.length > 1; i++) {
var key = element.shift();
var propertyObj = obj[key];
if (!propertyObj) {
propertyObj = {};
obj[key] = propertyObj;
}
obj = propertyObj;
}
obj[element.shift()] = setValue;
return setValue;
}
var getterFnCache = {};
/**
* Implementation of the "Black Hole" variant from:
* - http://jsperf.com/angularjs-parse-getter/4
* - http://jsperf.com/path-evaluation-simplified/7
*/
function cspSafeGetterFn(key0, key1, key2, key3, key4) {
return function(scope, locals) {
var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope,
promise;
if (pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key0];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
if (!key1 || pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key1];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
if (!key2 || pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key2];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
if (!key3 || pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key3];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
if (!key4 || pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key4];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
return pathVal;
};
}
function getterFn(path, csp) {
if (getterFnCache.hasOwnProperty(path)) {
return getterFnCache[path];
}
var pathKeys = path.split('.'),
pathKeysLength = pathKeys.length,
fn;
if (csp) {
fn = (pathKeysLength < 6)
? cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4])
: function(scope, locals) {
var i = 0, val;
do {
val = cspSafeGetterFn(
pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++]
)(scope, locals);
locals = undefined; // clear after first iteration
scope = val;
} while (i < pathKeysLength);
return val;
}
} else {
var code = 'var l, fn, p;\n';
forEach(pathKeys, function(key, index) {
code += 'if(s === null || s === undefined) return s;\n' +
'l=s;\n' +
's='+ (index
// we simply dereference 's' on any .dot notation
? 's'
// but if we are first then we check locals first, and if so read it first
: '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' +
'if (s && s.then) {\n' +
' if (!("$$v" in s)) {\n' +
' p=s;\n' +
' p.$$v = undefined;\n' +
' p.then(function(v) {p.$$v=v;});\n' +
'}\n' +
' s=s.$$v\n' +
'}\n';
});
code += 'return s;';
fn = Function('s', 'k', code); // s=scope, k=locals
fn.toString = function() { return code; };
}
return getterFnCache[path] = fn;
}
///////////////////////////////////
/**
* @ngdoc function
* @name ng.$parse
* @function
*
* @description
*
* Converts Angular {@link guide/expression expression} into a function.
*
* <pre>
* var getter = $parse('user.name');
* var setter = getter.assign;
* var context = {user:{name:'angular'}};
* var locals = {user:{name:'local'}};
*
* expect(getter(context)).toEqual('angular');
* setter(context, 'newValue');
* expect(context.user.name).toEqual('newValue');
* expect(getter(context, locals)).toEqual('local');
* </pre>
*
*
* @param {string} expression String expression to compile.
* @returns {function(context, locals)} a function which represents the compiled expression:
*
* * `context` – `{object}` – an object against which any expressions embedded in the strings
* are evaluated against (tipically a scope object).
* * `locals` – `{object=}` – local variables context object, useful for overriding values in
* `context`.
*
* The return function also has an `assign` property, if the expression is assignable, which
* allows one to set values to expressions.
*
*/
function $ParseProvider() {
var cache = {};
this.$get = ['$filter', '$sniffer', function($filter, $sniffer) {
return function(exp) {
switch(typeof exp) {
case 'string':
return cache.hasOwnProperty(exp)
? cache[exp]
: cache[exp] = parser(exp, false, $filter, $sniffer.csp);
case 'function':
return exp;
default:
return noop;
}
};
}];
}
/**
* @ngdoc service
* @name ng.$q
* @requires $rootScope
*
* @description
* A promise/deferred implementation inspired by [Kris Kowal's Q](https://github.com/kriskowal/q).
*
* [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an
* interface for interacting with an object that represents the result of an action that is
* performed asynchronously, and may or may not be finished at any given point in time.
*
* From the perspective of dealing with error handling, deferred and promise APIs are to
* asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
*
* <pre>
* // for the purpose of this example let's assume that variables `$q` and `scope` are
* // available in the current lexical scope (they could have been injected or passed in).
*
* function asyncGreet(name) {
* var deferred = $q.defer();
*
* setTimeout(function() {
* // since this fn executes async in a future turn of the event loop, we need to wrap
* // our code into an $apply call so that the model changes are properly observed.
* scope.$apply(function() {
* if (okToGreet(name)) {
* deferred.resolve('Hello, ' + name + '!');
* } else {
* deferred.reject('Greeting ' + name + ' is not allowed.');
* }
* });
* }, 1000);
*
* return deferred.promise;
* }
*
* var promise = asyncGreet('Robin Hood');
* promise.then(function(greeting) {
* alert('Success: ' + greeting);
* }, function(reason) {
* alert('Failed: ' + reason);
* });
* </pre>
*
* At first it might not be obvious why this extra complexity is worth the trouble. The payoff
* comes in the way of
* [guarantees that promise and deferred APIs make](https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md).
*
* Additionally the promise api allows for composition that is very hard to do with the
* traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
* For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the
* section on serial or parallel joining of promises.
*
*
* # The Deferred API
*
* A new instance of deferred is constructed by calling `$q.defer()`.
*
* The purpose of the deferred object is to expose the associated Promise instance as well as APIs
* that can be used for signaling the successful or unsuccessful completion of the task.
*
* **Methods**
*
* - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection
* constructed via `$q.reject`, the promise will be rejected instead.
* - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
* resolving it with a rejection constructed via `$q.reject`.
*
* **Properties**
*
* - promise – `{Promise}` – promise object associated with this deferred.
*
*
* # The Promise API
*
* A new promise instance is created when a deferred instance is created and can be retrieved by
* calling `deferred.promise`.
*
* The purpose of the promise object is to allow for interested parties to get access to the result
* of the deferred task when it completes.
*
* **Methods**
*
* - `then(successCallback, errorCallback)` – regardless of when the promise was or will be resolved
* or rejected, `then` calls one of the success or error callbacks asynchronously as soon as the result
* is available. The callbacks are called with a single argument: the result or rejection reason.
*
* This method *returns a new promise* which is resolved or rejected via the return value of the
* `successCallback` or `errorCallback`.
*
*
* # Chaining promises
*
* Because calling the `then` method of a promise returns a new derived promise, it is easily possible
* to create a chain of promises:
*
* <pre>
* promiseB = promiseA.then(function(result) {
* return result + 1;
* });
*
* // promiseB will be resolved immediately after promiseA is resolved and its value
* // will be the result of promiseA incremented by 1
* </pre>
*
* It is possible to create chains of any length and since a promise can be resolved with another
* promise (which will defer its resolution further), it is possible to pause/defer resolution of
* the promises at any point in the chain. This makes it possible to implement powerful APIs like
* $http's response interceptors.
*
*
* # Differences between Kris Kowal's Q and $q
*
* There are three main differences:
*
* - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
* mechanism in angular, which means faster propagation of resolution or rejection into your
* models and avoiding unnecessary browser repaints, which would result in flickering UI.
* - $q promises are recognized by the templating engine in angular, which means that in templates
* you can treat promises attached to a scope as if they were the resulting values.
* - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
* all the important functionality needed for common async tasks.
*
* # Testing
*
* <pre>
* it('should simulate promise', inject(function($q, $rootScope) {
* var deferred = $q.defer();
* var promise = deferred.promise;
* var resolvedValue;
*
* promise.then(function(value) { resolvedValue = value; });
* expect(resolvedValue).toBeUndefined();
*
* // Simulate resolving of promise
* deferred.resolve(123);
* // Note that the 'then' function does not get called synchronously.
* // This is because we want the promise API to always be async, whether or not
* // it got called synchronously or asynchronously.
* expect(resolvedValue).toBeUndefined();
*
* // Propagate promise resolution to 'then' functions using $apply().
* $rootScope.$apply();
* expect(resolvedValue).toEqual(123);
* });
* </pre>
*/
function $QProvider() {
this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
return qFactory(function(callback) {
$rootScope.$evalAsync(callback);
}, $exceptionHandler);
}];
}
/**
* Constructs a promise manager.
*
* @param {function(function)} nextTick Function for executing functions in the next turn.
* @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for
* debugging purposes.
* @returns {object} Promise manager.
*/
function qFactory(nextTick, exceptionHandler) {
/**
* @ngdoc
* @name ng.$q#defer
* @methodOf ng.$q
* @description
* Creates a `Deferred` object which represents a task which will finish in the future.
*
* @returns {Deferred} Returns a new instance of deferred.
*/
var defer = function() {
var pending = [],
value, deferred;
deferred = {
resolve: function(val) {
if (pending) {
var callbacks = pending;
pending = undefined;
value = ref(val);
if (callbacks.length) {
nextTick(function() {
var callback;
for (var i = 0, ii = callbacks.length; i < ii; i++) {
callback = callbacks[i];
value.then(callback[0], callback[1]);
}
});
}
}
},
reject: function(reason) {
deferred.resolve(reject(reason));
},
promise: {
then: function(callback, errback) {
var result = defer();
var wrappedCallback = function(value) {
try {
result.resolve((callback || defaultCallback)(value));
} catch(e) {
result.reject(e);
exceptionHandler(e);
}
};
var wrappedErrback = function(reason) {
try {
result.resolve((errback || defaultErrback)(reason));
} catch(e) {
result.reject(e);
exceptionHandler(e);
}
};
if (pending) {
pending.push([wrappedCallback, wrappedErrback]);
} else {
value.then(wrappedCallback, wrappedErrback);
}
return result.promise;
}
}
};
return deferred;
};
var ref = function(value) {
if (value && value.then) return value;
return {
then: function(callback) {
var result = defer();
nextTick(function() {
result.resolve(callback(value));
});
return result.promise;
}
};
};
/**
* @ngdoc
* @name ng.$q#reject
* @methodOf ng.$q
* @description
* Creates a promise that is resolved as rejected with the specified `reason`. This api should be
* used to forward rejection in a chain of promises. If you are dealing with the last promise in
* a promise chain, you don't need to worry about it.
*
* When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of
* `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via
* a promise error callback and you want to forward the error to the promise derived from the
* current promise, you have to "rethrow" the error by returning a rejection constructed via
* `reject`.
*
* <pre>
* promiseB = promiseA.then(function(result) {
* // success: do something and resolve promiseB
* // with the old or a new result
* return result;
* }, function(reason) {
* // error: handle the error if possible and
* // resolve promiseB with newPromiseOrValue,
* // otherwise forward the rejection to promiseB
* if (canHandle(reason)) {
* // handle the error and recover
* return newPromiseOrValue;
* }
* return $q.reject(reason);
* });
* </pre>
*
* @param {*} reason Constant, message, exception or an object representing the rejection reason.
* @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
*/
var reject = function(reason) {
return {
then: function(callback, errback) {
var result = defer();
nextTick(function() {
result.resolve((errback || defaultErrback)(reason));
});
return result.promise;
}
};
};
/**
* @ngdoc
* @name ng.$q#when
* @methodOf ng.$q
* @description
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
* This is useful when you are dealing with an object that might or might not be a promise, or if
* the promise comes from a source that can't be trusted.
*
* @param {*} value Value or a promise
* @returns {Promise} Returns a promise of the passed value or promise
*/
var when = function(value, callback, errback) {
var result = defer(),
done;
var wrappedCallback = function(value) {
try {
return (callback || defaultCallback)(value);
} catch (e) {
exceptionHandler(e);
return reject(e);
}
};
var wrappedErrback = function(reason) {
try {
return (errback || defaultErrback)(reason);
} catch (e) {
exceptionHandler(e);
return reject(e);
}
};
nextTick(function() {
ref(value).then(function(value) {
if (done) return;
done = true;
result.resolve(ref(value).then(wrappedCallback, wrappedErrback));
}, function(reason) {
if (done) return;
done = true;
result.resolve(wrappedErrback(reason));
});
});
return result.promise;
};
function defaultCallback(value) {
return value;
}
function defaultErrback(reason) {
return reject(reason);
}
/**
* @ngdoc
* @name ng.$q#all
* @methodOf ng.$q
* @description
* Combines multiple promises into a single promise that is resolved when all of the input
* promises are resolved.
*
* @param {Array.<Promise>} promises An array of promises.
* @returns {Promise} Returns a single promise that will be resolved with an array of values,
* each value corresponding to the promise at the same index in the `promises` array. If any of
* the promises is resolved with a rejection, this resulting promise will be resolved with the
* same rejection.
*/
function all(promises) {
var deferred = defer(),
counter = promises.length,
results = [];
if (counter) {
forEach(promises, function(promise, index) {
ref(promise).then(function(value) {
if (index in results) return;
results[index] = value;
if (!(--counter)) deferred.resolve(results);
}, function(reason) {
if (index in results) return;
deferred.reject(reason);
});
});
} else {
deferred.resolve(results);
}
return deferred.promise;
}
return {
defer: defer,
reject: reject,
when: when,
all: all
};
}
/**
* @ngdoc object
* @name ng.$routeProvider
* @function
*
* @description
*
* Used for configuring routes. See {@link ng.$route $route} for an example.
*/
function $RouteProvider(){
var routes = {};
/**
* @ngdoc method
* @name ng.$routeProvider#when
* @methodOf ng.$routeProvider
*
* @param {string} path Route path (matched against `$location.path`). If `$location.path`
* contains redundant trailing slash or is missing one, the route will still match and the
* `$location.path` will be updated to add or drop the trailing slash to exactly match the
* route definition.
*
* `path` can contain named groups starting with a colon (`:name`). All characters up to the
* next slash are matched and stored in `$routeParams` under the given `name` after the route
* is resolved.
*
* @param {Object} route Mapping information to be assigned to `$route.current` on route
* match.
*
* Object properties:
*
* - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly
* created scope or the name of a {@link angular.Module#controller registered controller}
* if passed as a string.
* - `template` – `{string=}` – html template as a string that should be used by
* {@link ng.directive:ngView ngView} or
* {@link ng.directive:ngInclude ngInclude} directives.
* this property takes precedence over `templateUrl`.
* - `templateUrl` – `{string=}` – path to an html template that should be used by
* {@link ng.directive:ngView ngView}.
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
* be injected into the controller. If any of these dependencies are promises, they will be
* resolved and converted to a value before the controller is instantiated and the
* `$routeChangeSuccess` event is fired. The map object is:
*
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
* Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected}
* and the return value is treated as the dependency. If the result is a promise, it is resolved
* before its value is injected into the controller. Be aware that `ngRoute.$routeParams` will
* still refer to the previous route within these resolve functions. Use `$route.current.params`
* to access the new route parameters, instead.
*
* - `redirectTo` – {(string|function())=} – value to update
* {@link ng.$location $location} path with and trigger route redirection.
*
* If `redirectTo` is a function, it will be called with the following parameters:
*
* - `{Object.<string>}` - route parameters extracted from the current
* `$location.path()` by applying the current route templateUrl.
* - `{string}` - current `$location.path()`
* - `{Object}` - current `$location.search()`
*
* The custom `redirectTo` function is expected to return a string which will be used
* to update `$location.path()` and `$location.search()`.
*
* - `[reloadOnSearch=true]` - {boolean=} - reload route when only $location.search()
* changes.
*
* If the option is set to `false` and url in the browser changes, then
* `$routeUpdate` event is broadcasted on the root scope.
*
* @returns {Object} self
*
* @description
* Adds a new route definition to the `$route` service.
*/
this.when = function(path, route) {
routes[path] = extend({reloadOnSearch: true}, route);
// create redirection for trailing slashes
if (path) {
var redirectPath = (path[path.length-1] == '/')
? path.substr(0, path.length-1)
: path +'/';
routes[redirectPath] = {redirectTo: path};
}
return this;
};
/**
* @ngdoc method
* @name ng.$routeProvider#otherwise
* @methodOf ng.$routeProvider
*
* @description
* Sets route definition that will be used on route change when no other route definition
* is matched.
*
* @param {Object} params Mapping information to be assigned to `$route.current`.
* @returns {Object} self
*/
this.otherwise = function(params) {
this.when(null, params);
return this;
};
this.$get = ['$rootScope', '$location', '$routeParams', '$q', '$injector', '$http', '$templateCache',
function( $rootScope, $location, $routeParams, $q, $injector, $http, $templateCache) {
/**
* @ngdoc object
* @name ng.$route
* @requires $location
* @requires $routeParams
*
* @property {Object} current Reference to the current route definition.
* The route definition contains:
*
* - `controller`: The controller constructor as define in route definition.
* - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
* controller instantiation. The `locals` contain
* the resolved values of the `resolve` map. Additionally the `locals` also contain:
*
* - `$scope` - The current route scope.
* - `$template` - The current route template HTML.
*
* @property {Array.<Object>} routes Array of all configured routes.
*
* @description
* Is used for deep-linking URLs to controllers and views (HTML partials).
* It watches `$location.url()` and tries to map the path to an existing route definition.
*
* You can define routes through {@link ng.$routeProvider $routeProvider}'s API.
*
* The `$route` service is typically used in conjunction with {@link ng.directive:ngView ngView}
* directive and the {@link ng.$routeParams $routeParams} service.
*
* @example
This example shows how changing the URL hash causes the `$route` to match a route against the
URL, and the `ngView` pulls in the partial.
Note that this example is using {@link ng.directive:script inlined templates}
to get it working on jsfiddle as well.
<example module="ngView">
<file name="index.html">
<div ng-controller="MainCntl">
Choose:
<a href="Book/Moby">Moby</a> |
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
<a href="Book/Gatsby">Gatsby</a> |
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
<a href="Book/Scarlet">Scarlet Letter</a><br/>
<div ng-view></div>
<hr />
<pre>$location.path() = {{$location.path()}}</pre>
<pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
<pre>$route.current.params = {{$route.current.params}}</pre>
<pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
<pre>$routeParams = {{$routeParams}}</pre>
</div>
</file>
<file name="book.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
</file>
<file name="chapter.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
Chapter Id: {{params.chapterId}}
</file>
<file name="script.js">
angular.module('ngView', [], function($routeProvider, $locationProvider) {
$routeProvider.when('/Book/:bookId', {
templateUrl: 'book.html',
controller: BookCntl,
resolve: {
// I will cause a 1 second delay
delay: function($q, $timeout) {
var delay = $q.defer();
$timeout(delay.resolve, 1000);
return delay.promise;
}
}
});
$routeProvider.when('/Book/:bookId/ch/:chapterId', {
templateUrl: 'chapter.html',
controller: ChapterCntl
});
// configure html5 to get links working on jsfiddle
$locationProvider.html5Mode(true);
});
function MainCntl($scope, $route, $routeParams, $location) {
$scope.$route = $route;
$scope.$location = $location;
$scope.$routeParams = $routeParams;
}
function BookCntl($scope, $routeParams) {
$scope.name = "BookCntl";
$scope.params = $routeParams;
}
function ChapterCntl($scope, $routeParams) {
$scope.name = "ChapterCntl";
$scope.params = $routeParams;
}
</file>
<file name="scenario.js">
it('should load and compile correct template', function() {
element('a:contains("Moby: Ch1")').click();
var content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element('a:contains("Scarlet")').click();
sleep(2); // promises are not part of scenario waiting
content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
</file>
</example>
*/
/**
* @ngdoc event
* @name ng.$route#$routeChangeStart
* @eventOf ng.$route
* @eventType broadcast on root scope
* @description
* Broadcasted before a route change. At this point the route services starts
* resolving all of the dependencies needed for the route change to occurs.
* Typically this involves fetching the view template as well as any dependencies
* defined in `resolve` route property. Once all of the dependencies are resolved
* `$routeChangeSuccess` is fired.
*
* @param {Route} next Future route information.
* @param {Route} current Current route information.
*/
/**
* @ngdoc event
* @name ng.$route#$routeChangeSuccess
* @eventOf ng.$route
* @eventType broadcast on root scope
* @description
* Broadcasted after a route dependencies are resolved.
* {@link ng.directive:ngView ngView} listens for the directive
* to instantiate the controller and render the view.
*
* @param {Object} angularEvent Synthetic event object.
* @param {Route} current Current route information.
* @param {Route|Undefined} previous Previous route information, or undefined if current is first route entered.
*/
/**
* @ngdoc event
* @name ng.$route#$routeChangeError
* @eventOf ng.$route
* @eventType broadcast on root scope
* @description
* Broadcasted if any of the resolve promises are rejected.
*
* @param {Route} current Current route information.
* @param {Route} previous Previous route information.
* @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
*/
/**
* @ngdoc event
* @name ng.$route#$routeUpdate
* @eventOf ng.$route
* @eventType broadcast on root scope
* @description
*
* The `reloadOnSearch` property has been set to false, and we are reusing the same
* instance of the Controller.
*/
var forceReload = false,
$route = {
routes: routes,
/**
* @ngdoc method
* @name ng.$route#reload
* @methodOf ng.$route
*
* @description
* Causes `$route` service to reload the current route even if
* {@link ng.$location $location} hasn't changed.
*
* As a result of that, {@link ng.directive:ngView ngView}
* creates new scope, reinstantiates the controller.
*/
reload: function() {
forceReload = true;
$rootScope.$evalAsync(updateRoute);
}
};
$rootScope.$on('$locationChangeSuccess', updateRoute);
return $route;
/////////////////////////////////////////////////////
/**
* @param on {string} current url
* @param when {string} route when template to match the url against
* @return {?Object}
*/
function switchRouteMatcher(on, when) {
// TODO(i): this code is convoluted and inefficient, we should construct the route matching
// regex only once and then reuse it
// Escape regexp special characters.
when = '^' + when.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&") + '$';
var regex = '',
params = [],
dst = {};
var re = /:(\w+)/g,
paramMatch,
lastMatchedIndex = 0;
while ((paramMatch = re.exec(when)) !== null) {
// Find each :param in `when` and replace it with a capturing group.
// Append all other sections of when unchanged.
regex += when.slice(lastMatchedIndex, paramMatch.index);
regex += '([^\\/]*)';
params.push(paramMatch[1]);
lastMatchedIndex = re.lastIndex;
}
// Append trailing path part.
regex += when.substr(lastMatchedIndex);
var match = on.match(new RegExp(regex));
if (match) {
forEach(params, function(name, index) {
dst[name] = match[index + 1];
});
}
return match ? dst : null;
}
function updateRoute() {
var next = parseRoute(),
last = $route.current;
if (next && last && next.$$route === last.$$route
&& equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) {
last.params = next.params;
copy(last.params, $routeParams);
$rootScope.$broadcast('$routeUpdate', last);
} else if (next || last) {
forceReload = false;
$rootScope.$broadcast('$routeChangeStart', next, last);
$route.current = next;
if (next) {
if (next.redirectTo) {
if (isString(next.redirectTo)) {
$location.path(interpolate(next.redirectTo, next.params)).search(next.params)
.replace();
} else {
$location.url(next.redirectTo(next.pathParams, $location.path(), $location.search()))
.replace();
}
}
}
$q.when(next).
then(function() {
if (next) {
var keys = [],
values = [],
template;
forEach(next.resolve || {}, function(value, key) {
keys.push(key);
values.push(isString(value) ? $injector.get(value) : $injector.invoke(value));
});
if (isDefined(template = next.template)) {
} else if (isDefined(template = next.templateUrl)) {
template = $http.get(template, {cache: $templateCache}).
then(function(response) { return response.data; });
}
if (isDefined(template)) {
keys.push('$template');
values.push(template);
}
return $q.all(values).then(function(values) {
var locals = {};
forEach(values, function(value, index) {
locals[keys[index]] = value;
});
return locals;
});
}
}).
// after route change
then(function(locals) {
if (next == $route.current) {
if (next) {
next.locals = locals;
copy(next.params, $routeParams);
}
$rootScope.$broadcast('$routeChangeSuccess', next, last);
}
}, function(error) {
if (next == $route.current) {
$rootScope.$broadcast('$routeChangeError', next, last, error);
}
});
}
}
/**
* @returns the current active route, by matching it against the URL
*/
function parseRoute() {
// Match a route
var params, match;
forEach(routes, function(route, path) {
if (!match && (params = switchRouteMatcher($location.path(), path))) {
match = inherit(route, {
params: extend({}, $location.search(), params),
pathParams: params});
match.$$route = route;
}
});
// No route matched; fallback to "otherwise" route
return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
}
/**
* @returns interpolation of the redirect path with the parametrs
*/
function interpolate(string, params) {
var result = [];
forEach((string||'').split(':'), function(segment, i) {
if (i == 0) {
result.push(segment);
} else {
var segmentMatch = segment.match(/(\w+)(.*)/);
var key = segmentMatch[1];
result.push(params[key]);
result.push(segmentMatch[2] || '');
delete params[key];
}
});
return result.join('');
}
}];
}
/**
* @ngdoc object
* @name ng.$routeParams
* @requires $route
*
* @description
* Current set of route parameters. The route parameters are a combination of the
* {@link ng.$location $location} `search()`, and `path()`. The `path` parameters
* are extracted when the {@link ng.$route $route} path is matched.
*
* In case of parameter name collision, `path` params take precedence over `search` params.
*
* The service guarantees that the identity of the `$routeParams` object will remain unchanged
* (but its properties will likely change) even when a route change occurs.
*
* Note that the `$routeParams` are only updated *after* a route change completes successfully.
* This means that you cannot rely on `$routeParams` being correct in route resolve functions.
* Instead you can use `$route.current.params` to access the new route's parameters.
*
* @example
* <pre>
* // Given:
* // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
* // Route: /Chapter/:chapterId/Section/:sectionId
* //
* // Then
* $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
* </pre>
*/
function $RouteParamsProvider() {
this.$get = valueFn({});
}
/**
* DESIGN NOTES
*
* The design decisions behind the scope are heavily favored for speed and memory consumption.
*
* The typical use of scope is to watch the expressions, which most of the time return the same
* value as last time so we optimize the operation.
*
* Closures construction is expensive in terms of speed as well as memory:
* - No closures, instead use prototypical inheritance for API
* - Internal state needs to be stored on scope directly, which means that private state is
* exposed as $$____ properties
*
* Loop operations are optimized by using while(count--) { ... }
* - this means that in order to keep the same order of execution as addition we have to add
* items to the array at the beginning (shift) instead of at the end (push)
*
* Child scopes are created and removed often
* - Using an array would be slow since inserts in middle are expensive so we use linked list
*
* There are few watches then a lot of observers. This is why you don't want the observer to be
* implemented in the same way as watch. Watch requires return of initialization function which
* are expensive to construct.
*/
/**
* @ngdoc object
* @name ng.$rootScopeProvider
* @description
*
* Provider for the $rootScope service.
*/
/**
* @ngdoc function
* @name ng.$rootScopeProvider#digestTtl
* @methodOf ng.$rootScopeProvider
* @description
*
* Sets the number of digest iterations the scope should attempt to execute before giving up and
* assuming that the model is unstable.
*
* The current default is 10 iterations.
*
* @param {number} limit The number of digest iterations.
*/
/**
* @ngdoc object
* @name ng.$rootScope
* @description
*
* Every application has a single root {@link ng.$rootScope.Scope scope}.
* All other scopes are child scopes of the root scope. Scopes provide mechanism for watching the model and provide
* event processing life-cycle. See {@link guide/scope developer guide on scopes}.
*/
function $RootScopeProvider(){
var TTL = 10;
this.digestTtl = function(value) {
if (arguments.length) {
TTL = value;
}
return TTL;
};
this.$get = ['$injector', '$exceptionHandler', '$parse',
function( $injector, $exceptionHandler, $parse) {
/**
* @ngdoc function
* @name ng.$rootScope.Scope
*
* @description
* A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
* {@link AUTO.$injector $injector}. Child scopes are created using the
* {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
* compiled HTML template is executed.)
*
* Here is a simple scope snippet to show how you can interact with the scope.
* <pre>
angular.injector(['ng']).invoke(function($rootScope) {
var scope = $rootScope.$new();
scope.salutation = 'Hello';
scope.name = 'World';
expect(scope.greeting).toEqual(undefined);
scope.$watch('name', function() {
scope.greeting = scope.salutation + ' ' + scope.name + '!';
}); // initialize the watch
expect(scope.greeting).toEqual(undefined);
scope.name = 'Misko';
// still old value, since watches have not been called yet
expect(scope.greeting).toEqual(undefined);
scope.$digest(); // fire all the watches
expect(scope.greeting).toEqual('Hello Misko!');
});
* </pre>
*
* # Inheritance
* A scope can inherit from a parent scope, as in this example:
* <pre>
var parent = $rootScope;
var child = parent.$new();
parent.salutation = "Hello";
child.name = "World";
expect(child.salutation).toEqual('Hello');
child.salutation = "Welcome";
expect(child.salutation).toEqual('Welcome');
expect(parent.salutation).toEqual('Hello');
* </pre>
*
*
* @param {Object.<string, function()>=} providers Map of service factory which need to be provided
* for the current scope. Defaults to {@link ng}.
* @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
* append/override services provided by `providers`. This is handy when unit-testing and having
* the need to override a default service.
* @returns {Object} Newly created scope.
*
*/
function Scope() {
this.$id = nextUid();
this.$$phase = this.$parent = this.$$watchers =
this.$$nextSibling = this.$$prevSibling =
this.$$childHead = this.$$childTail = null;
this['this'] = this.$root = this;
this.$$destroyed = false;
this.$$asyncQueue = [];
this.$$listeners = {};
this.$$isolateBindings = {};
}
/**
* @ngdoc property
* @name ng.$rootScope.Scope#$id
* @propertyOf ng.$rootScope.Scope
* @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for
* debugging.
*/
Scope.prototype = {
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$new
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Creates a new child {@link ng.$rootScope.Scope scope}.
*
* The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} and
* {@link ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the scope
* hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
*
* {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is desired for
* the scope and its child scopes to be permanently detached from the parent and thus stop
* participating in model change detection and listener notification by invoking.
*
* @param {boolean} isolate if true then the scope does not prototypically inherit from the
* parent scope. The scope is isolated, as it can not see parent scope properties.
* When creating widgets it is useful for the widget to not accidentally read parent
* state.
*
* @returns {Object} The newly created child scope.
*
*/
$new: function(isolate) {
var Child,
child;
if (isFunction(isolate)) {
// TODO: remove at some point
throw Error('API-CHANGE: Use $controller to instantiate controllers.');
}
if (isolate) {
child = new Scope();
child.$root = this.$root;
} else {
Child = function() {}; // should be anonymous; This is so that when the minifier munges
// the name it does not become random set of chars. These will then show up as class
// name in the debugger.
Child.prototype = this;
child = new Child();
child.$id = nextUid();
}
child['this'] = child;
child.$$listeners = {};
child.$parent = this;
child.$$asyncQueue = [];
child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null;
child.$$prevSibling = this.$$childTail;
if (this.$$childHead) {
this.$$childTail.$$nextSibling = child;
this.$$childTail = child;
} else {
this.$$childHead = this.$$childTail = child;
}
return child;
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$watch
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Registers a `listener` callback to be executed whenever the `watchExpression` changes.
*
* - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest $digest()} and
* should return the value which will be watched. (Since {@link ng.$rootScope.Scope#$digest $digest()}
* reruns when it detects changes the `watchExpression` can execute multiple times per
* {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)
* - The `listener` is called only when the value from the current `watchExpression` and the
* previous call to `watchExpression` are not equal (with the exception of the initial run,
* see below). The inequality is determined according to
* {@link angular.equals} function. To save the value of the object for later comparison, the
* {@link angular.copy} function is used. It also means that watching complex options will
* have adverse memory and performance implications.
* - The watch `listener` may change the model, which may trigger other `listener`s to fire. This
* is achieved by rerunning the watchers until no changes are detected. The rerun iteration
* limit is 10 to prevent an infinite loop deadlock.
*
*
* If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
* you can register a `watchExpression` function with no `listener`. (Since `watchExpression`
* can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a change is
* detected, be prepared for multiple calls to your listener.)
*
* After a watcher is registered with the scope, the `listener` fn is called asynchronously
* (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
* watcher. In rare cases, this is undesirable because the listener is called when the result
* of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
* can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
* listener was called due to initialization.
*
*
* # Example
* <pre>
// let's assume that scope was dependency injected as the $rootScope
var scope = $rootScope;
scope.name = 'misko';
scope.counter = 0;
expect(scope.counter).toEqual(0);
scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; });
expect(scope.counter).toEqual(0);
scope.$digest();
// no variable change
expect(scope.counter).toEqual(0);
scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(1);
* </pre>
*
*
*
* @param {(function()|string)} watchExpression Expression that is evaluated on each
* {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers a
* call to the `listener`.
*
* - `string`: Evaluated as {@link guide/expression expression}
* - `function(scope)`: called with current `scope` as a parameter.
* @param {(function()|string)=} listener Callback called whenever the return value of
* the `watchExpression` changes.
*
* - `string`: Evaluated as {@link guide/expression expression}
* - `function(newValue, oldValue, scope)`: called with current and previous values as parameters.
*
* @param {boolean=} objectEquality Compare object for equality rather than for reference.
* @returns {function()} Returns a deregistration function for this listener.
*/
$watch: function(watchExp, listener, objectEquality) {
var scope = this,
get = compileToFn(watchExp, 'watch'),
array = scope.$$watchers,
watcher = {
fn: listener,
last: initWatchVal,
get: get,
exp: watchExp,
eq: !!objectEquality
};
// in the case user pass string, we need to compile it, do we really need this ?
if (!isFunction(listener)) {
var listenFn = compileToFn(listener || noop, 'listener');
watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);};
}
if (!array) {
array = scope.$$watchers = [];
}
// we use unshift since we use a while loop in $digest for speed.
// the while loop reads in reverse order.
array.unshift(watcher);
return function() {
arrayRemove(array, watcher);
};
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$digest
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and its children.
* Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change the model, the
* `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} until no more listeners are
* firing. This means that it is possible to get into an infinite loop. This function will throw
* `'Maximum iteration limit exceeded.'` if the number of iterations exceeds 10.
*
* Usually you don't call `$digest()` directly in
* {@link ng.directive:ngController controllers} or in
* {@link ng.$compileProvider#directive directives}.
* Instead a call to {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a
* {@link ng.$compileProvider#directive directives}) will force a `$digest()`.
*
* If you want to be notified whenever `$digest()` is called,
* you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()}
* with no `listener`.
*
* You may have a need to call `$digest()` from within unit-tests, to simulate the scope
* life-cycle.
*
* # Example
* <pre>
var scope = ...;
scope.name = 'misko';
scope.counter = 0;
expect(scope.counter).toEqual(0);
scope.$watch('name', function(newValue, oldValue) {
scope.counter = scope.counter + 1;
});
expect(scope.counter).toEqual(0);
scope.$digest();
// no variable change
expect(scope.counter).toEqual(0);
scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(1);
* </pre>
*
*/
$digest: function() {
var watch, value, last,
watchers,
asyncQueue,
length,
dirty, ttl = TTL,
next, current, target = this,
watchLog = [],
logIdx, logMsg;
beginPhase('$digest');
do {
dirty = false;
current = target;
do {
asyncQueue = current.$$asyncQueue;
while(asyncQueue.length) {
try {
current.$eval(asyncQueue.shift());
} catch (e) {
$exceptionHandler(e);
}
}
if ((watchers = current.$$watchers)) {
// process our watches
length = watchers.length;
while (length--) {
try {
watch = watchers[length];
// Most common watches are on primitives, in which case we can short
// circuit it with === operator, only when === fails do we use .equals
if (watch && (value = watch.get(current)) !== (last = watch.last) &&
!(watch.eq
? equals(value, last)
: (typeof value == 'number' && typeof last == 'number'
&& isNaN(value) && isNaN(last)))) {
dirty = true;
watch.last = watch.eq ? copy(value) : value;
watch.fn(value, ((last === initWatchVal) ? value : last), current);
if (ttl < 5) {
logIdx = 4 - ttl;
if (!watchLog[logIdx]) watchLog[logIdx] = [];
logMsg = (isFunction(watch.exp))
? 'fn: ' + (watch.exp.name || watch.exp.toString())
: watch.exp;
logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);
watchLog[logIdx].push(logMsg);
}
}
} catch (e) {
$exceptionHandler(e);
}
}
}
// Insanity Warning: scope depth-first traversal
// yes, this code is a bit crazy, but it works and we have tests to prove it!
// this piece should be kept in sync with the traversal in $broadcast
if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) {
while(current !== target && !(next = current.$$nextSibling)) {
current = current.$parent;
}
}
} while ((current = next));
if(dirty && !(ttl--)) {
clearPhase();
throw Error(TTL + ' $digest() iterations reached. Aborting!\n' +
'Watchers fired in the last 5 iterations: ' + toJson(watchLog));
}
} while (dirty || asyncQueue.length);
clearPhase();
},
/**
* @ngdoc event
* @name ng.$rootScope.Scope#$destroy
* @eventOf ng.$rootScope.Scope
* @eventType broadcast on scope being destroyed
*
* @description
* Broadcasted when a scope and its children are being destroyed.
*
* Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
* clean up DOM bindings before an element is removed from the DOM.
*/
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$destroy
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Removes the current scope (and all of its children) from the parent scope. Removal implies
* that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
* propagate to the current scope and its children. Removal also implies that the current
* scope is eligible for garbage collection.
*
* The `$destroy()` is usually used by directives such as
* {@link ng.directive:ngRepeat ngRepeat} for managing the
* unrolling of the loop.
*
* Just before a scope is destroyed a `$destroy` event is broadcasted on this scope.
* Application code can register a `$destroy` event handler that will give it chance to
* perform any necessary cleanup.
*
* Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
* clean up DOM bindings before an element is removed from the DOM.
*/
$destroy: function() {
// we can't destroy the root scope or a scope that has been already destroyed
if ($rootScope == this || this.$$destroyed) return;
var parent = this.$parent;
this.$broadcast('$destroy');
this.$$destroyed = true;
if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
// This is bogus code that works around Chrome's GC leak
// see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
this.$$childTail = null;
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$eval
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Executes the `expression` on the current scope returning the result. Any exceptions in the
* expression are propagated (uncaught). This is useful when evaluating Angular expressions.
*
* # Example
* <pre>
var scope = ng.$rootScope.Scope();
scope.a = 1;
scope.b = 2;
expect(scope.$eval('a+b')).toEqual(3);
expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
* </pre>
*
* @param {(string|function())=} expression An angular expression to be executed.
*
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
* - `function(scope)`: execute the function with the current `scope` parameter.
*
* @returns {*} The result of evaluating the expression.
*/
$eval: function(expr, locals) {
return $parse(expr)(this, locals);
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$evalAsync
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Executes the expression on the current scope at a later point in time.
*
* The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only that:
*
* - it will execute in the current script execution context (before any DOM rendering).
* - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
* `expression` execution.
*
* Any exceptions from the execution of the expression are forwarded to the
* {@link ng.$exceptionHandler $exceptionHandler} service.
*
* @param {(string|function())=} expression An angular expression to be executed.
*
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
* - `function(scope)`: execute the function with the current `scope` parameter.
*
*/
$evalAsync: function(expr) {
this.$$asyncQueue.push(expr);
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$apply
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* `$apply()` is used to execute an expression in angular from outside of the angular framework.
* (For example from browser DOM events, setTimeout, XHR or third party libraries).
* Because we are calling into the angular framework we need to perform proper scope life-cycle
* of {@link ng.$exceptionHandler exception handling},
* {@link ng.$rootScope.Scope#$digest executing watches}.
*
* ## Life cycle
*
* # Pseudo-Code of `$apply()`
* <pre>
function $apply(expr) {
try {
return $eval(expr);
} catch (e) {
$exceptionHandler(e);
} finally {
$root.$digest();
}
}
* </pre>
*
*
* Scope's `$apply()` method transitions through the following stages:
*
* 1. The {@link guide/expression expression} is executed using the
* {@link ng.$rootScope.Scope#$eval $eval()} method.
* 2. Any exceptions from the execution of the expression are forwarded to the
* {@link ng.$exceptionHandler $exceptionHandler} service.
* 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the expression
* was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
*
*
* @param {(string|function())=} exp An angular expression to be executed.
*
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
* - `function(scope)`: execute the function with current `scope` parameter.
*
* @returns {*} The result of evaluating the expression.
*/
$apply: function(expr) {
try {
beginPhase('$apply');
return this.$eval(expr);
} catch (e) {
$exceptionHandler(e);
} finally {
clearPhase();
try {
$rootScope.$digest();
} catch (e) {
$exceptionHandler(e);
throw e;
}
}
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$on
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for discussion of
* event life cycle.
*
* The event listener function format is: `function(event, args...)`. The `event` object
* passed into the listener has the following attributes:
*
* - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or `$broadcast`-ed.
* - `currentScope` - `{Scope}`: the current scope which is handling the event.
* - `name` - `{string}`: Name of the event.
* - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel further event
* propagation (available only for events that were `$emit`-ed).
* - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag to true.
* - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
*
* @param {string} name Event name to listen on.
* @param {function(event, args...)} listener Function to call when the event is emitted.
* @returns {function()} Returns a deregistration function for this listener.
*/
$on: function(name, listener) {
var namedListeners = this.$$listeners[name];
if (!namedListeners) {
this.$$listeners[name] = namedListeners = [];
}
namedListeners.push(listener);
return function() {
namedListeners[indexOf(namedListeners, listener)] = null;
};
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$emit
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Dispatches an event `name` upwards through the scope hierarchy notifying the
* registered {@link ng.$rootScope.Scope#$on} listeners.
*
* The event life cycle starts at the scope on which `$emit` was called. All
* {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get notified.
* Afterwards, the event traverses upwards toward the root scope and calls all registered
* listeners along the way. The event will stop propagating if one of the listeners cancels it.
*
* Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
* onto the {@link ng.$exceptionHandler $exceptionHandler} service.
*
* @param {string} name Event name to emit.
* @param {...*} args Optional set of arguments which will be passed onto the event listeners.
* @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
*/
$emit: function(name, args) {
var empty = [],
namedListeners,
scope = this,
stopPropagation = false,
event = {
name: name,
targetScope: scope,
stopPropagation: function() {stopPropagation = true;},
preventDefault: function() {
event.defaultPrevented = true;
},
defaultPrevented: false
},
listenerArgs = concat([event], arguments, 1),
i, length;
do {
namedListeners = scope.$$listeners[name] || empty;
event.currentScope = scope;
for (i=0, length=namedListeners.length; i<length; i++) {
// if listeners were deregistered, defragment the array
if (!namedListeners[i]) {
namedListeners.splice(i, 1);
i--;
length--;
continue;
}
try {
namedListeners[i].apply(null, listenerArgs);
if (stopPropagation) return event;
} catch (e) {
$exceptionHandler(e);
}
}
//traverse upwards
scope = scope.$parent;
} while (scope);
return event;
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$broadcast
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Dispatches an event `name` downwards to all child scopes (and their children) notifying the
* registered {@link ng.$rootScope.Scope#$on} listeners.
*
* The event life cycle starts at the scope on which `$broadcast` was called. All
* {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get notified.
* Afterwards, the event propagates to all direct and indirect scopes of the current scope and
* calls all registered listeners along the way. The event cannot be canceled.
*
* Any exception emmited from the {@link ng.$rootScope.Scope#$on listeners} will be passed
* onto the {@link ng.$exceptionHandler $exceptionHandler} service.
*
* @param {string} name Event name to broadcast.
* @param {...*} args Optional set of arguments which will be passed onto the event listeners.
* @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
*/
$broadcast: function(name, args) {
var target = this,
current = target,
next = target,
event = {
name: name,
targetScope: target,
preventDefault: function() {
event.defaultPrevented = true;
},
defaultPrevented: false
},
listenerArgs = concat([event], arguments, 1),
listeners, i, length;
//down while you can, then up and next sibling or up and next sibling until back at root
do {
current = next;
event.currentScope = current;
listeners = current.$$listeners[name] || [];
for (i=0, length = listeners.length; i<length; i++) {
// if listeners were deregistered, defragment the array
if (!listeners[i]) {
listeners.splice(i, 1);
i--;
length--;
continue;
}
try {
listeners[i].apply(null, listenerArgs);
} catch(e) {
$exceptionHandler(e);
}
}
// Insanity Warning: scope depth-first traversal
// yes, this code is a bit crazy, but it works and we have tests to prove it!
// this piece should be kept in sync with the traversal in $digest
if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) {
while(current !== target && !(next = current.$$nextSibling)) {
current = current.$parent;
}
}
} while ((current = next));
return event;
}
};
var $rootScope = new Scope();
return $rootScope;
function beginPhase(phase) {
if ($rootScope.$$phase) {
throw Error($rootScope.$$phase + ' already in progress');
}
$rootScope.$$phase = phase;
}
function clearPhase() {
$rootScope.$$phase = null;
}
function compileToFn(exp, name) {
var fn = $parse(exp);
assertArgFn(fn, name);
return fn;
}
/**
* function used as an initial value for watchers.
* because it's unique we can easily tell it apart from other values
*/
function initWatchVal() {}
}];
}
/**
* !!! This is an undocumented "private" service !!!
*
* @name ng.$sniffer
* @requires $window
*
* @property {boolean} history Does the browser support html5 history api ?
* @property {boolean} hashchange Does the browser support hashchange event ?
*
* @description
* This is very simple implementation of testing browser's features.
*/
function $SnifferProvider() {
this.$get = ['$window', function($window) {
var eventSupport = {},
android = int((/android (\d+)/.exec(lowercase($window.navigator.userAgent)) || [])[1]);
return {
// Android has history.pushState, but it does not update location correctly
// so let's not use the history API at all.
// http://code.google.com/p/android/issues/detail?id=17471
// https://github.com/angular/angular.js/issues/904
history: !!($window.history && $window.history.pushState && !(android < 4)),
hashchange: 'onhashchange' in $window &&
// IE8 compatible mode lies
(!$window.document.documentMode || $window.document.documentMode > 7),
hasEvent: function(event) {
// IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
// it. In particular the event is not fired when backspace or delete key are pressed or
// when cut operation is performed.
if (event == 'input' && msie == 9) return false;
if (isUndefined(eventSupport[event])) {
var divElm = $window.document.createElement('div');
eventSupport[event] = 'on' + event in divElm;
}
return eventSupport[event];
},
// TODO(i): currently there is no way to feature detect CSP without triggering alerts
csp: false
};
}];
}
/**
* @ngdoc object
* @name ng.$window
*
* @description
* A reference to the browser's `window` object. While `window`
* is globally available in JavaScript, it causes testability problems, because
* it is a global variable. In angular we always refer to it through the
* `$window` service, so it may be overriden, removed or mocked for testing.
*
* Expressions, like the one defined for the `ngClick` directive in the example
* below, are evaluated with respect to the current scope. Therefore, there is
* no risk of inadvertently coding in a dependency on a global value in such an
* expression.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope, $window) {
$scope.$window = $window;
$scope.greeting = 'Hello, World!';
}
</script>
<div ng-controller="Ctrl">
<input type="text" ng-model="greeting" />
<button ng-click="$window.alert(greeting)">ALERT</button>
</div>
</doc:source>
<doc:scenario>
it('should display the greeting in the input box', function() {
input('greeting').enter('Hello, E2E Tests');
// If we click the button it will block the test runner
// element(':button').click();
});
</doc:scenario>
</doc:example>
*/
function $WindowProvider(){
this.$get = valueFn(window);
}
/**
* Parse headers into key value object
*
* @param {string} headers Raw headers as a string
* @returns {Object} Parsed headers as key value object
*/
function parseHeaders(headers) {
var parsed = {}, key, val, i;
if (!headers) return parsed;
forEach(headers.split('\n'), function(line) {
i = line.indexOf(':');
key = lowercase(trim(line.substr(0, i)));
val = trim(line.substr(i + 1));
if (key) {
if (parsed[key]) {
parsed[key] += ', ' + val;
} else {
parsed[key] = val;
}
}
});
return parsed;
}
/**
* Returns a function that provides access to parsed headers.
*
* Headers are lazy parsed when first requested.
* @see parseHeaders
*
* @param {(string|Object)} headers Headers to provide access to.
* @returns {function(string=)} Returns a getter function which if called with:
*
* - if called with single an argument returns a single header value or null
* - if called with no arguments returns an object containing all headers.
*/
function headersGetter(headers) {
var headersObj = isObject(headers) ? headers : undefined;
return function(name) {
if (!headersObj) headersObj = parseHeaders(headers);
if (name) {
return headersObj[lowercase(name)] || null;
}
return headersObj;
};
}
/**
* Chain all given functions
*
* This function is used for both request and response transforming
*
* @param {*} data Data to transform.
* @param {function(string=)} headers Http headers getter fn.
* @param {(function|Array.<function>)} fns Function or an array of functions.
* @returns {*} Transformed data.
*/
function transformData(data, headers, fns) {
if (isFunction(fns))
return fns(data, headers);
forEach(fns, function(fn) {
data = fn(data, headers);
});
return data;
}
function isSuccess(status) {
return 200 <= status && status < 300;
}
function $HttpProvider() {
var JSON_START = /^\s*(\[|\{[^\{])/,
JSON_END = /[\}\]]\s*$/,
PROTECTION_PREFIX = /^\)\]\}',?\n/;
var $config = this.defaults = {
// transform incoming response data
transformResponse: [function(data) {
if (isString(data)) {
// strip json vulnerability protection prefix
data = data.replace(PROTECTION_PREFIX, '');
if (JSON_START.test(data) && JSON_END.test(data))
data = fromJson(data, true);
}
return data;
}],
// transform outgoing request data
transformRequest: [function(d) {
return isObject(d) && !isFile(d) ? toJson(d) : d;
}],
// default headers
headers: {
common: {
'Accept': 'application/json, text/plain, */*',
'X-Requested-With': 'XMLHttpRequest'
},
post: {'Content-Type': 'application/json;charset=utf-8'},
put: {'Content-Type': 'application/json;charset=utf-8'}
}
};
var providerResponseInterceptors = this.responseInterceptors = [];
this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector',
function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) {
var defaultCache = $cacheFactory('$http'),
responseInterceptors = [];
forEach(providerResponseInterceptors, function(interceptor) {
responseInterceptors.push(
isString(interceptor)
? $injector.get(interceptor)
: $injector.invoke(interceptor)
);
});
/**
* @ngdoc function
* @name ng.$http
* @requires $httpBackend
* @requires $browser
* @requires $cacheFactory
* @requires $rootScope
* @requires $q
* @requires $injector
*
* @description
* The `$http` service is a core Angular service that facilitates communication with the remote
* HTTP servers via the browser's {@link https://developer.mozilla.org/en/xmlhttprequest
* XMLHttpRequest} object or via {@link http://en.wikipedia.org/wiki/JSONP JSONP}.
*
* For unit testing applications that use `$http` service, see
* {@link ngMock.$httpBackend $httpBackend mock}.
*
* For a higher level of abstraction, please check out the {@link ngResource.$resource
* $resource} service.
*
* The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by
* the $q service. While for simple usage patterns this doesn't matter much, for advanced usage
* it is important to familiarize yourself with these APIs and the guarantees they provide.
*
*
* # General usage
* The `$http` service is a function which takes a single argument — a configuration object —
* that is used to generate an HTTP request and returns a {@link ng.$q promise}
* with two $http specific methods: `success` and `error`.
*
* <pre>
* $http({method: 'GET', url: '/someUrl'}).
* success(function(data, status, headers, config) {
* // this callback will be called asynchronously
* // when the response is available
* }).
* error(function(data, status, headers, config) {
* // called asynchronously if an error occurs
* // or server returns response with an error status.
* });
* </pre>
*
* Since the returned value of calling the $http function is a `promise`, you can also use
* the `then` method to register callbacks, and these callbacks will receive a single argument –
* an object representing the response. See the API signature and type info below for more
* details.
*
* A response status code between 200 and 299 is considered a success status and
* will result in the success callback being called. Note that if the response is a redirect,
* XMLHttpRequest will transparently follow it, meaning that the error callback will not be
* called for such responses.
*
* # Shortcut methods
*
* Since all invocations of the $http service require passing in an HTTP method and URL, and
* POST/PUT requests require request data to be provided as well, shortcut methods
* were created:
*
* <pre>
* $http.get('/someUrl').success(successCallback);
* $http.post('/someUrl', data).success(successCallback);
* </pre>
*
* Complete list of shortcut methods:
*
* - {@link ng.$http#get $http.get}
* - {@link ng.$http#head $http.head}
* - {@link ng.$http#post $http.post}
* - {@link ng.$http#put $http.put}
* - {@link ng.$http#delete $http.delete}
* - {@link ng.$http#jsonp $http.jsonp}
*
*
* # Setting HTTP Headers
*
* The $http service will automatically add certain HTTP headers to all requests. These defaults
* can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
* object, which currently contains this default configuration:
*
* - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
* - `Accept: application/json, text/plain, * / *`
* - `X-Requested-With: XMLHttpRequest`
* - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
* - `Content-Type: application/json`
* - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
* - `Content-Type: application/json`
*
* To add or overwrite these defaults, simply add or remove a property from these configuration
* objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
* with the lowercased HTTP method name as the key, e.g.
* `$httpProvider.defaults.headers.get['My-Header']='value'`.
*
* Additionally, the defaults can be set at runtime via the `$http.defaults` object in the same
* fashion.
*
*
* # Transforming Requests and Responses
*
* Both requests and responses can be transformed using transform functions. By default, Angular
* applies these transformations:
*
* Request transformations:
*
* - If the `data` property of the request configuration object contains an object, serialize it into
* JSON format.
*
* Response transformations:
*
* - If XSRF prefix is detected, strip it (see Security Considerations section below).
* - If JSON response is detected, deserialize it using a JSON parser.
*
* To globally augment or override the default transforms, modify the `$httpProvider.defaults.transformRequest` and
* `$httpProvider.defaults.transformResponse` properties. These properties are by default an
* array of transform functions, which allows you to `push` or `unshift` a new transformation function into the
* transformation chain. You can also decide to completely override any default transformations by assigning your
* transformation functions to these properties directly without the array wrapper.
*
* Similarly, to locally override the request/response transforms, augment the `transformRequest` and/or
* `transformResponse` properties of the configuration object passed into `$http`.
*
*
* # Caching
*
* To enable caching, set the configuration property `cache` to `true`. When the cache is
* enabled, `$http` stores the response from the server in local cache. Next time the
* response is served from the cache without sending a request to the server.
*
* Note that even if the response is served from cache, delivery of the data is asynchronous in
* the same way that real requests are.
*
* If there are multiple GET requests for the same URL that should be cached using the same
* cache, but the cache is not populated yet, only one request to the server will be made and
* the remaining requests will be fulfilled using the response from the first request.
*
*
* # Response interceptors
*
* Before you start creating interceptors, be sure to understand the
* {@link ng.$q $q and deferred/promise APIs}.
*
* For purposes of global error handling, authentication or any kind of synchronous or
* asynchronous preprocessing of received responses, it is desirable to be able to intercept
* responses for http requests before they are handed over to the application code that
* initiated these requests. The response interceptors leverage the {@link ng.$q
* promise apis} to fulfil this need for both synchronous and asynchronous preprocessing.
*
* The interceptors are service factories that are registered with the $httpProvider by
* adding them to the `$httpProvider.responseInterceptors` array. The factory is called and
* injected with dependencies (if specified) and returns the interceptor — a function that
* takes a {@link ng.$q promise} and returns the original or a new promise.
*
* <pre>
* // register the interceptor as a service
* $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
* return function(promise) {
* return promise.then(function(response) {
* // do something on success
* return response;
* }, function(response) {
* // do something on error
* if (canRecover(response)) {
* return responseOrNewPromise
* }
* return $q.reject(response);
* });
* }
* });
*
* $httpProvider.responseInterceptors.push('myHttpInterceptor');
*
*
* // register the interceptor via an anonymous factory
* $httpProvider.responseInterceptors.push(function($q, dependency1, dependency2) {
* return function(promise) {
* // same as above
* }
* });
* </pre>
*
*
* # Security Considerations
*
* When designing web applications, consider security threats from:
*
* - {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx
* JSON vulnerability}
* - {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF}
*
* Both server and the client must cooperate in order to eliminate these threats. Angular comes
* pre-configured with strategies that address these issues, but for this to work backend server
* cooperation is required.
*
* ## JSON Vulnerability Protection
*
* A {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx
* JSON vulnerability} allows third party website to turn your JSON resource URL into
* {@link http://en.wikipedia.org/wiki/JSONP JSONP} request under some conditions. To
* counter this your server can prefix all JSON requests with following string `")]}',\n"`.
* Angular will automatically strip the prefix before processing it as JSON.
*
* For example if your server needs to return:
* <pre>
* ['one','two']
* </pre>
*
* which is vulnerable to attack, your server can return:
* <pre>
* )]}',
* ['one','two']
* </pre>
*
* Angular will strip the prefix, before processing the JSON.
*
*
* ## Cross Site Request Forgery (XSRF) Protection
*
* {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF} is a technique by which
* an unauthorized site can gain your user's private data. Angular provides a mechanism
* to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie
* called `XSRF-TOKEN` and sets it as the HTTP header `X-XSRF-TOKEN`. Since only JavaScript that
* runs on your domain could read the cookie, your server can be assured that the XHR came from
* JavaScript running on your domain.
*
* To take advantage of this, your server needs to set a token in a JavaScript readable session
* cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the
* server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure
* that only JavaScript running on your domain could have sent the request. The token must be
* unique for each user and must be verifiable by the server (to prevent the JavaScript from making
* up its own tokens). We recommend that the token is a digest of your site's authentication
* cookie with a {@link https://en.wikipedia.org/wiki/Salt_(cryptography) salt} for added security.
*
*
* @param {object} config Object describing the request to be made and how it should be
* processed. The object has following properties:
*
* - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
* - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
* - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be turned to
* `?key1=value1&key2=value2` after the url. If the value is not a string, it will be JSONified.
* - **data** – `{string|Object}` – Data to be sent as the request message data.
* - **headers** – `{Object}` – Map of strings representing HTTP headers to send to the server.
* - **transformRequest** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
* transform function or an array of such functions. The transform function takes the http
* request body and headers and returns its transformed (typically serialized) version.
* - **transformResponse** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
* transform function or an array of such functions. The transform function takes the http
* response body and headers and returns its transformed (typically deserialized) version.
* - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
* GET request, otherwise if a cache instance built with
* {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
* caching.
* - **timeout** – `{number}` – timeout in milliseconds.
* - **withCredentials** - `{boolean}` - whether to to set the `withCredentials` flag on the
* XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5
* requests with credentials} for more information.
*
* @returns {HttpPromise} Returns a {@link ng.$q promise} object with the
* standard `then` method and two http specific methods: `success` and `error`. The `then`
* method takes two arguments a success and an error callback which will be called with a
* response object. The `success` and `error` methods take a single argument - a function that
* will be called when the request succeeds or fails respectively. The arguments passed into
* these functions are destructured representation of the response object passed into the
* `then` method. The response object has these properties:
*
* - **data** – `{string|Object}` – The response body transformed with the transform functions.
* - **status** – `{number}` – HTTP status code of the response.
* - **headers** – `{function([headerName])}` – Header getter function.
* - **config** – `{Object}` – The configuration object that was used to generate the request.
*
* @property {Array.<Object>} pendingRequests Array of config objects for currently pending
* requests. This is primarily meant to be used for debugging purposes.
*
*
* @example
<example>
<file name="index.html">
<div ng-controller="FetchCtrl">
<select ng-model="method">
<option>GET</option>
<option>JSONP</option>
</select>
<input type="text" ng-model="url" size="80"/>
<button ng-click="fetch()">fetch</button><br>
<button ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
<button ng-click="updateModel('JSONP', 'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">Sample JSONP</button>
<button ng-click="updateModel('JSONP', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">Invalid JSONP</button>
<pre>http status code: {{status}}</pre>
<pre>http response data: {{data}}</pre>
</div>
</file>
<file name="script.js">
function FetchCtrl($scope, $http, $templateCache) {
$scope.method = 'GET';
$scope.url = 'http-hello.html';
$scope.fetch = function() {
$scope.code = null;
$scope.response = null;
$http({method: $scope.method, url: $scope.url, cache: $templateCache}).
success(function(data, status) {
$scope.status = status;
$scope.data = data;
}).
error(function(data, status) {
$scope.data = data || "Request failed";
$scope.status = status;
});
};
$scope.updateModel = function(method, url) {
$scope.method = method;
$scope.url = url;
};
}
</file>
<file name="http-hello.html">
Hello, $http!
</file>
<file name="scenario.js">
it('should make an xhr GET request', function() {
element(':button:contains("Sample GET")').click();
element(':button:contains("fetch")').click();
expect(binding('status')).toBe('200');
expect(binding('data')).toMatch(/Hello, \$http!/);
});
it('should make a JSONP request to angularjs.org', function() {
element(':button:contains("Sample JSONP")').click();
element(':button:contains("fetch")').click();
expect(binding('status')).toBe('200');
expect(binding('data')).toMatch(/Super Hero!/);
});
it('should make JSONP request to invalid URL and invoke the error handler',
function() {
element(':button:contains("Invalid JSONP")').click();
element(':button:contains("fetch")').click();
expect(binding('status')).toBe('0');
expect(binding('data')).toBe('Request failed');
});
</file>
</example>
*/
function $http(config) {
config.method = uppercase(config.method);
var reqTransformFn = config.transformRequest || $config.transformRequest,
respTransformFn = config.transformResponse || $config.transformResponse,
reqHeaders = extend({}, config.headers),
defHeaders = extend(
{'X-XSRF-TOKEN': $browser.cookies()['XSRF-TOKEN']},
$config.headers.common,
$config.headers[lowercase(config.method)]
),
reqData,
defHeaderName, lowercaseDefHeaderName, headerName,
promise;
// using for-in instead of forEach to avoid unecessary iteration after header has been found
defaultHeadersIteration:
for(defHeaderName in defHeaders) {
lowercaseDefHeaderName = lowercase(defHeaderName);
for(headerName in config.headers) {
if (lowercase(headerName) === lowercaseDefHeaderName) {
continue defaultHeadersIteration;
}
}
reqHeaders[defHeaderName] = defHeaders[defHeaderName];
}
// strip content-type if data is undefined
if (isUndefined(config.data)) {
for(var header in reqHeaders) {
if (lowercase(header) === 'content-type') {
delete reqHeaders[header];
break;
}
}
}
reqData = transformData(config.data, headersGetter(reqHeaders), reqTransformFn);
// send request
promise = sendReq(config, reqData, reqHeaders);
// transform future response
promise = promise.then(transformResponse, transformResponse);
// apply interceptors
forEach(responseInterceptors, function(interceptor) {
promise = interceptor(promise);
});
promise.success = function(fn) {
promise.then(function(response) {
fn(response.data, response.status, response.headers, config);
});
return promise;
};
promise.error = function(fn) {
promise.then(null, function(response) {
fn(response.data, response.status, response.headers, config);
});
return promise;
};
return promise;
function transformResponse(response) {
// make a copy since the response must be cacheable
var resp = extend({}, response, {
data: transformData(response.data, response.headers, respTransformFn)
});
return (isSuccess(response.status))
? resp
: $q.reject(resp);
}
}
$http.pendingRequests = [];
/**
* @ngdoc method
* @name ng.$http#get
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `GET` request.
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
/**
* @ngdoc method
* @name ng.$http#delete
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `DELETE` request.
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
/**
* @ngdoc method
* @name ng.$http#head
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `HEAD` request.
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
/**
* @ngdoc method
* @name ng.$http#jsonp
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `JSONP` request.
*
* @param {string} url Relative or absolute URL specifying the destination of the request.
* Should contain `JSON_CALLBACK` string.
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
createShortMethods('get', 'delete', 'head', 'jsonp');
/**
* @ngdoc method
* @name ng.$http#post
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `POST` request.
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {*} data Request content
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
/**
* @ngdoc method
* @name ng.$http#put
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `PUT` request.
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {*} data Request content
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
createShortMethodsWithData('post', 'put');
/**
* @ngdoc property
* @name ng.$http#defaults
* @propertyOf ng.$http
*
* @description
* Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
* default headers as well as request and response transformations.
*
* See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
*/
$http.defaults = $config;
return $http;
function createShortMethods(names) {
forEach(arguments, function(name) {
$http[name] = function(url, config) {
return $http(extend(config || {}, {
method: name,
url: url
}));
};
});
}
function createShortMethodsWithData(name) {
forEach(arguments, function(name) {
$http[name] = function(url, data, config) {
return $http(extend(config || {}, {
method: name,
url: url,
data: data
}));
};
});
}
/**
* Makes the request.
*
* !!! ACCESSES CLOSURE VARS:
* $httpBackend, $config, $log, $rootScope, defaultCache, $http.pendingRequests
*/
function sendReq(config, reqData, reqHeaders) {
var deferred = $q.defer(),
promise = deferred.promise,
cache,
cachedResp,
url = buildUrl(config.url, config.params);
$http.pendingRequests.push(config);
promise.then(removePendingReq, removePendingReq);
if (config.cache && config.method == 'GET') {
cache = isObject(config.cache) ? config.cache : defaultCache;
}
if (cache) {
cachedResp = cache.get(url);
if (cachedResp) {
if (cachedResp.then) {
// cached request has already been sent, but there is no response yet
cachedResp.then(removePendingReq, removePendingReq);
return cachedResp;
} else {
// serving from cache
if (isArray(cachedResp)) {
resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2]));
} else {
resolvePromise(cachedResp, 200, {});
}
}
} else {
// put the promise for the non-transformed response into cache as a placeholder
cache.put(url, promise);
}
}
// if we won't have the response in cache, send the request to the backend
if (!cachedResp) {
$httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
config.withCredentials);
}
return promise;
/**
* Callback registered to $httpBackend():
* - caches the response if desired
* - resolves the raw $http promise
* - calls $apply
*/
function done(status, response, headersString) {
if (cache) {
if (isSuccess(status)) {
cache.put(url, [status, response, parseHeaders(headersString)]);
} else {
// remove promise from the cache
cache.remove(url);
}
}
resolvePromise(response, status, headersString);
$rootScope.$apply();
}
/**
* Resolves the raw $http promise.
*/
function resolvePromise(response, status, headers) {
// normalize internal statuses to 0
status = Math.max(status, 0);
(isSuccess(status) ? deferred.resolve : deferred.reject)({
data: response,
status: status,
headers: headersGetter(headers),
config: config
});
}
function removePendingReq() {
var idx = indexOf($http.pendingRequests, config);
if (idx !== -1) $http.pendingRequests.splice(idx, 1);
}
}
function buildUrl(url, params) {
if (!params) return url;
var parts = [];
forEachSorted(params, function(value, key) {
if (value == null || value == undefined) return;
if (isObject(value)) {
value = toJson(value);
}
parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
});
return url + ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
}
}];
}
var XHR = window.XMLHttpRequest || function() {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {}
throw new Error("This browser does not support XMLHttpRequest.");
};
/**
* @ngdoc object
* @name ng.$httpBackend
* @requires $browser
* @requires $window
* @requires $document
*
* @description
* HTTP backend used by the {@link ng.$http service} that delegates to
* XMLHttpRequest object or JSONP and deals with browser incompatibilities.
*
* You should never need to use this service directly, instead use the higher-level abstractions:
* {@link ng.$http $http} or {@link ngResource.$resource $resource}.
*
* During testing this implementation is swapped with {@link ngMock.$httpBackend mock
* $httpBackend} which can be trained with responses.
*/
function $HttpBackendProvider() {
this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) {
return createHttpBackend($browser, XHR, $browser.defer, $window.angular.callbacks,
$document[0], $window.location.protocol.replace(':', ''));
}];
}
function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, locationProtocol) {
// TODO(vojta): fix the signature
return function(method, url, post, callback, headers, timeout, withCredentials) {
$browser.$$incOutstandingRequestCount();
url = url || $browser.url();
if (lowercase(method) == 'jsonp') {
var callbackId = '_' + (callbacks.counter++).toString(36);
callbacks[callbackId] = function(data) {
callbacks[callbackId].data = data;
};
jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),
function() {
if (callbacks[callbackId].data) {
completeRequest(callback, 200, callbacks[callbackId].data);
} else {
completeRequest(callback, -2);
}
delete callbacks[callbackId];
});
} else {
var xhr = new XHR();
xhr.open(method, url, true);
forEach(headers, function(value, key) {
if (value) xhr.setRequestHeader(key, value);
});
var status;
// In IE6 and 7, this might be called synchronously when xhr.send below is called and the
// response is in the cache. the promise api will ensure that to the app code the api is
// always async
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
var responseHeaders = xhr.getAllResponseHeaders();
// TODO(vojta): remove once Firefox 21 gets released.
// begin: workaround to overcome Firefox CORS http response headers bug
// https://bugzilla.mozilla.org/show_bug.cgi?id=608735
// Firefox already patched in nightly. Should land in Firefox 21.
// CORS "simple response headers" http://www.w3.org/TR/cors/
var value,
simpleHeaders = ["Cache-Control", "Content-Language", "Content-Type",
"Expires", "Last-Modified", "Pragma"];
if (!responseHeaders) {
responseHeaders = "";
forEach(simpleHeaders, function (header) {
var value = xhr.getResponseHeader(header);
if (value) {
responseHeaders += header + ": " + value + "\n";
}
});
}
// end of the workaround.
completeRequest(callback, status || xhr.status, xhr.responseText,
responseHeaders);
}
};
if (withCredentials) {
xhr.withCredentials = true;
}
xhr.send(post || '');
if (timeout > 0) {
$browserDefer(function() {
status = -1;
xhr.abort();
}, timeout);
}
}
function completeRequest(callback, status, response, headersString) {
// URL_MATCH is defined in src/service/location.js
var protocol = (url.match(URL_MATCH) || ['', locationProtocol])[1];
// fix status code for file protocol (it's always 0)
status = (protocol == 'file') ? (response ? 200 : 404) : status;
// normalize IE bug (http://bugs.jquery.com/ticket/1450)
status = status == 1223 ? 204 : status;
callback(status, response, headersString);
$browser.$$completeOutstandingRequest(noop);
}
};
function jsonpReq(url, done) {
// we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.:
// - fetches local scripts via XHR and evals them
// - adds and immediately removes script elements from the document
var script = rawDocument.createElement('script'),
doneWrapper = function() {
rawDocument.body.removeChild(script);
if (done) done();
};
script.type = 'text/javascript';
script.src = url;
if (msie) {
script.onreadystatechange = function() {
if (/loaded|complete/.test(script.readyState)) doneWrapper();
};
} else {
script.onload = script.onerror = doneWrapper;
}
rawDocument.body.appendChild(script);
}
}
/**
* @ngdoc object
* @name ng.$locale
*
* @description
* $locale service provides localization rules for various Angular components. As of right now the
* only public api is:
*
* * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
*/
function $LocaleProvider(){
this.$get = function() {
return {
id: 'en-us',
NUMBER_FORMATS: {
DECIMAL_SEP: '.',
GROUP_SEP: ',',
PATTERNS: [
{ // Decimal Pattern
minInt: 1,
minFrac: 0,
maxFrac: 3,
posPre: '',
posSuf: '',
negPre: '-',
negSuf: '',
gSize: 3,
lgSize: 3
},{ //Currency Pattern
minInt: 1,
minFrac: 2,
maxFrac: 2,
posPre: '\u00A4',
posSuf: '',
negPre: '(\u00A4',
negSuf: ')',
gSize: 3,
lgSize: 3
}
],
CURRENCY_SYM: '$'
},
DATETIME_FORMATS: {
MONTH: 'January,February,March,April,May,June,July,August,September,October,November,December'
.split(','),
SHORTMONTH: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),
DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),
SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','),
AMPMS: ['AM','PM'],
medium: 'MMM d, y h:mm:ss a',
short: 'M/d/yy h:mm a',
fullDate: 'EEEE, MMMM d, y',
longDate: 'MMMM d, y',
mediumDate: 'MMM d, y',
shortDate: 'M/d/yy',
mediumTime: 'h:mm:ss a',
shortTime: 'h:mm a'
},
pluralCat: function(num) {
if (num === 1) {
return 'one';
}
return 'other';
}
};
};
}
function $TimeoutProvider() {
this.$get = ['$rootScope', '$browser', '$q', '$exceptionHandler',
function($rootScope, $browser, $q, $exceptionHandler) {
var deferreds = {};
/**
* @ngdoc function
* @name ng.$timeout
* @requires $browser
*
* @description
* Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
* block and delegates any exceptions to
* {@link ng.$exceptionHandler $exceptionHandler} service.
*
* The return value of registering a timeout function is a promise, which will be resolved when
* the timeout is reached and the timeout function is executed.
*
* To cancel a timeout request, call `$timeout.cancel(promise)`.
*
* In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
* synchronously flush the queue of deferred functions.
*
* @param {function()} fn A function, whose execution should be delayed.
* @param {number=} [delay=0] Delay in milliseconds.
* @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
* will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
* @returns {Promise} Promise that will be resolved when the timeout is reached. The value this
* promise will be resolved with is the return value of the `fn` function.
*/
function timeout(fn, delay, invokeApply) {
var deferred = $q.defer(),
promise = deferred.promise,
skipApply = (isDefined(invokeApply) && !invokeApply),
timeoutId, cleanup;
timeoutId = $browser.defer(function() {
try {
deferred.resolve(fn());
} catch(e) {
deferred.reject(e);
$exceptionHandler(e);
}
finally {
delete deferreds[promise.$$timeoutId];
}
if (!skipApply) $rootScope.$apply();
}, delay);
promise.$$timeoutId = timeoutId;
deferreds[timeoutId] = deferred;
return promise;
}
/**
* @ngdoc function
* @name ng.$timeout#cancel
* @methodOf ng.$timeout
*
* @description
* Cancels a task associated with the `promise`. As a result of this, the promise will be
* resolved with a rejection.
*
* @param {Promise=} promise Promise returned by the `$timeout` function.
* @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
* canceled.
*/
timeout.cancel = function(promise) {
if (promise && promise.$$timeoutId in deferreds) {
deferreds[promise.$$timeoutId].reject('canceled');
delete deferreds[promise.$$timeoutId];
return $browser.defer.cancel(promise.$$timeoutId);
}
return false;
};
return timeout;
}];
}
/**
* @ngdoc object
* @name ng.$filterProvider
* @description
*
* Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To
* achieve this a filter definition consists of a factory function which is annotated with dependencies and is
* responsible for creating a filter function.
*
* <pre>
* // Filter registration
* function MyModule($provide, $filterProvider) {
* // create a service to demonstrate injection (not always needed)
* $provide.value('greet', function(name){
* return 'Hello ' + name + '!';
* });
*
* // register a filter factory which uses the
* // greet service to demonstrate DI.
* $filterProvider.register('greet', function(greet){
* // return the filter function which uses the greet service
* // to generate salutation
* return function(text) {
* // filters need to be forgiving so check input validity
* return text && greet(text) || text;
* };
* });
* }
* </pre>
*
* The filter function is registered with the `$injector` under the filter name suffixe with `Filter`.
* <pre>
* it('should be the same instance', inject(
* function($filterProvider) {
* $filterProvider.register('reverse', function(){
* return ...;
* });
* },
* function($filter, reverseFilter) {
* expect($filter('reverse')).toBe(reverseFilter);
* });
* </pre>
*
*
* For more information about how angular filters work, and how to create your own filters, see
* {@link guide/dev_guide.templates.filters Understanding Angular Filters} in the angular Developer
* Guide.
*/
/**
* @ngdoc method
* @name ng.$filterProvider#register
* @methodOf ng.$filterProvider
* @description
* Register filter factory function.
*
* @param {String} name Name of the filter.
* @param {function} fn The filter factory function which is injectable.
*/
/**
* @ngdoc function
* @name ng.$filter
* @function
* @description
* Filters are used for formatting data displayed to the user.
*
* The general syntax in templates is as follows:
*
* {{ expression [| filter_name[:parameter_value] ... ] }}
*
* @param {String} name Name of the filter function to retrieve
* @return {Function} the filter function
*/
$FilterProvider.$inject = ['$provide'];
function $FilterProvider($provide) {
var suffix = 'Filter';
function register(name, factory) {
return $provide.factory(name + suffix, factory);
}
this.register = register;
this.$get = ['$injector', function($injector) {
return function(name) {
return $injector.get(name + suffix);
}
}];
////////////////////////////////////////
register('currency', currencyFilter);
register('date', dateFilter);
register('filter', filterFilter);
register('json', jsonFilter);
register('limitTo', limitToFilter);
register('lowercase', lowercaseFilter);
register('number', numberFilter);
register('orderBy', orderByFilter);
register('uppercase', uppercaseFilter);
}
/**
* @ngdoc filter
* @name ng.filter:filter
* @function
*
* @description
* Selects a subset of items from `array` and returns it as a new array.
*
* Note: This function is used to augment the `Array` type in Angular expressions. See
* {@link ng.$filter} for more information about Angular arrays.
*
* @param {Array} array The source array.
* @param {string|Object|function()} expression The predicate to be used for selecting items from
* `array`.
*
* Can be one of:
*
* - `string`: Predicate that results in a substring match using the value of `expression`
* string. All strings or objects with string properties in `array` that contain this string
* will be returned. The predicate can be negated by prefixing the string with `!`.
*
* - `Object`: A pattern object can be used to filter specific properties on objects contained
* by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items
* which have property `name` containing "M" and property `phone` containing "1". A special
* property name `$` can be used (as in `{$:"text"}`) to accept a match against any
* property of the object. That's equivalent to the simple substring match with a `string`
* as described above.
*
* - `function`: A predicate function can be used to write arbitrary filters. The function is
* called for each element of `array`. The final result is an array of those elements that
* the predicate returned true for.
*
* @example
<doc:example>
<doc:source>
<div ng-init="friends = [{name:'John', phone:'555-1276'},
{name:'Mary', phone:'800-BIG-MARY'},
{name:'Mike', phone:'555-4321'},
{name:'Adam', phone:'555-5678'},
{name:'Julie', phone:'555-8765'}]"></div>
Search: <input ng-model="searchText">
<table id="searchTextResults">
<tr><th>Name</th><th>Phone</th></tr>
<tr ng-repeat="friend in friends | filter:searchText">
<td>{{friend.name}}</td>
<td>{{friend.phone}}</td>
</tr>
</table>
<hr>
Any: <input ng-model="search.$"> <br>
Name only <input ng-model="search.name"><br>
Phone only <input ng-model="search.phone"><br>
<table id="searchObjResults">
<tr><th>Name</th><th>Phone</th></tr>
<tr ng-repeat="friend in friends | filter:search">
<td>{{friend.name}}</td>
<td>{{friend.phone}}</td>
</tr>
</table>
</doc:source>
<doc:scenario>
it('should search across all fields when filtering with a string', function() {
input('searchText').enter('m');
expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')).
toEqual(['Mary', 'Mike', 'Adam']);
input('searchText').enter('76');
expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')).
toEqual(['John', 'Julie']);
});
it('should search in specific fields when filtering with a predicate object', function() {
input('search.$').enter('i');
expect(repeater('#searchObjResults tr', 'friend in friends').column('friend.name')).
toEqual(['Mary', 'Mike', 'Julie']);
});
</doc:scenario>
</doc:example>
*/
function filterFilter() {
return function(array, expression) {
if (!isArray(array)) return array;
var predicates = [];
predicates.check = function(value) {
for (var j = 0; j < predicates.length; j++) {
if(!predicates[j](value)) {
return false;
}
}
return true;
};
var search = function(obj, text){
if (text.charAt(0) === '!') {
return !search(obj, text.substr(1));
}
switch (typeof obj) {
case "boolean":
case "number":
case "string":
return ('' + obj).toLowerCase().indexOf(text) > -1;
case "object":
for ( var objKey in obj) {
if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) {
return true;
}
}
return false;
case "array":
for ( var i = 0; i < obj.length; i++) {
if (search(obj[i], text)) {
return true;
}
}
return false;
default:
return false;
}
};
switch (typeof expression) {
case "boolean":
case "number":
case "string":
expression = {$:expression};
case "object":
for (var key in expression) {
if (key == '$') {
(function() {
var text = (''+expression[key]).toLowerCase();
if (!text) return;
predicates.push(function(value) {
return search(value, text);
});
})();
} else {
(function() {
var path = key;
var text = (''+expression[key]).toLowerCase();
if (!text) return;
predicates.push(function(value) {
return search(getter(value, path), text);
});
})();
}
}
break;
case 'function':
predicates.push(expression);
break;
default:
return array;
}
var filtered = [];
for ( var j = 0; j < array.length; j++) {
var value = array[j];
if (predicates.check(value)) {
filtered.push(value);
}
}
return filtered;
}
}
/**
* @ngdoc filter
* @name ng.filter:currency
* @function
*
* @description
* Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default
* symbol for current locale is used.
*
* @param {number} amount Input to filter.
* @param {string=} symbol Currency symbol or identifier to be displayed.
* @returns {string} Formatted number.
*
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.amount = 1234.56;
}
</script>
<div ng-controller="Ctrl">
<input type="number" ng-model="amount"> <br>
default currency symbol ($): {{amount | currency}}<br>
custom currency identifier (USD$): {{amount | currency:"USD$"}}
</div>
</doc:source>
<doc:scenario>
it('should init with 1234.56', function() {
expect(binding('amount | currency')).toBe('$1,234.56');
expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56');
});
it('should update', function() {
input('amount').enter('-1234');
expect(binding('amount | currency')).toBe('($1,234.00)');
expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)');
});
</doc:scenario>
</doc:example>
*/
currencyFilter.$inject = ['$locale'];
function currencyFilter($locale) {
var formats = $locale.NUMBER_FORMATS;
return function(amount, currencySymbol){
if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM;
return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2).
replace(/\u00A4/g, currencySymbol);
};
}
/**
* @ngdoc filter
* @name ng.filter:number
* @function
*
* @description
* Formats a number as text.
*
* If the input is not a number an empty string is returned.
*
* @param {number|string} number Number to format.
* @param {(number|string)=} fractionSize Number of decimal places to round the number to.
* If this is not provided then the fraction size is computed from the current locale's number
* formatting pattern. In the case of the default locale, it will be 3.
* @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.val = 1234.56789;
}
</script>
<div ng-controller="Ctrl">
Enter number: <input ng-model='val'><br>
Default formatting: {{val | number}}<br>
No fractions: {{val | number:0}}<br>
Negative number: {{-val | number:4}}
</div>
</doc:source>
<doc:scenario>
it('should format numbers', function() {
expect(binding('val | number')).toBe('1,234.568');
expect(binding('val | number:0')).toBe('1,235');
expect(binding('-val | number:4')).toBe('-1,234.5679');
});
it('should update', function() {
input('val').enter('3374.333');
expect(binding('val | number')).toBe('3,374.333');
expect(binding('val | number:0')).toBe('3,374');
expect(binding('-val | number:4')).toBe('-3,374.3330');
});
</doc:scenario>
</doc:example>
*/
numberFilter.$inject = ['$locale'];
function numberFilter($locale) {
var formats = $locale.NUMBER_FORMATS;
return function(number, fractionSize) {
return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,
fractionSize);
};
}
var DECIMAL_SEP = '.';
function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
if (isNaN(number) || !isFinite(number)) return '';
var isNegative = number < 0;
number = Math.abs(number);
var numStr = number + '',
formatedText = '',
parts = [];
var hasExponent = false;
if (numStr.indexOf('e') !== -1) {
var match = numStr.match(/([\d\.]+)e(-?)(\d+)/);
if (match && match[2] == '-' && match[3] > fractionSize + 1) {
numStr = '0';
} else {
formatedText = numStr;
hasExponent = true;
}
}
if (!hasExponent) {
var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length;
// determine fractionSize if it is not specified
if (isUndefined(fractionSize)) {
fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac);
}
var pow = Math.pow(10, fractionSize);
number = Math.round(number * pow) / pow;
var fraction = ('' + number).split(DECIMAL_SEP);
var whole = fraction[0];
fraction = fraction[1] || '';
var pos = 0,
lgroup = pattern.lgSize,
group = pattern.gSize;
if (whole.length >= (lgroup + group)) {
pos = whole.length - lgroup;
for (var i = 0; i < pos; i++) {
if ((pos - i)%group === 0 && i !== 0) {
formatedText += groupSep;
}
formatedText += whole.charAt(i);
}
}
for (i = pos; i < whole.length; i++) {
if ((whole.length - i)%lgroup === 0 && i !== 0) {
formatedText += groupSep;
}
formatedText += whole.charAt(i);
}
// format fraction part.
while(fraction.length < fractionSize) {
fraction += '0';
}
if (fractionSize && fractionSize !== "0") formatedText += decimalSep + fraction.substr(0, fractionSize);
} else {
if (fractionSize > 0 && number > -1 && number < 1) {
formatedText = number.toFixed(fractionSize);
}
}
parts.push(isNegative ? pattern.negPre : pattern.posPre);
parts.push(formatedText);
parts.push(isNegative ? pattern.negSuf : pattern.posSuf);
return parts.join('');
}
function padNumber(num, digits, trim) {
var neg = '';
if (num < 0) {
neg = '-';
num = -num;
}
num = '' + num;
while(num.length < digits) num = '0' + num;
if (trim)
num = num.substr(num.length - digits);
return neg + num;
}
function dateGetter(name, size, offset, trim) {
offset = offset || 0;
return function(date) {
var value = date['get' + name]();
if (offset > 0 || value > -offset)
value += offset;
if (value === 0 && offset == -12 ) value = 12;
return padNumber(value, size, trim);
};
}
function dateStrGetter(name, shortForm) {
return function(date, formats) {
var value = date['get' + name]();
var get = uppercase(shortForm ? ('SHORT' + name) : name);
return formats[get][value];
};
}
function timeZoneGetter(date) {
var zone = -1 * date.getTimezoneOffset();
var paddedZone = (zone >= 0) ? "+" : "";
paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
padNumber(Math.abs(zone % 60), 2);
return paddedZone;
}
function ampmGetter(date, formats) {
return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
}
var DATE_FORMATS = {
yyyy: dateGetter('FullYear', 4),
yy: dateGetter('FullYear', 2, 0, true),
y: dateGetter('FullYear', 1),
MMMM: dateStrGetter('Month'),
MMM: dateStrGetter('Month', true),
MM: dateGetter('Month', 2, 1),
M: dateGetter('Month', 1, 1),
dd: dateGetter('Date', 2),
d: dateGetter('Date', 1),
HH: dateGetter('Hours', 2),
H: dateGetter('Hours', 1),
hh: dateGetter('Hours', 2, -12),
h: dateGetter('Hours', 1, -12),
mm: dateGetter('Minutes', 2),
m: dateGetter('Minutes', 1),
ss: dateGetter('Seconds', 2),
s: dateGetter('Seconds', 1),
EEEE: dateStrGetter('Day'),
EEE: dateStrGetter('Day', true),
a: ampmGetter,
Z: timeZoneGetter
};
var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
NUMBER_STRING = /^\d+$/;
/**
* @ngdoc filter
* @name ng.filter:date
* @function
*
* @description
* Formats `date` to a string based on the requested `format`.
*
* `format` string can be composed of the following elements:
*
* * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
* * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
* * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
* * `'MMMM'`: Month in year (January-December)
* * `'MMM'`: Month in year (Jan-Dec)
* * `'MM'`: Month in year, padded (01-12)
* * `'M'`: Month in year (1-12)
* * `'dd'`: Day in month, padded (01-31)
* * `'d'`: Day in month (1-31)
* * `'EEEE'`: Day in Week,(Sunday-Saturday)
* * `'EEE'`: Day in Week, (Sun-Sat)
* * `'HH'`: Hour in day, padded (00-23)
* * `'H'`: Hour in day (0-23)
* * `'hh'`: Hour in am/pm, padded (01-12)
* * `'h'`: Hour in am/pm, (1-12)
* * `'mm'`: Minute in hour, padded (00-59)
* * `'m'`: Minute in hour (0-59)
* * `'ss'`: Second in minute, padded (00-59)
* * `'s'`: Second in minute (0-59)
* * `'a'`: am/pm marker
* * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
*
* `format` string can also be one of the following predefined
* {@link guide/i18n localizable formats}:
*
* * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale
* (e.g. Sep 3, 2010 12:05:08 pm)
* * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 pm)
* * `'fullDate'`: equivalent to `'EEEE, MMMM d,y'` for en_US locale
* (e.g. Friday, September 3, 2010)
* * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010)
* * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010)
* * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)
* * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm)
* * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm)
*
* `format` string can contain literal values. These need to be quoted with single quotes (e.g.
* `"h 'in the morning'"`). In order to output single quote, use two single quotes in a sequence
* (e.g. `"h 'o''clock'"`).
*
* @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
* number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and its
* shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
* specified in the string input, the time is considered to be in the local timezone.
* @param {string=} format Formatting rules (see Description). If not specified,
* `mediumDate` is used.
* @returns {string} Formatted string or the input if input is not recognized as date/millis.
*
* @example
<doc:example>
<doc:source>
<span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
{{1288323623006 | date:'medium'}}<br>
<span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}<br>
<span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}<br>
</doc:source>
<doc:scenario>
it('should format date', function() {
expect(binding("1288323623006 | date:'medium'")).
toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).
toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
expect(binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).
toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
});
</doc:scenario>
</doc:example>
*/
dateFilter.$inject = ['$locale'];
function dateFilter($locale) {
var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
function jsonStringToDate(string){
var match;
if (match = string.match(R_ISO8601_STR)) {
var date = new Date(0),
tzHour = 0,
tzMin = 0;
if (match[9]) {
tzHour = int(match[9] + match[10]);
tzMin = int(match[9] + match[11]);
}
date.setUTCFullYear(int(match[1]), int(match[2]) - 1, int(match[3]));
date.setUTCHours(int(match[4]||0) - tzHour, int(match[5]||0) - tzMin, int(match[6]||0), int(match[7]||0));
return date;
}
return string;
}
return function(date, format) {
var text = '',
parts = [],
fn, match;
format = format || 'mediumDate';
format = $locale.DATETIME_FORMATS[format] || format;
if (isString(date)) {
if (NUMBER_STRING.test(date)) {
date = int(date);
} else {
date = jsonStringToDate(date);
}
}
if (isNumber(date)) {
date = new Date(date);
}
if (!isDate(date)) {
return date;
}
while(format) {
match = DATE_FORMATS_SPLIT.exec(format);
if (match) {
parts = concat(parts, match, 1);
format = parts.pop();
} else {
parts.push(format);
format = null;
}
}
forEach(parts, function(value){
fn = DATE_FORMATS[value];
text += fn ? fn(date, $locale.DATETIME_FORMATS)
: value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
});
return text;
};
}
/**
* @ngdoc filter
* @name ng.filter:json
* @function
*
* @description
* Allows you to convert a JavaScript object into JSON string.
*
* This filter is mostly useful for debugging. When using the double curly {{value}} notation
* the binding is automatically converted to JSON.
*
* @param {*} object Any JavaScript object (including arrays and primitive types) to filter.
* @returns {string} JSON string.
*
*
* @example:
<doc:example>
<doc:source>
<pre>{{ {'name':'value'} | json }}</pre>
</doc:source>
<doc:scenario>
it('should jsonify filtered objects', function() {
expect(binding("{'name':'value'}")).toMatch(/\{\n "name": ?"value"\n}/);
});
</doc:scenario>
</doc:example>
*
*/
function jsonFilter() {
return function(object) {
return toJson(object, true);
};
}
/**
* @ngdoc filter
* @name ng.filter:lowercase
* @function
* @description
* Converts string to lowercase.
* @see angular.lowercase
*/
var lowercaseFilter = valueFn(lowercase);
/**
* @ngdoc filter
* @name ng.filter:uppercase
* @function
* @description
* Converts string to uppercase.
* @see angular.uppercase
*/
var uppercaseFilter = valueFn(uppercase);
/**
* @ngdoc function
* @name ng.filter:limitTo
* @function
*
* @description
* Creates a new array containing only a specified number of elements in an array. The elements
* are taken from either the beginning or the end of the source array, as specified by the
* value and sign (positive or negative) of `limit`.
*
* Note: This function is used to augment the `Array` type in Angular expressions. See
* {@link ng.$filter} for more information about Angular arrays.
*
* @param {Array} array Source array to be limited.
* @param {string|Number} limit The length of the returned array. If the `limit` number is
* positive, `limit` number of items from the beginning of the source array are copied.
* If the number is negative, `limit` number of items from the end of the source array are
* copied. The `limit` will be trimmed if it exceeds `array.length`
* @returns {Array} A new sub-array of length `limit` or less if input array had less than `limit`
* elements.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.numbers = [1,2,3,4,5,6,7,8,9];
$scope.limit = 3;
}
</script>
<div ng-controller="Ctrl">
Limit {{numbers}} to: <input type="integer" ng-model="limit">
<p>Output: {{ numbers | limitTo:limit }}</p>
</div>
</doc:source>
<doc:scenario>
it('should limit the numer array to first three items', function() {
expect(element('.doc-example-live input[ng-model=limit]').val()).toBe('3');
expect(binding('numbers | limitTo:limit')).toEqual('[1,2,3]');
});
it('should update the output when -3 is entered', function() {
input('limit').enter(-3);
expect(binding('numbers | limitTo:limit')).toEqual('[7,8,9]');
});
it('should not exceed the maximum size of input array', function() {
input('limit').enter(100);
expect(binding('numbers | limitTo:limit')).toEqual('[1,2,3,4,5,6,7,8,9]');
});
</doc:scenario>
</doc:example>
*/
function limitToFilter(){
return function(array, limit) {
if (!(array instanceof Array)) return array;
limit = int(limit);
var out = [],
i, n;
// check that array is iterable
if (!array || !(array instanceof Array))
return out;
// if abs(limit) exceeds maximum length, trim it
if (limit > array.length)
limit = array.length;
else if (limit < -array.length)
limit = -array.length;
if (limit > 0) {
i = 0;
n = limit;
} else {
i = array.length + limit;
n = array.length;
}
for (; i<n; i++) {
out.push(array[i]);
}
return out;
}
}
/**
* @ngdoc function
* @name ng.filter:orderBy
* @function
*
* @description
* Orders a specified `array` by the `expression` predicate.
*
* Note: this function is used to augment the `Array` type in Angular expressions. See
* {@link ng.$filter} for more informaton about Angular arrays.
*
* @param {Array} array The array to sort.
* @param {function(*)|string|Array.<(function(*)|string)>} expression A predicate to be
* used by the comparator to determine the order of elements.
*
* Can be one of:
*
* - `function`: Getter function. The result of this function will be sorted using the
* `<`, `=`, `>` operator.
* - `string`: An Angular expression which evaluates to an object to order by, such as 'name'
* to sort by a property called 'name'. Optionally prefixed with `+` or `-` to control
* ascending or descending sort order (for example, +name or -name).
* - `Array`: An array of function or string predicates. The first predicate in the array
* is used for sorting, but when two items are equivalent, the next predicate is used.
*
* @param {boolean=} reverse Reverse the order the array.
* @returns {Array} Sorted copy of the source array.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.friends =
[{name:'John', phone:'555-1212', age:10},
{name:'Mary', phone:'555-9876', age:19},
{name:'Mike', phone:'555-4321', age:21},
{name:'Adam', phone:'555-5678', age:35},
{name:'Julie', phone:'555-8765', age:29}]
$scope.predicate = '-age';
}
</script>
<div ng-controller="Ctrl">
<pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
<hr/>
[ <a href="" ng-click="predicate=''">unsorted</a> ]
<table class="friend">
<tr>
<th><a href="" ng-click="predicate = 'name'; reverse=false">Name</a>
(<a href ng-click="predicate = '-name'; reverse=false">^</a>)</th>
<th><a href="" ng-click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th>
<th><a href="" ng-click="predicate = 'age'; reverse=!reverse">Age</a></th>
</tr>
<tr ng-repeat="friend in friends | orderBy:predicate:reverse">
<td>{{friend.name}}</td>
<td>{{friend.phone}}</td>
<td>{{friend.age}}</td>
</tr>
</table>
</div>
</doc:source>
<doc:scenario>
it('should be reverse ordered by aged', function() {
expect(binding('predicate')).toBe('-age');
expect(repeater('table.friend', 'friend in friends').column('friend.age')).
toEqual(['35', '29', '21', '19', '10']);
expect(repeater('table.friend', 'friend in friends').column('friend.name')).
toEqual(['Adam', 'Julie', 'Mike', 'Mary', 'John']);
});
it('should reorder the table when user selects different predicate', function() {
element('.doc-example-live a:contains("Name")').click();
expect(repeater('table.friend', 'friend in friends').column('friend.name')).
toEqual(['Adam', 'John', 'Julie', 'Mary', 'Mike']);
expect(repeater('table.friend', 'friend in friends').column('friend.age')).
toEqual(['35', '10', '29', '19', '21']);
element('.doc-example-live a:contains("Phone")').click();
expect(repeater('table.friend', 'friend in friends').column('friend.phone')).
toEqual(['555-9876', '555-8765', '555-5678', '555-4321', '555-1212']);
expect(repeater('table.friend', 'friend in friends').column('friend.name')).
toEqual(['Mary', 'Julie', 'Adam', 'Mike', 'John']);
});
</doc:scenario>
</doc:example>
*/
orderByFilter.$inject = ['$parse'];
function orderByFilter($parse){
return function(array, sortPredicate, reverseOrder) {
if (!isArray(array)) return array;
if (!sortPredicate) return array;
sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate];
sortPredicate = map(sortPredicate, function(predicate){
var descending = false, get = predicate || identity;
if (isString(predicate)) {
if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
descending = predicate.charAt(0) == '-';
predicate = predicate.substring(1);
}
get = $parse(predicate);
}
return reverseComparator(function(a,b){
return compare(get(a),get(b));
}, descending);
});
var arrayCopy = [];
for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }
return arrayCopy.sort(reverseComparator(comparator, reverseOrder));
function comparator(o1, o2){
for ( var i = 0; i < sortPredicate.length; i++) {
var comp = sortPredicate[i](o1, o2);
if (comp !== 0) return comp;
}
return 0;
}
function reverseComparator(comp, descending) {
return toBoolean(descending)
? function(a,b){return comp(b,a);}
: comp;
}
function compare(v1, v2){
var t1 = typeof v1;
var t2 = typeof v2;
if (t1 == t2) {
if (t1 == "string") {
v1 = v1.toLowerCase();
v2 = v2.toLowerCase();
}
if (v1 === v2) return 0;
return v1 < v2 ? -1 : 1;
} else {
return t1 < t2 ? -1 : 1;
}
}
}
}
function ngDirective(directive) {
if (isFunction(directive)) {
directive = {
link: directive
}
}
directive.restrict = directive.restrict || 'AC';
return valueFn(directive);
}
/**
* @ngdoc directive
* @name ng.directive:a
* @restrict E
*
* @description
* Modifies the default behavior of html A tag, so that the default action is prevented when href
* attribute is empty.
*
* The reasoning for this change is to allow easy creation of action links with `ngClick` directive
* without changing the location or causing page reloads, e.g.:
* `<a href="" ng-click="model.$save()">Save</a>`
*/
var htmlAnchorDirective = valueFn({
restrict: 'E',
compile: function(element, attr) {
if (msie <= 8) {
// turn <a href ng-click="..">link</a> into a stylable link in IE
// but only if it doesn't have name attribute, in which case it's an anchor
if (!attr.href && !attr.name) {
attr.$set('href', '');
}
// add a comment node to anchors to workaround IE bug that causes element content to be reset
// to new attribute content if attribute is updated with value containing @ and element also
// contains value with @
// see issue #1949
element.append(document.createComment('IE fix'));
}
return function(scope, element) {
element.bind('click', function(event){
// if we have no href url, then don't navigate anywhere.
if (!element.attr('href')) {
event.preventDefault();
}
});
}
}
});
/**
* @ngdoc directive
* @name ng.directive:ngHref
* @restrict A
*
* @description
* Using Angular markup like {{hash}} in an href attribute makes
* the page open to a wrong URL, if the user clicks that link before
* angular has a chance to replace the {{hash}} with actual URL, the
* link will be broken and will most likely return a 404 error.
* The `ngHref` directive solves this problem.
*
* The buggy way to write it:
* <pre>
* <a href="http://www.gravatar.com/avatar/{{hash}}"/>
* </pre>
*
* The correct way to write it:
* <pre>
* <a ng-href="http://www.gravatar.com/avatar/{{hash}}"/>
* </pre>
*
* @element A
* @param {template} ngHref any string which can contain `{{}}` markup.
*
* @example
* This example uses `link` variable inside `href` attribute:
<doc:example>
<doc:source>
<input ng-model="value" /><br />
<a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br />
<a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br />
<a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br />
<a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br />
<a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br />
<a id="link-6" ng-href="{{value}}">link</a> (link, change location)
</doc:source>
<doc:scenario>
it('should execute ng-click but not reload when href without value', function() {
element('#link-1').click();
expect(input('value').val()).toEqual('1');
expect(element('#link-1').attr('href')).toBe("");
});
it('should execute ng-click but not reload when href empty string', function() {
element('#link-2').click();
expect(input('value').val()).toEqual('2');
expect(element('#link-2').attr('href')).toBe("");
});
it('should execute ng-click and change url when ng-href specified', function() {
expect(element('#link-3').attr('href')).toBe("/123");
element('#link-3').click();
expect(browser().window().path()).toEqual('/123');
});
it('should execute ng-click but not reload when href empty string and name specified', function() {
element('#link-4').click();
expect(input('value').val()).toEqual('4');
expect(element('#link-4').attr('href')).toBe('');
});
it('should execute ng-click but not reload when no href but name specified', function() {
element('#link-5').click();
expect(input('value').val()).toEqual('5');
expect(element('#link-5').attr('href')).toBe(undefined);
});
it('should only change url when only ng-href', function() {
input('value').enter('6');
expect(element('#link-6').attr('href')).toBe('6');
element('#link-6').click();
expect(browser().location().url()).toEqual('/6');
});
</doc:scenario>
</doc:example>
*/
/**
* @ngdoc directive
* @name ng.directive:ngSrc
* @restrict A
*
* @description
* Using Angular markup like `{{hash}}` in a `src` attribute doesn't
* work right: The browser will fetch from the URL with the literal
* text `{{hash}}` until Angular replaces the expression inside
* `{{hash}}`. The `ngSrc` directive solves this problem.
*
* The buggy way to write it:
* <pre>
* <img src="http://www.gravatar.com/avatar/{{hash}}"/>
* </pre>
*
* The correct way to write it:
* <pre>
* <img ng-src="http://www.gravatar.com/avatar/{{hash}}"/>
* </pre>
*
* @element IMG
* @param {template} ngSrc any string which can contain `{{}}` markup.
*/
/**
* @ngdoc directive
* @name ng.directive:ngDisabled
* @restrict A
*
* @description
*
* The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs:
* <pre>
* <div ng-init="scope = { isDisabled: false }">
* <button disabled="{{scope.isDisabled}}">Disabled</button>
* </div>
* </pre>
*
* The HTML specs do not require browsers to preserve the special attributes such as disabled.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduce the `ngDisabled` directive.
*
* @example
<doc:example>
<doc:source>
Click me to toggle: <input type="checkbox" ng-model="checked"><br/>
<button ng-model="button" ng-disabled="checked">Button</button>
</doc:source>
<doc:scenario>
it('should toggle button', function() {
expect(element('.doc-example-live :button').prop('disabled')).toBeFalsy();
input('checked').check();
expect(element('.doc-example-live :button').prop('disabled')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element INPUT
* @param {expression} ngDisabled Angular expression that will be evaluated.
*/
/**
* @ngdoc directive
* @name ng.directive:ngChecked
* @restrict A
*
* @description
* The HTML specs do not require browsers to preserve the special attributes such as checked.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduce the `ngChecked` directive.
* @example
<doc:example>
<doc:source>
Check me to check both: <input type="checkbox" ng-model="master"><br/>
<input id="checkSlave" type="checkbox" ng-checked="master">
</doc:source>
<doc:scenario>
it('should check both checkBoxes', function() {
expect(element('.doc-example-live #checkSlave').prop('checked')).toBeFalsy();
input('master').check();
expect(element('.doc-example-live #checkSlave').prop('checked')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element INPUT
* @param {expression} ngChecked Angular expression that will be evaluated.
*/
/**
* @ngdoc directive
* @name ng.directive:ngMultiple
* @restrict A
*
* @description
* The HTML specs do not require browsers to preserve the special attributes such as multiple.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduce the `ngMultiple` directive.
*
* @example
<doc:example>
<doc:source>
Check me check multiple: <input type="checkbox" ng-model="checked"><br/>
<select id="select" ng-multiple="checked">
<option>Misko</option>
<option>Igor</option>
<option>Vojta</option>
<option>Di</option>
</select>
</doc:source>
<doc:scenario>
it('should toggle multiple', function() {
expect(element('.doc-example-live #select').prop('multiple')).toBeFalsy();
input('checked').check();
expect(element('.doc-example-live #select').prop('multiple')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element SELECT
* @param {expression} ngMultiple Angular expression that will be evaluated.
*/
/**
* @ngdoc directive
* @name ng.directive:ngReadonly
* @restrict A
*
* @description
* The HTML specs do not require browsers to preserve the special attributes such as readonly.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduce the `ngReadonly` directive.
* @example
<doc:example>
<doc:source>
Check me to make text readonly: <input type="checkbox" ng-model="checked"><br/>
<input type="text" ng-readonly="checked" value="I'm Angular"/>
</doc:source>
<doc:scenario>
it('should toggle readonly attr', function() {
expect(element('.doc-example-live :text').prop('readonly')).toBeFalsy();
input('checked').check();
expect(element('.doc-example-live :text').prop('readonly')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element INPUT
* @param {string} expression Angular expression that will be evaluated.
*/
/**
* @ngdoc directive
* @name ng.directive:ngSelected
* @restrict A
*
* @description
* The HTML specs do not require browsers to preserve the special attributes such as selected.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduced the `ngSelected` directive.
* @example
<doc:example>
<doc:source>
Check me to select: <input type="checkbox" ng-model="selected"><br/>
<select>
<option>Hello!</option>
<option id="greet" ng-selected="selected">Greetings!</option>
</select>
</doc:source>
<doc:scenario>
it('should select Greetings!', function() {
expect(element('.doc-example-live #greet').prop('selected')).toBeFalsy();
input('selected').check();
expect(element('.doc-example-live #greet').prop('selected')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element OPTION
* @param {string} expression Angular expression that will be evaluated.
*/
var ngAttributeAliasDirectives = {};
// boolean attrs are evaluated
forEach(BOOLEAN_ATTR, function(propName, attrName) {
var normalized = directiveNormalize('ng-' + attrName);
ngAttributeAliasDirectives[normalized] = function() {
return {
priority: 100,
compile: function() {
return function(scope, element, attr) {
scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
attr.$set(attrName, !!value);
});
};
}
};
};
});
// ng-src, ng-href are interpolated
forEach(['src', 'href'], function(attrName) {
var normalized = directiveNormalize('ng-' + attrName);
ngAttributeAliasDirectives[normalized] = function() {
return {
priority: 99, // it needs to run after the attributes are interpolated
link: function(scope, element, attr) {
attr.$observe(normalized, function(value) {
if (!value)
return;
attr.$set(attrName, value);
// on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
// then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
// to set the property as well to achieve the desired effect.
// we use attr[attrName] value since $set can sanitize the url.
if (msie) element.prop(attrName, attr[attrName]);
});
}
};
};
});
var nullFormCtrl = {
$addControl: noop,
$removeControl: noop,
$setValidity: noop,
$setDirty: noop
};
/**
* @ngdoc object
* @name ng.directive:form.FormController
*
* @property {boolean} $pristine True if user has not interacted with the form yet.
* @property {boolean} $dirty True if user has already interacted with the form.
* @property {boolean} $valid True if all of the containing forms and controls are valid.
* @property {boolean} $invalid True if at least one containing control or form is invalid.
*
* @property {Object} $error Is an object hash, containing references to all invalid controls or
* forms, where:
*
* - keys are validation tokens (error names) — such as `required`, `url` or `email`),
* - values are arrays of controls or forms that are invalid with given error.
*
* @description
* `FormController` keeps track of all its controls and nested forms as well as state of them,
* such as being valid/invalid or dirty/pristine.
*
* Each {@link ng.directive:form form} directive creates an instance
* of `FormController`.
*
*/
//asks for $scope to fool the BC controller module
FormController.$inject = ['$element', '$attrs', '$scope'];
function FormController(element, attrs) {
var form = this,
parentForm = element.parent().controller('form') || nullFormCtrl,
invalidCount = 0, // used to easily determine if we are valid
errors = form.$error = {};
// init state
form.$name = attrs.name || attrs.ngForm;
form.$dirty = false;
form.$pristine = true;
form.$valid = true;
form.$invalid = false;
parentForm.$addControl(form);
// Setup initial state of the control
element.addClass(PRISTINE_CLASS);
toggleValidCss(true);
// convenience method for easy toggling of classes
function toggleValidCss(isValid, validationErrorKey) {
validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
element.
removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey).
addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);
}
/**
* @ngdoc function
* @name ng.directive:form.FormController#$addControl
* @methodOf ng.directive:form.FormController
*
* @description
* Register a control with the form.
*
* Input elements using ngModelController do this automatically when they are linked.
*/
form.$addControl = function(control) {
if (control.$name && !form.hasOwnProperty(control.$name)) {
form[control.$name] = control;
}
};
/**
* @ngdoc function
* @name ng.directive:form.FormController#$removeControl
* @methodOf ng.directive:form.FormController
*
* @description
* Deregister a control from the form.
*
* Input elements using ngModelController do this automatically when they are destroyed.
*/
form.$removeControl = function(control) {
if (control.$name && form[control.$name] === control) {
delete form[control.$name];
}
forEach(errors, function(queue, validationToken) {
form.$setValidity(validationToken, true, control);
});
};
/**
* @ngdoc function
* @name ng.directive:form.FormController#$setValidity
* @methodOf ng.directive:form.FormController
*
* @description
* Sets the validity of a form control.
*
* This method will also propagate to parent forms.
*/
form.$setValidity = function(validationToken, isValid, control) {
var queue = errors[validationToken];
if (isValid) {
if (queue) {
arrayRemove(queue, control);
if (!queue.length) {
invalidCount--;
if (!invalidCount) {
toggleValidCss(isValid);
form.$valid = true;
form.$invalid = false;
}
errors[validationToken] = false;
toggleValidCss(true, validationToken);
parentForm.$setValidity(validationToken, true, form);
}
}
} else {
if (!invalidCount) {
toggleValidCss(isValid);
}
if (queue) {
if (includes(queue, control)) return;
} else {
errors[validationToken] = queue = [];
invalidCount++;
toggleValidCss(false, validationToken);
parentForm.$setValidity(validationToken, false, form);
}
queue.push(control);
form.$valid = false;
form.$invalid = true;
}
};
/**
* @ngdoc function
* @name ng.directive:form.FormController#$setDirty
* @methodOf ng.directive:form.FormController
*
* @description
* Sets the form to a dirty state.
*
* This method can be called to add the 'ng-dirty' class and set the form to a dirty
* state (ng-dirty class). This method will also propagate to parent forms.
*/
form.$setDirty = function() {
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
form.$dirty = true;
form.$pristine = false;
parentForm.$setDirty();
};
}
/**
* @ngdoc directive
* @name ng.directive:ngForm
* @restrict EAC
*
* @description
* Nestable alias of {@link ng.directive:form `form`} directive. HTML
* does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
* sub-group of controls needs to be determined.
*
* @param {string=} name|ngForm Name of the form. If specified, the form controller will be published into
* related scope, under this name.
*
*/
/**
* @ngdoc directive
* @name ng.directive:form
* @restrict E
*
* @description
* Directive that instantiates
* {@link ng.directive:form.FormController FormController}.
*
* If `name` attribute is specified, the form controller is published onto the current scope under
* this name.
*
* # Alias: {@link ng.directive:ngForm `ngForm`}
*
* In angular forms can be nested. This means that the outer form is valid when all of the child
* forms are valid as well. However browsers do not allow nesting of `<form>` elements, for this
* reason angular provides {@link ng.directive:ngForm `ngForm`} alias
* which behaves identical to `<form>` but allows form nesting.
*
*
* # CSS classes
* - `ng-valid` Is set if the form is valid.
* - `ng-invalid` Is set if the form is invalid.
* - `ng-pristine` Is set if the form is pristine.
* - `ng-dirty` Is set if the form is dirty.
*
*
* # Submitting a form and preventing default action
*
* Since the role of forms in client-side Angular applications is different than in classical
* roundtrip apps, it is desirable for the browser not to translate the form submission into a full
* page reload that sends the data to the server. Instead some javascript logic should be triggered
* to handle the form submission in application specific way.
*
* For this reason, Angular prevents the default action (form submission to the server) unless the
* `<form>` element has an `action` attribute specified.
*
* You can use one of the following two ways to specify what javascript method should be called when
* a form is submitted:
*
* - {@link ng.directive:ngSubmit ngSubmit} directive on the form element
* - {@link ng.directive:ngClick ngClick} directive on the first
* button or input field of type submit (input[type=submit])
*
* To prevent double execution of the handler, use only one of ngSubmit or ngClick directives. This
* is because of the following form submission rules coming from the html spec:
*
* - If a form has only one input field then hitting enter in this field triggers form submit
* (`ngSubmit`)
* - if a form has has 2+ input fields and no buttons or input[type=submit] then hitting enter
* doesn't trigger submit
* - if a form has one or more input fields and one or more buttons or input[type=submit] then
* hitting enter in any of the input fields will trigger the click handler on the *first* button or
* input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)
*
* @param {string=} name Name of the form. If specified, the form controller will be published into
* related scope, under this name.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.userType = 'guest';
}
</script>
<form name="myForm" ng-controller="Ctrl">
userType: <input name="input" ng-model="userType" required>
<span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
<tt>userType = {{userType}}</tt><br>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('userType')).toEqual('guest');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('userType').enter('');
expect(binding('userType')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
var formDirectiveFactory = function(isNgForm) {
return ['$timeout', function($timeout) {
var formDirective = {
name: 'form',
restrict: 'E',
controller: FormController,
compile: function() {
return {
pre: function(scope, formElement, attr, controller) {
if (!attr.action) {
// we can't use jq events because if a form is destroyed during submission the default
// action is not prevented. see #1238
//
// IE 9 is not affected because it doesn't fire a submit event and try to do a full
// page reload if the form was destroyed by submission of the form via a click handler
// on a button in the form. Looks like an IE9 specific bug.
var preventDefaultListener = function(event) {
event.preventDefault
? event.preventDefault()
: event.returnValue = false; // IE
};
addEventListenerFn(formElement[0], 'submit', preventDefaultListener);
// unregister the preventDefault listener so that we don't not leak memory but in a
// way that will achieve the prevention of the default action.
formElement.bind('$destroy', function() {
$timeout(function() {
removeEventListenerFn(formElement[0], 'submit', preventDefaultListener);
}, 0, false);
});
}
var parentFormCtrl = formElement.parent().controller('form'),
alias = attr.name || attr.ngForm;
if (alias) {
scope[alias] = controller;
}
if (parentFormCtrl) {
formElement.bind('$destroy', function() {
parentFormCtrl.$removeControl(controller);
if (alias) {
scope[alias] = undefined;
}
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
});
}
}
};
}
};
return isNgForm ? extend(copy(formDirective), {restrict: 'EAC'}) : formDirective;
}];
};
var formDirective = formDirectiveFactory();
var ngFormDirective = formDirectiveFactory(true);
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/;
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
var inputType = {
/**
* @ngdoc inputType
* @name ng.directive:input.text
*
* @description
* Standard HTML text input with angular data binding.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Adds `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.text = 'guest';
$scope.word = /^\w*$/;
}
</script>
<form name="myForm" ng-controller="Ctrl">
Single word: <input type="text" name="input" ng-model="text"
ng-pattern="word" required>
<span class="error" ng-show="myForm.input.$error.required">
Required!</span>
<span class="error" ng-show="myForm.input.$error.pattern">
Single word only!</span>
<tt>text = {{text}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('text')).toEqual('guest');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('text').enter('');
expect(binding('text')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
it('should be invalid if multi word', function() {
input('text').enter('hello world');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
'text': textInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.number
*
* @description
* Text input with number validation and transformation. Sets the `number` validation
* error if not a valid number.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
* @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.value = 12;
}
</script>
<form name="myForm" ng-controller="Ctrl">
Number: <input type="number" name="input" ng-model="value"
min="0" max="99" required>
<span class="error" ng-show="myForm.input.$error.required">
Required!</span>
<span class="error" ng-show="myForm.input.$error.number">
Not valid number!</span>
<tt>value = {{value}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('value')).toEqual('12');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('value').enter('');
expect(binding('value')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
it('should be invalid if over max', function() {
input('value').enter('123');
expect(binding('value')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
'number': numberInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.url
*
* @description
* Text input with URL validation. Sets the `url` validation error key if the content is not a
* valid URL.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.text = 'http://google.com';
}
</script>
<form name="myForm" ng-controller="Ctrl">
URL: <input type="url" name="input" ng-model="text" required>
<span class="error" ng-show="myForm.input.$error.required">
Required!</span>
<span class="error" ng-show="myForm.input.$error.url">
Not valid url!</span>
<tt>text = {{text}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
<tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('text')).toEqual('http://google.com');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('text').enter('');
expect(binding('text')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
it('should be invalid if not url', function() {
input('text').enter('xxx');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
'url': urlInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.email
*
* @description
* Text input with email validation. Sets the `email` validation error key if not a valid email
* address.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.text = 'me@example.com';
}
</script>
<form name="myForm" ng-controller="Ctrl">
Email: <input type="email" name="input" ng-model="text" required>
<span class="error" ng-show="myForm.input.$error.required">
Required!</span>
<span class="error" ng-show="myForm.input.$error.email">
Not valid email!</span>
<tt>text = {{text}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
<tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('text')).toEqual('me@example.com');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('text').enter('');
expect(binding('text')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
it('should be invalid if not email', function() {
input('text').enter('xxx');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
'email': emailInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.radio
*
* @description
* HTML radio button.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string} value The value to which the expression should be set when selected.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.color = 'blue';
}
</script>
<form name="myForm" ng-controller="Ctrl">
<input type="radio" ng-model="color" value="red"> Red <br/>
<input type="radio" ng-model="color" value="green"> Green <br/>
<input type="radio" ng-model="color" value="blue"> Blue <br/>
<tt>color = {{color}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should change state', function() {
expect(binding('color')).toEqual('blue');
input('color').select('red');
expect(binding('color')).toEqual('red');
});
</doc:scenario>
</doc:example>
*/
'radio': radioInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.checkbox
*
* @description
* HTML checkbox.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} ngTrueValue The value to which the expression should be set when selected.
* @param {string=} ngFalseValue The value to which the expression should be set when not selected.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.value1 = true;
$scope.value2 = 'YES'
}
</script>
<form name="myForm" ng-controller="Ctrl">
Value1: <input type="checkbox" ng-model="value1"> <br/>
Value2: <input type="checkbox" ng-model="value2"
ng-true-value="YES" ng-false-value="NO"> <br/>
<tt>value1 = {{value1}}</tt><br/>
<tt>value2 = {{value2}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should change state', function() {
expect(binding('value1')).toEqual('true');
expect(binding('value2')).toEqual('YES');
input('value1').check();
input('value2').check();
expect(binding('value1')).toEqual('false');
expect(binding('value2')).toEqual('NO');
});
</doc:scenario>
</doc:example>
*/
'checkbox': checkboxInputType,
'hidden': noop,
'button': noop,
'submit': noop,
'reset': noop
};
function isEmpty(value) {
return isUndefined(value) || value === '' || value === null || value !== value;
}
function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
var listener = function() {
var value = trim(element.val());
if (ctrl.$viewValue !== value) {
scope.$apply(function() {
ctrl.$setViewValue(value);
});
}
};
// if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the
// input event on backspace, delete or cut
if ($sniffer.hasEvent('input')) {
element.bind('input', listener);
} else {
var timeout;
var deferListener = function() {
if (!timeout) {
timeout = $browser.defer(function() {
listener();
timeout = null;
});
}
};
element.bind('keydown', function(event) {
var key = event.keyCode;
// ignore
// command modifiers arrows
if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
deferListener();
});
// if user paste into input using mouse, we need "change" event to catch it
element.bind('change', listener);
// if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
if ($sniffer.hasEvent('paste')) {
element.bind('paste cut', deferListener);
}
}
ctrl.$render = function() {
element.val(isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);
};
// pattern validator
var pattern = attr.ngPattern,
patternValidator;
var validate = function(regexp, value) {
if (isEmpty(value) || regexp.test(value)) {
ctrl.$setValidity('pattern', true);
return value;
} else {
ctrl.$setValidity('pattern', false);
return undefined;
}
};
if (pattern) {
if (pattern.match(/^\/(.*)\/$/)) {
pattern = new RegExp(pattern.substr(1, pattern.length - 2));
patternValidator = function(value) {
return validate(pattern, value)
};
} else {
patternValidator = function(value) {
var patternObj = scope.$eval(pattern);
if (!patternObj || !patternObj.test) {
throw new Error('Expected ' + pattern + ' to be a RegExp but was ' + patternObj);
}
return validate(patternObj, value);
};
}
ctrl.$formatters.push(patternValidator);
ctrl.$parsers.push(patternValidator);
}
// min length validator
if (attr.ngMinlength) {
var minlength = int(attr.ngMinlength);
var minLengthValidator = function(value) {
if (!isEmpty(value) && value.length < minlength) {
ctrl.$setValidity('minlength', false);
return undefined;
} else {
ctrl.$setValidity('minlength', true);
return value;
}
};
ctrl.$parsers.push(minLengthValidator);
ctrl.$formatters.push(minLengthValidator);
}
// max length validator
if (attr.ngMaxlength) {
var maxlength = int(attr.ngMaxlength);
var maxLengthValidator = function(value) {
if (!isEmpty(value) && value.length > maxlength) {
ctrl.$setValidity('maxlength', false);
return undefined;
} else {
ctrl.$setValidity('maxlength', true);
return value;
}
};
ctrl.$parsers.push(maxLengthValidator);
ctrl.$formatters.push(maxLengthValidator);
}
}
function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
textInputType(scope, element, attr, ctrl, $sniffer, $browser);
ctrl.$parsers.push(function(value) {
var empty = isEmpty(value);
if (empty || NUMBER_REGEXP.test(value)) {
ctrl.$setValidity('number', true);
return value === '' ? null : (empty ? value : parseFloat(value));
} else {
ctrl.$setValidity('number', false);
return undefined;
}
});
ctrl.$formatters.push(function(value) {
return isEmpty(value) ? '' : '' + value;
});
if (attr.min) {
var min = parseFloat(attr.min);
var minValidator = function(value) {
if (!isEmpty(value) && value < min) {
ctrl.$setValidity('min', false);
return undefined;
} else {
ctrl.$setValidity('min', true);
return value;
}
};
ctrl.$parsers.push(minValidator);
ctrl.$formatters.push(minValidator);
}
if (attr.max) {
var max = parseFloat(attr.max);
var maxValidator = function(value) {
if (!isEmpty(value) && value > max) {
ctrl.$setValidity('max', false);
return undefined;
} else {
ctrl.$setValidity('max', true);
return value;
}
};
ctrl.$parsers.push(maxValidator);
ctrl.$formatters.push(maxValidator);
}
ctrl.$formatters.push(function(value) {
if (isEmpty(value) || isNumber(value)) {
ctrl.$setValidity('number', true);
return value;
} else {
ctrl.$setValidity('number', false);
return undefined;
}
});
}
function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
textInputType(scope, element, attr, ctrl, $sniffer, $browser);
var urlValidator = function(value) {
if (isEmpty(value) || URL_REGEXP.test(value)) {
ctrl.$setValidity('url', true);
return value;
} else {
ctrl.$setValidity('url', false);
return undefined;
}
};
ctrl.$formatters.push(urlValidator);
ctrl.$parsers.push(urlValidator);
}
function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
textInputType(scope, element, attr, ctrl, $sniffer, $browser);
var emailValidator = function(value) {
if (isEmpty(value) || EMAIL_REGEXP.test(value)) {
ctrl.$setValidity('email', true);
return value;
} else {
ctrl.$setValidity('email', false);
return undefined;
}
};
ctrl.$formatters.push(emailValidator);
ctrl.$parsers.push(emailValidator);
}
function radioInputType(scope, element, attr, ctrl) {
// make the name unique, if not defined
if (isUndefined(attr.name)) {
element.attr('name', nextUid());
}
element.bind('click', function() {
if (element[0].checked) {
scope.$apply(function() {
ctrl.$setViewValue(attr.value);
});
}
});
ctrl.$render = function() {
var value = attr.value;
element[0].checked = (value == ctrl.$viewValue);
};
attr.$observe('value', ctrl.$render);
}
function checkboxInputType(scope, element, attr, ctrl) {
var trueValue = attr.ngTrueValue,
falseValue = attr.ngFalseValue;
if (!isString(trueValue)) trueValue = true;
if (!isString(falseValue)) falseValue = false;
element.bind('click', function() {
scope.$apply(function() {
ctrl.$setViewValue(element[0].checked);
});
});
ctrl.$render = function() {
element[0].checked = ctrl.$viewValue;
};
ctrl.$formatters.push(function(value) {
return value === trueValue;
});
ctrl.$parsers.push(function(value) {
return value ? trueValue : falseValue;
});
}
/**
* @ngdoc directive
* @name ng.directive:textarea
* @restrict E
*
* @description
* HTML textarea element control with angular data-binding. The data-binding and validation
* properties of this element are exactly the same as those of the
* {@link ng.directive:input input element}.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*/
/**
* @ngdoc directive
* @name ng.directive:input
* @restrict E
*
* @description
* HTML input element control with angular data-binding. Input control follows HTML5 input types
* and polyfills the HTML5 validation behavior for older browsers.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {boolean=} ngRequired Sets `required` attribute if set to true
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.user = {name: 'guest', last: 'visitor'};
}
</script>
<div ng-controller="Ctrl">
<form name="myForm">
User name: <input type="text" name="userName" ng-model="user.name" required>
<span class="error" ng-show="myForm.userName.$error.required">
Required!</span><br>
Last name: <input type="text" name="lastName" ng-model="user.last"
ng-minlength="3" ng-maxlength="10">
<span class="error" ng-show="myForm.lastName.$error.minlength">
Too short!</span>
<span class="error" ng-show="myForm.lastName.$error.maxlength">
Too long!</span><br>
</form>
<hr>
<tt>user = {{user}}</tt><br/>
<tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br>
<tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br>
<tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br>
<tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
<tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br>
<tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br>
</div>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('user')).toEqual('{"name":"guest","last":"visitor"}');
expect(binding('myForm.userName.$valid')).toEqual('true');
expect(binding('myForm.$valid')).toEqual('true');
});
it('should be invalid if empty when required', function() {
input('user.name').enter('');
expect(binding('user')).toEqual('{"last":"visitor"}');
expect(binding('myForm.userName.$valid')).toEqual('false');
expect(binding('myForm.$valid')).toEqual('false');
});
it('should be valid if empty when min length is set', function() {
input('user.last').enter('');
expect(binding('user')).toEqual('{"name":"guest","last":""}');
expect(binding('myForm.lastName.$valid')).toEqual('true');
expect(binding('myForm.$valid')).toEqual('true');
});
it('should be invalid if less than required min length', function() {
input('user.last').enter('xx');
expect(binding('user')).toEqual('{"name":"guest"}');
expect(binding('myForm.lastName.$valid')).toEqual('false');
expect(binding('myForm.lastName.$error')).toMatch(/minlength/);
expect(binding('myForm.$valid')).toEqual('false');
});
it('should be invalid if longer than max length', function() {
input('user.last').enter('some ridiculously long name');
expect(binding('user'))
.toEqual('{"name":"guest"}');
expect(binding('myForm.lastName.$valid')).toEqual('false');
expect(binding('myForm.lastName.$error')).toMatch(/maxlength/);
expect(binding('myForm.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
var inputDirective = ['$browser', '$sniffer', function($browser, $sniffer) {
return {
restrict: 'E',
require: '?ngModel',
link: function(scope, element, attr, ctrl) {
if (ctrl) {
(inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrl, $sniffer,
$browser);
}
}
};
}];
var VALID_CLASS = 'ng-valid',
INVALID_CLASS = 'ng-invalid',
PRISTINE_CLASS = 'ng-pristine',
DIRTY_CLASS = 'ng-dirty';
/**
* @ngdoc object
* @name ng.directive:ngModel.NgModelController
*
* @property {string} $viewValue Actual string value in the view.
* @property {*} $modelValue The value in the model, that the control is bound to.
* @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
the control reads value from the DOM. Each function is called, in turn, passing the value
through to the next. Used to sanitize / convert the value as well as validation.
For validation, the parsers should update the validity state using
{@link ng.directive:ngModel.NgModelController#$setValidity $setValidity()},
and return `undefined` for invalid values.
*
* @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
* the model value changes. Each function is called, in turn, passing the value through to the
* next. Used to format / convert values for display in the control and validation.
* <pre>
* function formatter(value) {
* if (value) {
* return value.toUpperCase();
* }
* }
* ngModel.$formatters.push(formatter);
* </pre>
* @property {Object} $error An bject hash with all errors as keys.
*
* @property {boolean} $pristine True if user has not interacted with the control yet.
* @property {boolean} $dirty True if user has already interacted with the control.
* @property {boolean} $valid True if there is no error.
* @property {boolean} $invalid True if at least one error on the control.
*
* @description
*
* `NgModelController` provides API for the `ng-model` directive. The controller contains
* services for data-binding, validation, CSS update, value formatting and parsing. It
* specifically does not contain any logic which deals with DOM rendering or listening to
* DOM events. The `NgModelController` is meant to be extended by other directives where, the
* directive provides DOM manipulation and the `NgModelController` provides the data-binding.
* Note that you cannot use `NgModelController` in a directive with an isolated scope,
* as, in that case, the `ng-model` value gets put into the isolated scope and does not get
* propogated to the parent scope.
*
*
* This example shows how to use `NgModelController` with a custom control to achieve
* data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)
* collaborate together to achieve the desired result.
*
* <example module="customControl">
<file name="style.css">
[contenteditable] {
border: 1px solid black;
background-color: white;
min-height: 20px;
}
.ng-invalid {
border: 1px solid red;
}
</file>
<file name="script.js">
angular.module('customControl', []).
directive('contenteditable', function() {
return {
restrict: 'A', // only activate on element attribute
require: '?ngModel', // get a hold of NgModelController
link: function(scope, element, attrs, ngModel) {
if(!ngModel) return; // do nothing if no ng-model
// Specify how UI should be updated
ngModel.$render = function() {
element.html(ngModel.$viewValue || '');
};
// Listen for change events to enable binding
element.bind('blur keyup change', function() {
scope.$apply(read);
});
read(); // initialize
// Write data to the model
function read() {
var html = element.html();
// When we clear the content editable the browser leaves a <br> behind
// If strip-br attribute is provided then we strip this out
if( attrs.stripBr && html == '<br>' ) {
html = '';
}
ngModel.$setViewValue(html);
}
}
};
});
</file>
<file name="index.html">
<form name="myForm">
<div contenteditable
name="myWidget" ng-model="userContent"
strip-br="true"
required>Change me!</div>
<span ng-show="myForm.myWidget.$error.required">Required!</span>
<hr>
<textarea ng-model="userContent"></textarea>
</form>
</file>
<file name="scenario.js">
it('should data-bind and become invalid', function() {
var contentEditable = element('[contenteditable]');
expect(contentEditable.text()).toEqual('Change me!');
input('userContent').enter('');
expect(contentEditable.text()).toEqual('');
expect(contentEditable.prop('className')).toMatch(/ng-invalid-required/);
});
</file>
* </example>
*
*/
var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse',
function($scope, $exceptionHandler, $attr, $element, $parse) {
this.$viewValue = Number.NaN;
this.$modelValue = Number.NaN;
this.$parsers = [];
this.$formatters = [];
this.$viewChangeListeners = [];
this.$pristine = true;
this.$dirty = false;
this.$valid = true;
this.$invalid = false;
this.$name = $attr.name;
var ngModelGet = $parse($attr.ngModel),
ngModelSet = ngModelGet.assign;
if (!ngModelSet) {
throw Error(NON_ASSIGNABLE_MODEL_EXPRESSION + $attr.ngModel +
' (' + startingTag($element) + ')');
}
/**
* @ngdoc function
* @name ng.directive:ngModel.NgModelController#$render
* @methodOf ng.directive:ngModel.NgModelController
*
* @description
* Called when the view needs to be updated. It is expected that the user of the ng-model
* directive will implement this method.
*/
this.$render = noop;
var parentForm = $element.inheritedData('$formController') || nullFormCtrl,
invalidCount = 0, // used to easily determine if we are valid
$error = this.$error = {}; // keep invalid keys here
// Setup initial state of the control
$element.addClass(PRISTINE_CLASS);
toggleValidCss(true);
// convenience method for easy toggling of classes
function toggleValidCss(isValid, validationErrorKey) {
validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
$element.
removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey).
addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);
}
/**
* @ngdoc function
* @name ng.directive:ngModel.NgModelController#$setValidity
* @methodOf ng.directive:ngModel.NgModelController
*
* @description
* Change the validity state, and notifies the form when the control changes validity. (i.e. it
* does not notify form if given validator is already marked as invalid).
*
* This method should be called by validators - i.e. the parser or formatter functions.
*
* @param {string} validationErrorKey Name of the validator. the `validationErrorKey` will assign
* to `$error[validationErrorKey]=isValid` so that it is available for data-binding.
* The `validationErrorKey` should be in camelCase and will get converted into dash-case
* for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
* class and can be bound to as `{{someForm.someControl.$error.myError}}` .
* @param {boolean} isValid Whether the current state is valid (true) or invalid (false).
*/
this.$setValidity = function(validationErrorKey, isValid) {
if ($error[validationErrorKey] === !isValid) return;
if (isValid) {
if ($error[validationErrorKey]) invalidCount--;
if (!invalidCount) {
toggleValidCss(true);
this.$valid = true;
this.$invalid = false;
}
} else {
toggleValidCss(false);
this.$invalid = true;
this.$valid = false;
invalidCount++;
}
$error[validationErrorKey] = !isValid;
toggleValidCss(isValid, validationErrorKey);
parentForm.$setValidity(validationErrorKey, isValid, this);
};
/**
* @ngdoc function
* @name ng.directive:ngModel.NgModelController#$setViewValue
* @methodOf ng.directive:ngModel.NgModelController
*
* @description
* Read a value from view.
*
* This method should be called from within a DOM event handler.
* For example {@link ng.directive:input input} or
* {@link ng.directive:select select} directives call it.
*
* It internally calls all `$parsers` (including validators) and updates the `$modelValue` and the actual model path.
* Lastly it calls all registered change listeners.
*
* @param {string} value Value from the view.
*/
this.$setViewValue = function(value) {
this.$viewValue = value;
// change to dirty
if (this.$pristine) {
this.$dirty = true;
this.$pristine = false;
$element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
parentForm.$setDirty();
}
forEach(this.$parsers, function(fn) {
value = fn(value);
});
if (this.$modelValue !== value) {
this.$modelValue = value;
ngModelSet($scope, value);
forEach(this.$viewChangeListeners, function(listener) {
try {
listener();
} catch(e) {
$exceptionHandler(e);
}
})
}
};
// model -> value
var ctrl = this;
$scope.$watch(function ngModelWatch() {
var value = ngModelGet($scope);
// if scope model value and ngModel value are out of sync
if (ctrl.$modelValue !== value) {
var formatters = ctrl.$formatters,
idx = formatters.length;
ctrl.$modelValue = value;
while(idx--) {
value = formatters[idx](value);
}
if (ctrl.$viewValue !== value) {
ctrl.$viewValue = value;
ctrl.$render();
}
}
});
}];
/**
* @ngdoc directive
* @name ng.directive:ngModel
*
* @element input
*
* @description
* Is a directive that tells Angular to do two-way data binding. It works together with `input`,
* `select`, `textarea`. You can easily write your own directives to use `ngModel` as well.
*
* `ngModel` is responsible for:
*
* - binding the view into the model, which other directives such as `input`, `textarea` or `select`
* require,
* - providing validation behavior (i.e. required, number, email, url),
* - keeping state of the control (valid/invalid, dirty/pristine, validation errors),
* - setting related css class onto the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`),
* - register the control with parent {@link ng.directive:form form}.
*
* Note: `ngModel` will try to bind to the property given by evaluating the expression on the
* current scope. If the property doesn't already exist on this scope, it will be created
* implicitly and added to the scope.
*
* For basic examples, how to use `ngModel`, see:
*
* - {@link ng.directive:input input}
* - {@link ng.directive:input.text text}
* - {@link ng.directive:input.checkbox checkbox}
* - {@link ng.directive:input.radio radio}
* - {@link ng.directive:input.number number}
* - {@link ng.directive:input.email email}
* - {@link ng.directive:input.url url}
* - {@link ng.directive:select select}
* - {@link ng.directive:textarea textarea}
*
*/
var ngModelDirective = function() {
return {
require: ['ngModel', '^?form'],
controller: NgModelController,
link: function(scope, element, attr, ctrls) {
// notify others, especially parent forms
var modelCtrl = ctrls[0],
formCtrl = ctrls[1] || nullFormCtrl;
formCtrl.$addControl(modelCtrl);
element.bind('$destroy', function() {
formCtrl.$removeControl(modelCtrl);
});
}
};
};
/**
* @ngdoc directive
* @name ng.directive:ngChange
* @restrict E
*
* @description
* Evaluate given expression when user changes the input.
* The expression is not evaluated when the value change is coming from the model.
*
* Note, this directive requires `ngModel` to be present.
*
* @element input
*
* @example
* <doc:example>
* <doc:source>
* <script>
* function Controller($scope) {
* $scope.counter = 0;
* $scope.change = function() {
* $scope.counter++;
* };
* }
* </script>
* <div ng-controller="Controller">
* <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
* <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
* <label for="ng-change-example2">Confirmed</label><br />
* debug = {{confirmed}}<br />
* counter = {{counter}}
* </div>
* </doc:source>
* <doc:scenario>
* it('should evaluate the expression if changing from view', function() {
* expect(binding('counter')).toEqual('0');
* element('#ng-change-example1').click();
* expect(binding('counter')).toEqual('1');
* expect(binding('confirmed')).toEqual('true');
* });
*
* it('should not evaluate the expression if changing from model', function() {
* element('#ng-change-example2').click();
* expect(binding('counter')).toEqual('0');
* expect(binding('confirmed')).toEqual('true');
* });
* </doc:scenario>
* </doc:example>
*/
var ngChangeDirective = valueFn({
require: 'ngModel',
link: function(scope, element, attr, ctrl) {
ctrl.$viewChangeListeners.push(function() {
scope.$eval(attr.ngChange);
});
}
});
var requiredDirective = function() {
return {
require: '?ngModel',
link: function(scope, elm, attr, ctrl) {
if (!ctrl) return;
attr.required = true; // force truthy in case we are on non input element
var validator = function(value) {
if (attr.required && (isEmpty(value) || value === false)) {
ctrl.$setValidity('required', false);
return;
} else {
ctrl.$setValidity('required', true);
return value;
}
};
ctrl.$formatters.push(validator);
ctrl.$parsers.unshift(validator);
attr.$observe('required', function() {
validator(ctrl.$viewValue);
});
}
};
};
/**
* @ngdoc directive
* @name ng.directive:ngList
*
* @description
* Text input that converts between comma-separated string into an array of strings.
*
* @element input
* @param {string=} ngList optional delimiter that should be used to split the value. If
* specified in form `/something/` then the value will be converted into a regular expression.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.names = ['igor', 'misko', 'vojta'];
}
</script>
<form name="myForm" ng-controller="Ctrl">
List: <input name="namesInput" ng-model="names" ng-list required>
<span class="error" ng-show="myForm.namesInput.$error.required">
Required!</span>
<br>
<tt>names = {{names}}</tt><br/>
<tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>
<tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('names')).toEqual('["igor","misko","vojta"]');
expect(binding('myForm.namesInput.$valid')).toEqual('true');
expect(element('span.error').css('display')).toBe('none');
});
it('should be invalid if empty', function() {
input('names').enter('');
expect(binding('names')).toEqual('[]');
expect(binding('myForm.namesInput.$valid')).toEqual('false');
expect(element('span.error').css('display')).not().toBe('none');
});
</doc:scenario>
</doc:example>
*/
var ngListDirective = function() {
return {
require: 'ngModel',
link: function(scope, element, attr, ctrl) {
var match = /\/(.*)\//.exec(attr.ngList),
separator = match && new RegExp(match[1]) || attr.ngList || ',';
var parse = function(viewValue) {
var list = [];
if (viewValue) {
forEach(viewValue.split(separator), function(value) {
if (value) list.push(trim(value));
});
}
return list;
};
ctrl.$parsers.push(parse);
ctrl.$formatters.push(function(value) {
if (isArray(value)) {
return value.join(', ');
}
return undefined;
});
}
};
};
var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
var ngValueDirective = function() {
return {
priority: 100,
compile: function(tpl, tplAttr) {
if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
return function(scope, elm, attr) {
attr.$set('value', scope.$eval(attr.ngValue));
};
} else {
return function(scope, elm, attr) {
scope.$watch(attr.ngValue, function valueWatchAction(value) {
attr.$set('value', value);
});
};
}
}
};
};
/**
* @ngdoc directive
* @name ng.directive:ngBind
*
* @description
* The `ngBind` attribute tells Angular to replace the text content of the specified HTML element
* with the value of a given expression, and to update the text content when the value of that
* expression changes.
*
* Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
* `{{ expression }}` which is similar but less verbose.
*
* It is preferrable to use `ngBind` instead of `{{ expression }}` when a template is momentarily
* displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an
* element attribute, it makes the bindings invisible to the user while the page is loading.
*
* An alternative solution to this problem would be using the
* {@link ng.directive:ngCloak ngCloak} directive.
*
*
* @element ANY
* @param {expression} ngBind {@link guide/expression Expression} to evaluate.
*
* @example
* Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.name = 'Whirled';
}
</script>
<div ng-controller="Ctrl">
Enter name: <input type="text" ng-model="name"><br>
Hello <span ng-bind="name"></span>!
</div>
</doc:source>
<doc:scenario>
it('should check ng-bind', function() {
expect(using('.doc-example-live').binding('name')).toBe('Whirled');
using('.doc-example-live').input('name').enter('world');
expect(using('.doc-example-live').binding('name')).toBe('world');
});
</doc:scenario>
</doc:example>
*/
var ngBindDirective = ngDirective(function(scope, element, attr) {
element.addClass('ng-binding').data('$binding', attr.ngBind);
scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
element.text(value == undefined ? '' : value);
});
});
/**
* @ngdoc directive
* @name ng.directive:ngBindTemplate
*
* @description
* The `ngBindTemplate` directive specifies that the element
* text content should be replaced with the interpolation of the template
* in the `ngBindTemplate` attribute.
* Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`
* expressions. This directive is needed since some HTML elements
* (such as TITLE and OPTION) cannot contain SPAN elements.
*
* @element ANY
* @param {string} ngBindTemplate template of form
* <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.
*
* @example
* Try it here: enter text in text box and watch the greeting change.
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.salutation = 'Hello';
$scope.name = 'World';
}
</script>
<div ng-controller="Ctrl">
Salutation: <input type="text" ng-model="salutation"><br>
Name: <input type="text" ng-model="name"><br>
<pre ng-bind-template="{{salutation}} {{name}}!"></pre>
</div>
</doc:source>
<doc:scenario>
it('should check ng-bind', function() {
expect(using('.doc-example-live').binding('salutation')).
toBe('Hello');
expect(using('.doc-example-live').binding('name')).
toBe('World');
using('.doc-example-live').input('salutation').enter('Greetings');
using('.doc-example-live').input('name').enter('user');
expect(using('.doc-example-live').binding('salutation')).
toBe('Greetings');
expect(using('.doc-example-live').binding('name')).
toBe('user');
});
</doc:scenario>
</doc:example>
*/
var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
return function(scope, element, attr) {
// TODO: move this to scenario runner
var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
element.addClass('ng-binding').data('$binding', interpolateFn);
attr.$observe('ngBindTemplate', function(value) {
element.text(value);
});
}
}];
/**
* @ngdoc directive
* @name ng.directive:ngBindHtmlUnsafe
*
* @description
* Creates a binding that will innerHTML the result of evaluating the `expression` into the current
* element. *The innerHTML-ed content will not be sanitized!* You should use this directive only if
* {@link ngSanitize.directive:ngBindHtml ngBindHtml} directive is too
* restrictive and when you absolutely trust the source of the content you are binding to.
*
* See {@link ngSanitize.$sanitize $sanitize} docs for examples.
*
* @element ANY
* @param {expression} ngBindHtmlUnsafe {@link guide/expression Expression} to evaluate.
*/
var ngBindHtmlUnsafeDirective = [function() {
return function(scope, element, attr) {
element.addClass('ng-binding').data('$binding', attr.ngBindHtmlUnsafe);
scope.$watch(attr.ngBindHtmlUnsafe, function ngBindHtmlUnsafeWatchAction(value) {
element.html(value || '');
});
};
}];
function classDirective(name, selector) {
name = 'ngClass' + name;
return ngDirective(function(scope, element, attr) {
var oldVal = undefined;
scope.$watch(attr[name], ngClassWatchAction, true);
attr.$observe('class', function(value) {
var ngClass = scope.$eval(attr[name]);
ngClassWatchAction(ngClass, ngClass);
});
if (name !== 'ngClass') {
scope.$watch('$index', function($index, old$index) {
var mod = $index & 1;
if (mod !== old$index & 1) {
if (mod === selector) {
addClass(scope.$eval(attr[name]));
} else {
removeClass(scope.$eval(attr[name]));
}
}
});
}
function ngClassWatchAction(newVal) {
if (selector === true || scope.$index % 2 === selector) {
if (oldVal && !equals(newVal,oldVal)) {
removeClass(oldVal);
}
addClass(newVal);
}
oldVal = copy(newVal);
}
function removeClass(classVal) {
if (isObject(classVal) && !isArray(classVal)) {
classVal = map(classVal, function(v, k) { if (v) return k });
}
element.removeClass(isArray(classVal) ? classVal.join(' ') : classVal);
}
function addClass(classVal) {
if (isObject(classVal) && !isArray(classVal)) {
classVal = map(classVal, function(v, k) { if (v) return k });
}
if (classVal) {
element.addClass(isArray(classVal) ? classVal.join(' ') : classVal);
}
}
});
}
/**
* @ngdoc directive
* @name ng.directive:ngClass
*
* @description
* The `ngClass` allows you to set CSS classes on HTML an element, dynamically, by databinding
* an expression that represents all classes to be added.
*
* The directive won't add duplicate classes if a particular class was already set.
*
* When the expression changes, the previously added classes are removed and only then the
* new classes are added.
*
* @element ANY
* @param {expression} ngClass {@link guide/expression Expression} to eval. The result
* of the evaluation can be a string representing space delimited class
* names, an array, or a map of class names to boolean values. In the case of a map, the
* names of the properties whose values are truthy will be added as css classes to the
* element.
*
* @example
<example>
<file name="index.html">
<input type="button" value="set" ng-click="myVar='my-class'">
<input type="button" value="clear" ng-click="myVar=''">
<br>
<span ng-class="myVar">Sample Text</span>
</file>
<file name="style.css">
.my-class {
color: red;
}
</file>
<file name="scenario.js">
it('should check ng-class', function() {
expect(element('.doc-example-live span').prop('className')).not().
toMatch(/my-class/);
using('.doc-example-live').element(':button:first').click();
expect(element('.doc-example-live span').prop('className')).
toMatch(/my-class/);
using('.doc-example-live').element(':button:last').click();
expect(element('.doc-example-live span').prop('className')).not().
toMatch(/my-class/);
});
</file>
</example>
*/
var ngClassDirective = classDirective('', true);
/**
* @ngdoc directive
* @name ng.directive:ngClassOdd
*
* @description
* The `ngClassOdd` and `ngClassEven` directives work exactly as
* {@link ng.directive:ngClass ngClass}, except it works in
* conjunction with `ngRepeat` and takes affect only on odd (even) rows.
*
* This directive can be applied only within a scope of an
* {@link ng.directive:ngRepeat ngRepeat}.
*
* @element ANY
* @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result
* of the evaluation can be a string representing space delimited class names or an array.
*
* @example
<example>
<file name="index.html">
<ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
<li ng-repeat="name in names">
<span ng-class-odd="'odd'" ng-class-even="'even'">
{{name}}
</span>
</li>
</ol>
</file>
<file name="style.css">
.odd {
color: red;
}
.even {
color: blue;
}
</file>
<file name="scenario.js">
it('should check ng-class-odd and ng-class-even', function() {
expect(element('.doc-example-live li:first span').prop('className')).
toMatch(/odd/);
expect(element('.doc-example-live li:last span').prop('className')).
toMatch(/even/);
});
</file>
</example>
*/
var ngClassOddDirective = classDirective('Odd', 0);
/**
* @ngdoc directive
* @name ng.directive:ngClassEven
*
* @description
* The `ngClassOdd` and `ngClassEven` directives work exactly as
* {@link ng.directive:ngClass ngClass}, except it works in
* conjunction with `ngRepeat` and takes affect only on odd (even) rows.
*
* This directive can be applied only within a scope of an
* {@link ng.directive:ngRepeat ngRepeat}.
*
* @element ANY
* @param {expression} ngClassEven {@link guide/expression Expression} to eval. The
* result of the evaluation can be a string representing space delimited class names or an array.
*
* @example
<example>
<file name="index.html">
<ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
<li ng-repeat="name in names">
<span ng-class-odd="'odd'" ng-class-even="'even'">
{{name}}
</span>
</li>
</ol>
</file>
<file name="style.css">
.odd {
color: red;
}
.even {
color: blue;
}
</file>
<file name="scenario.js">
it('should check ng-class-odd and ng-class-even', function() {
expect(element('.doc-example-live li:first span').prop('className')).
toMatch(/odd/);
expect(element('.doc-example-live li:last span').prop('className')).
toMatch(/even/);
});
</file>
</example>
*/
var ngClassEvenDirective = classDirective('Even', 1);
/**
* @ngdoc directive
* @name ng.directive:ngCloak
*
* @description
* The `ngCloak` directive is used to prevent the Angular html template from being briefly
* displayed by the browser in its raw (uncompiled) form while your application is loading. Use this
* directive to avoid the undesirable flicker effect caused by the html template display.
*
* The directive can be applied to the `<body>` element, but typically a fine-grained application is
* prefered in order to benefit from progressive rendering of the browser view.
*
* `ngCloak` works in cooperation with a css rule that is embedded within `angular.js` and
* `angular.min.js` files. Following is the css rule:
*
* <pre>
* [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
* display: none !important;
* }
* </pre>
*
* When this css rule is loaded by the browser, all html elements (including their children) that
* are tagged with the `ng-cloak` directive are hidden. When Angular comes across this directive
* during the compilation of the template it deletes the `ngCloak` element attribute, which
* makes the compiled element visible.
*
* For the best result, `angular.js` script must be loaded in the head section of the html file;
* alternatively, the css rule (above) must be included in the external stylesheet of the
* application.
*
* Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they
* cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css
* class `ngCloak` in addition to `ngCloak` directive as shown in the example below.
*
* @element ANY
*
* @example
<doc:example>
<doc:source>
<div id="template1" ng-cloak>{{ 'hello' }}</div>
<div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>
</doc:source>
<doc:scenario>
it('should remove the template directive and css class', function() {
expect(element('.doc-example-live #template1').attr('ng-cloak')).
not().toBeDefined();
expect(element('.doc-example-live #template2').attr('ng-cloak')).
not().toBeDefined();
});
</doc:scenario>
</doc:example>
*
*/
var ngCloakDirective = ngDirective({
compile: function(element, attr) {
attr.$set('ngCloak', undefined);
element.removeClass('ng-cloak');
}
});
/**
* @ngdoc directive
* @name ng.directive:ngController
*
* @description
* The `ngController` directive assigns behavior to a scope. This is a key aspect of how angular
* supports the principles behind the Model-View-Controller design pattern.
*
* MVC components in angular:
*
* * Model — The Model is data in scope properties; scopes are attached to the DOM.
* * View — The template (HTML with data bindings) is rendered into the View.
* * Controller — The `ngController` directive specifies a Controller class; the class has
* methods that typically express the business logic behind the application.
*
* Note that an alternative way to define controllers is via the {@link ng.$route $route} service.
*
* @element ANY
* @scope
* @param {expression} ngController Name of a globally accessible constructor function or an
* {@link guide/expression expression} that on the current scope evaluates to a
* constructor function.
*
* @example
* Here is a simple form for editing user contact information. Adding, removing, clearing, and
* greeting are methods declared on the $scope by the controller (see source tab). These methods can
* easily be called from the angular markup. Notice that any changes to the data are automatically
* reflected in the View without the need for a manual update.
<doc:example>
<doc:source>
<script>
function SettingsController($scope) {
$scope.name = "John Smith";
$scope.contacts = [
{type:'phone', value:'408 555 1212'},
{type:'email', value:'john.smith@example.org'} ];
$scope.greet = function() {
alert(this.name);
};
$scope.addContact = function() {
this.contacts.push({type:'email', value:'yourname@example.org'});
};
$scope.removeContact = function(contactToRemove) {
var index = this.contacts.indexOf(contactToRemove);
this.contacts.splice(index, 1);
};
$scope.clearContact = function(contact) {
contact.type = 'phone';
contact.value = '';
};
}
</script>
<div ng-controller="SettingsController">
Name: <input type="text" ng-model="name"/>
[ <a href="" ng-click="greet()">greet</a> ]<br/>
Contact:
<ul>
<li ng-repeat="contact in contacts">
<select ng-model="contact.type">
<option>phone</option>
<option>email</option>
</select>
<input type="text" ng-model="contact.value"/>
[ <a href="" ng-click="clearContact(contact)">clear</a>
| <a href="" ng-click="removeContact(contact)">X</a> ]
</li>
<li>[ <a href="" ng-click="addContact()">add</a> ]</li>
</ul>
</div>
</doc:source>
<doc:scenario>
it('should check controller', function() {
expect(element('.doc-example-live div>:input').val()).toBe('John Smith');
expect(element('.doc-example-live li:nth-child(1) input').val())
.toBe('408 555 1212');
expect(element('.doc-example-live li:nth-child(2) input').val())
.toBe('john.smith@example.org');
element('.doc-example-live li:first a:contains("clear")').click();
expect(element('.doc-example-live li:first input').val()).toBe('');
element('.doc-example-live li:last a:contains("add")').click();
expect(element('.doc-example-live li:nth-child(3) input').val())
.toBe('yourname@example.org');
});
</doc:scenario>
</doc:example>
*/
var ngControllerDirective = [function() {
return {
scope: true,
controller: '@'
};
}];
/**
* @ngdoc directive
* @name ng.directive:ngCsp
* @priority 1000
*
* @element html
* @description
* Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support.
*
* This is necessary when developing things like Google Chrome Extensions.
*
* CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things).
* For us to be compatible, we just need to implement the "getterFn" in $parse without violating
* any of these restrictions.
*
* AngularJS uses `Function(string)` generated functions as a speed optimization. By applying `ngCsp`
* it is be possible to opt into the CSP compatible mode. When this mode is on AngularJS will
* evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will
* be raised.
*
* In order to use this feature put `ngCsp` directive on the root element of the application.
*
* @example
* This example shows how to apply the `ngCsp` directive to the `html` tag.
<pre>
<!doctype html>
<html ng-app ng-csp>
...
...
</html>
</pre>
*/
var ngCspDirective = ['$sniffer', function($sniffer) {
return {
priority: 1000,
compile: function() {
$sniffer.csp = true;
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:ngClick
*
* @description
* The ngClick allows you to specify custom behavior when
* element is clicked.
*
* @element ANY
* @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
* click. (Event object is available as `$event`)
*
* @example
<doc:example>
<doc:source>
<button ng-click="count = count + 1" ng-init="count=0">
Increment
</button>
count: {{count}}
</doc:source>
<doc:scenario>
it('should check ng-click', function() {
expect(binding('count')).toBe('0');
element('.doc-example-live :button').click();
expect(binding('count')).toBe('1');
});
</doc:scenario>
</doc:example>
*/
/*
* A directive that allows creation of custom onclick handlers that are defined as angular
* expressions and are compiled and executed within the current scope.
*
* Events that are handled via these handler are always configured not to propagate further.
*/
var ngEventDirectives = {};
forEach(
'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave submit'.split(' '),
function(name) {
var directiveName = directiveNormalize('ng-' + name);
ngEventDirectives[directiveName] = ['$parse', function($parse) {
return function(scope, element, attr) {
var fn = $parse(attr[directiveName]);
element.bind(lowercase(name), function(event) {
scope.$apply(function() {
fn(scope, {$event:event});
});
});
};
}];
}
);
/**
* @ngdoc directive
* @name ng.directive:ngDblclick
*
* @description
* The `ngDblclick` directive allows you to specify custom behavior on dblclick event.
*
* @element ANY
* @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon
* dblclick. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMousedown
*
* @description
* The ngMousedown directive allows you to specify custom behavior on mousedown event.
*
* @element ANY
* @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
* mousedown. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMouseup
*
* @description
* Specify custom behavior on mouseup event.
*
* @element ANY
* @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
* mouseup. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMouseover
*
* @description
* Specify custom behavior on mouseover event.
*
* @element ANY
* @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
* mouseover. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMouseenter
*
* @description
* Specify custom behavior on mouseenter event.
*
* @element ANY
* @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
* mouseenter. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMouseleave
*
* @description
* Specify custom behavior on mouseleave event.
*
* @element ANY
* @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
* mouseleave. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMousemove
*
* @description
* Specify custom behavior on mousemove event.
*
* @element ANY
* @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
* mousemove. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngKeydown
*
* @description
* Specify custom behavior on keydown event.
*
* @element ANY
* @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon
* keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngKeyup
*
* @description
* Specify custom behavior on keyup event.
*
* @element ANY
* @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon
* keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngKeypress
*
* @description
* Specify custom behavior on keypress event.
*
* @element ANY
* @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
* keypress. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngSubmit
*
* @description
* Enables binding angular expressions to onsubmit events.
*
* Additionally it prevents the default action (which for form means sending the request to the
* server and reloading the current page) **but only if the form does not contain an `action`
* attribute**.
*
* @element form
* @param {expression} ngSubmit {@link guide/expression Expression} to eval. (Event object is available as `$event`)
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.list = [];
$scope.text = 'hello';
$scope.submit = function() {
if (this.text) {
this.list.push(this.text);
this.text = '';
}
};
}
</script>
<form ng-submit="submit()" ng-controller="Ctrl">
Enter text and hit enter:
<input type="text" ng-model="text" name="text" />
<input type="submit" id="submit" value="Submit" />
<pre>list={{list}}</pre>
</form>
</doc:source>
<doc:scenario>
it('should check ng-submit', function() {
expect(binding('list')).toBe('[]');
element('.doc-example-live #submit').click();
expect(binding('list')).toBe('["hello"]');
expect(input('text').val()).toBe('');
});
it('should ignore empty strings', function() {
expect(binding('list')).toBe('[]');
element('.doc-example-live #submit').click();
element('.doc-example-live #submit').click();
expect(binding('list')).toBe('["hello"]');
});
</doc:scenario>
</doc:example>
*/
/**
* @ngdoc directive
* @name ng.directive:ngInclude
* @restrict ECA
*
* @description
* Fetches, compiles and includes an external HTML fragment.
*
* Keep in mind that Same Origin Policy applies to included resources
* (e.g. ngInclude won't work for cross-domain requests on all browsers and for
* file:// access on some browsers).
*
* @scope
*
* @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,
* make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`.
* @param {string=} onload Expression to evaluate when a new partial is loaded.
*
* @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll
* $anchorScroll} to scroll the viewport after the content is loaded.
*
* - If the attribute is not set, disable scrolling.
* - If the attribute is set without value, enable scrolling.
* - Otherwise enable scrolling only if the expression evaluates to truthy value.
*
* @example
<example>
<file name="index.html">
<div ng-controller="Ctrl">
<select ng-model="template" ng-options="t.name for t in templates">
<option value="">(blank)</option>
</select>
url of the template: <tt>{{template.url}}</tt>
<hr/>
<div ng-include src="template.url"></div>
</div>
</file>
<file name="script.js">
function Ctrl($scope) {
$scope.templates =
[ { name: 'template1.html', url: 'template1.html'}
, { name: 'template2.html', url: 'template2.html'} ];
$scope.template = $scope.templates[0];
}
</file>
<file name="template1.html">
Content of template1.html
</file>
<file name="template2.html">
Content of template2.html
</file>
<file name="scenario.js">
it('should load template1.html', function() {
expect(element('.doc-example-live [ng-include]').text()).
toMatch(/Content of template1.html/);
});
it('should load template2.html', function() {
select('template').option('1');
expect(element('.doc-example-live [ng-include]').text()).
toMatch(/Content of template2.html/);
});
it('should change to blank', function() {
select('template').option('');
expect(element('.doc-example-live [ng-include]').text()).toEqual('');
});
</file>
</example>
*/
/**
* @ngdoc event
* @name ng.directive:ngInclude#$includeContentLoaded
* @eventOf ng.directive:ngInclude
* @eventType emit on the current ngInclude scope
* @description
* Emitted every time the ngInclude content is reloaded.
*/
var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile',
function($http, $templateCache, $anchorScroll, $compile) {
return {
restrict: 'ECA',
terminal: true,
compile: function(element, attr) {
var srcExp = attr.ngInclude || attr.src,
onloadExp = attr.onload || '',
autoScrollExp = attr.autoscroll;
return function(scope, element) {
var changeCounter = 0,
childScope;
var clearContent = function() {
if (childScope) {
childScope.$destroy();
childScope = null;
}
element.html('');
};
scope.$watch(srcExp, function ngIncludeWatchAction(src) {
var thisChangeId = ++changeCounter;
if (src) {
$http.get(src, {cache: $templateCache}).success(function(response) {
if (thisChangeId !== changeCounter) return;
if (childScope) childScope.$destroy();
childScope = scope.$new();
element.html(response);
$compile(element.contents())(childScope);
if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
$anchorScroll();
}
childScope.$emit('$includeContentLoaded');
scope.$eval(onloadExp);
}).error(function() {
if (thisChangeId === changeCounter) clearContent();
});
} else clearContent();
});
};
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:ngInit
*
* @description
* The `ngInit` directive specifies initialization tasks to be executed
* before the template enters execution mode during bootstrap.
*
* @element ANY
* @param {expression} ngInit {@link guide/expression Expression} to eval.
*
* @example
<doc:example>
<doc:source>
<div ng-init="greeting='Hello'; person='World'">
{{greeting}} {{person}}!
</div>
</doc:source>
<doc:scenario>
it('should check greeting', function() {
expect(binding('greeting')).toBe('Hello');
expect(binding('person')).toBe('World');
});
</doc:scenario>
</doc:example>
*/
var ngInitDirective = ngDirective({
compile: function() {
return {
pre: function(scope, element, attrs) {
scope.$eval(attrs.ngInit);
}
}
}
});
/**
* @ngdoc directive
* @name ng.directive:ngNonBindable
* @priority 1000
*
* @description
* Sometimes it is necessary to write code which looks like bindings but which should be left alone
* by angular. Use `ngNonBindable` to make angular ignore a chunk of HTML.
*
* @element ANY
*
* @example
* In this example there are two location where a simple binding (`{{}}`) is present, but the one
* wrapped in `ngNonBindable` is left alone.
*
* @example
<doc:example>
<doc:source>
<div>Normal: {{1 + 2}}</div>
<div ng-non-bindable>Ignored: {{1 + 2}}</div>
</doc:source>
<doc:scenario>
it('should check ng-non-bindable', function() {
expect(using('.doc-example-live').binding('1 + 2')).toBe('3');
expect(using('.doc-example-live').element('div:last').text()).
toMatch(/1 \+ 2/);
});
</doc:scenario>
</doc:example>
*/
var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
/**
* @ngdoc directive
* @name ng.directive:ngPluralize
* @restrict EA
*
* @description
* # Overview
* `ngPluralize` is a directive that displays messages according to en-US localization rules.
* These rules are bundled with angular.js, but can be overridden
* (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive
* by specifying the mappings between
* {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
* plural categories} and the strings to be displayed.
*
* # Plural categories and explicit number rules
* There are two
* {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
* plural categories} in Angular's default en-US locale: "one" and "other".
*
* While a pural category may match many numbers (for example, in en-US locale, "other" can match
* any number that is not 1), an explicit number rule can only match one number. For example, the
* explicit number rule for "3" matches the number 3. There are examples of plural categories
* and explicit number rules throughout the rest of this documentation.
*
* # Configuring ngPluralize
* You configure ngPluralize by providing 2 attributes: `count` and `when`.
* You can also provide an optional attribute, `offset`.
*
* The value of the `count` attribute can be either a string or an {@link guide/expression
* Angular expression}; these are evaluated on the current scope for its bound value.
*
* The `when` attribute specifies the mappings between plural categories and the actual
* string to be displayed. The value of the attribute should be a JSON object.
*
* The following example shows how to configure ngPluralize:
*
* <pre>
* <ng-pluralize count="personCount"
when="{'0': 'Nobody is viewing.',
* 'one': '1 person is viewing.',
* 'other': '{} people are viewing.'}">
* </ng-pluralize>
*</pre>
*
* In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not
* specify this rule, 0 would be matched to the "other" category and "0 people are viewing"
* would be shown instead of "Nobody is viewing". You can specify an explicit number rule for
* other numbers, for example 12, so that instead of showing "12 people are viewing", you can
* show "a dozen people are viewing".
*
* You can use a set of closed braces(`{}`) as a placeholder for the number that you want substituted
* into pluralized strings. In the previous example, Angular will replace `{}` with
* <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder
* for <span ng-non-bindable>{{numberExpression}}</span>.
*
* # Configuring ngPluralize with offset
* The `offset` attribute allows further customization of pluralized text, which can result in
* a better user experience. For example, instead of the message "4 people are viewing this document",
* you might display "John, Kate and 2 others are viewing this document".
* The offset attribute allows you to offset a number by any desired value.
* Let's take a look at an example:
*
* <pre>
* <ng-pluralize count="personCount" offset=2
* when="{'0': 'Nobody is viewing.',
* '1': '{{person1}} is viewing.',
* '2': '{{person1}} and {{person2}} are viewing.',
* 'one': '{{person1}}, {{person2}} and one other person are viewing.',
* 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
* </ng-pluralize>
* </pre>
*
* Notice that we are still using two plural categories(one, other), but we added
* three explicit number rules 0, 1 and 2.
* When one person, perhaps John, views the document, "John is viewing" will be shown.
* When three people view the document, no explicit number rule is found, so
* an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.
* In this case, plural category 'one' is matched and "John, Marry and one other person are viewing"
* is shown.
*
* Note that when you specify offsets, you must provide explicit number rules for
* numbers from 0 up to and including the offset. If you use an offset of 3, for example,
* you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for
* plural categories "one" and "other".
*
* @param {string|expression} count The variable to be bounded to.
* @param {string} when The mapping between plural category to its correspoding strings.
* @param {number=} offset Offset to deduct from the total number.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.person1 = 'Igor';
$scope.person2 = 'Misko';
$scope.personCount = 1;
}
</script>
<div ng-controller="Ctrl">
Person 1:<input type="text" ng-model="person1" value="Igor" /><br/>
Person 2:<input type="text" ng-model="person2" value="Misko" /><br/>
Number of People:<input type="text" ng-model="personCount" value="1" /><br/>
<!--- Example with simple pluralization rules for en locale --->
Without Offset:
<ng-pluralize count="personCount"
when="{'0': 'Nobody is viewing.',
'one': '1 person is viewing.',
'other': '{} people are viewing.'}">
</ng-pluralize><br>
<!--- Example with offset --->
With Offset(2):
<ng-pluralize count="personCount" offset=2
when="{'0': 'Nobody is viewing.',
'1': '{{person1}} is viewing.',
'2': '{{person1}} and {{person2}} are viewing.',
'one': '{{person1}}, {{person2}} and one other person are viewing.',
'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
</ng-pluralize>
</div>
</doc:source>
<doc:scenario>
it('should show correct pluralized string', function() {
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('1 person is viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor is viewing.');
using('.doc-example-live').input('personCount').enter('0');
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('Nobody is viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Nobody is viewing.');
using('.doc-example-live').input('personCount').enter('2');
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('2 people are viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor and Misko are viewing.');
using('.doc-example-live').input('personCount').enter('3');
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('3 people are viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor, Misko and one other person are viewing.');
using('.doc-example-live').input('personCount').enter('4');
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('4 people are viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor, Misko and 2 other people are viewing.');
});
it('should show data-binded names', function() {
using('.doc-example-live').input('personCount').enter('4');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor, Misko and 2 other people are viewing.');
using('.doc-example-live').input('person1').enter('Di');
using('.doc-example-live').input('person2').enter('Vojta');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Di, Vojta and 2 other people are viewing.');
});
</doc:scenario>
</doc:example>
*/
var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) {
var BRACE = /{}/g;
return {
restrict: 'EA',
link: function(scope, element, attr) {
var numberExp = attr.count,
whenExp = element.attr(attr.$attr.when), // this is because we have {{}} in attrs
offset = attr.offset || 0,
whens = scope.$eval(whenExp),
whensExpFns = {},
startSymbol = $interpolate.startSymbol(),
endSymbol = $interpolate.endSymbol();
forEach(whens, function(expression, key) {
whensExpFns[key] =
$interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' +
offset + endSymbol));
});
scope.$watch(function ngPluralizeWatch() {
var value = parseFloat(scope.$eval(numberExp));
if (!isNaN(value)) {
//if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise,
//check it against pluralization rules in $locale service
if (!(value in whens)) value = $locale.pluralCat(value - offset);
return whensExpFns[value](scope, element, true);
} else {
return '';
}
}, function ngPluralizeWatchAction(newVal) {
element.text(newVal);
});
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:ngRepeat
*
* @description
* The `ngRepeat` directive instantiates a template once per item from a collection. Each template
* instance gets its own scope, where the given loop variable is set to the current collection item,
* and `$index` is set to the item index or key.
*
* Special properties are exposed on the local scope of each template instance, including:
*
* * `$index` – `{number}` – iterator offset of the repeated element (0..length-1)
* * `$first` – `{boolean}` – true if the repeated element is first in the iterator.
* * `$middle` – `{boolean}` – true if the repeated element is between the first and last in the iterator.
* * `$last` – `{boolean}` – true if the repeated element is last in the iterator.
*
*
* @element ANY
* @scope
* @priority 1000
* @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. Two
* formats are currently supported:
*
* * `variable in expression` – where variable is the user defined loop variable and `expression`
* is a scope expression giving the collection to enumerate.
*
* For example: `track in cd.tracks`.
*
* * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,
* and `expression` is the scope expression giving the collection to enumerate.
*
* For example: `(name, age) in {'adam':10, 'amalie':12}`.
*
* @example
* This example initializes the scope to a list of names and
* then uses `ngRepeat` to display every person:
<doc:example>
<doc:source>
<div ng-init="friends = [{name:'John', age:25}, {name:'Mary', age:28}]">
I have {{friends.length}} friends. They are:
<ul>
<li ng-repeat="friend in friends">
[{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
</li>
</ul>
</div>
</doc:source>
<doc:scenario>
it('should check ng-repeat', function() {
var r = using('.doc-example-live').repeater('ul li');
expect(r.count()).toBe(2);
expect(r.row(0)).toEqual(["1","John","25"]);
expect(r.row(1)).toEqual(["2","Mary","28"]);
});
</doc:scenario>
</doc:example>
*/
var ngRepeatDirective = ngDirective({
transclude: 'element',
priority: 1000,
terminal: true,
compile: function(element, attr, linker) {
return function(scope, iterStartElement, attr){
var expression = attr.ngRepeat;
var match = expression.match(/^\s*(.+)\s+in\s+(.*)\s*$/),
lhs, rhs, valueIdent, keyIdent;
if (! match) {
throw Error("Expected ngRepeat in form of '_item_ in _collection_' but got '" +
expression + "'.");
}
lhs = match[1];
rhs = match[2];
match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);
if (!match) {
throw Error("'item' in 'item in collection' should be identifier or (key, value) but got '" +
lhs + "'.");
}
valueIdent = match[3] || match[1];
keyIdent = match[2];
// Store a list of elements from previous run. This is a hash where key is the item from the
// iterator, and the value is an array of objects with following properties.
// - scope: bound scope
// - element: previous element.
// - index: position
// We need an array of these objects since the same object can be returned from the iterator.
// We expect this to be a rare case.
var lastOrder = new HashQueueMap();
scope.$watch(function ngRepeatWatch(scope){
var index, length,
collection = scope.$eval(rhs),
cursor = iterStartElement, // current position of the node
// Same as lastOrder but it has the current state. It will become the
// lastOrder on the next iteration.
nextOrder = new HashQueueMap(),
arrayBound,
childScope,
key, value, // key/value of iteration
array,
last; // last object information {scope, element, index}
if (!isArray(collection)) {
// if object, extract keys, sort them and use to determine order of iteration over obj props
array = [];
for(key in collection) {
if (collection.hasOwnProperty(key) && key.charAt(0) != '$') {
array.push(key);
}
}
array.sort();
} else {
array = collection || [];
}
arrayBound = array.length-1;
// we are not using forEach for perf reasons (trying to avoid #call)
for (index = 0, length = array.length; index < length; index++) {
key = (collection === array) ? index : array[index];
value = collection[key];
last = lastOrder.shift(value);
if (last) {
// if we have already seen this object, then we need to reuse the
// associated scope/element
childScope = last.scope;
nextOrder.push(value, last);
if (index === last.index) {
// do nothing
cursor = last.element;
} else {
// existing item which got moved
last.index = index;
// This may be a noop, if the element is next, but I don't know of a good way to
// figure this out, since it would require extra DOM access, so let's just hope that
// the browsers realizes that it is noop, and treats it as such.
cursor.after(last.element);
cursor = last.element;
}
} else {
// new item which we don't know about
childScope = scope.$new();
}
childScope[valueIdent] = value;
if (keyIdent) childScope[keyIdent] = key;
childScope.$index = index;
childScope.$first = (index === 0);
childScope.$last = (index === arrayBound);
childScope.$middle = !(childScope.$first || childScope.$last);
if (!last) {
linker(childScope, function(clone){
cursor.after(clone);
last = {
scope: childScope,
element: (cursor = clone),
index: index
};
nextOrder.push(value, last);
});
}
}
//shrink children
for (key in lastOrder) {
if (lastOrder.hasOwnProperty(key)) {
array = lastOrder[key];
while(array.length) {
value = array.pop();
value.element.remove();
value.scope.$destroy();
}
}
}
lastOrder = nextOrder;
});
};
}
});
/**
* @ngdoc directive
* @name ng.directive:ngShow
*
* @description
* The `ngShow` and `ngHide` directives show or hide a portion of the DOM tree (HTML)
* conditionally.
*
* @element ANY
* @param {expression} ngShow If the {@link guide/expression expression} is truthy
* then the element is shown or hidden respectively.
*
* @example
<doc:example>
<doc:source>
Click me: <input type="checkbox" ng-model="checked"><br/>
Show: <span ng-show="checked">I show up when your checkbox is checked.</span> <br/>
Hide: <span ng-hide="checked">I hide when your checkbox is checked.</span>
</doc:source>
<doc:scenario>
it('should check ng-show / ng-hide', function() {
expect(element('.doc-example-live span:first:hidden').count()).toEqual(1);
expect(element('.doc-example-live span:last:visible').count()).toEqual(1);
input('checked').check();
expect(element('.doc-example-live span:first:visible').count()).toEqual(1);
expect(element('.doc-example-live span:last:hidden').count()).toEqual(1);
});
</doc:scenario>
</doc:example>
*/
//TODO(misko): refactor to remove element from the DOM
var ngShowDirective = ngDirective(function(scope, element, attr){
scope.$watch(attr.ngShow, function ngShowWatchAction(value){
element.css('display', toBoolean(value) ? '' : 'none');
});
});
/**
* @ngdoc directive
* @name ng.directive:ngHide
*
* @description
* The `ngHide` and `ngShow` directives hide or show a portion of the DOM tree (HTML)
* conditionally.
*
* @element ANY
* @param {expression} ngHide If the {@link guide/expression expression} is truthy then
* the element is shown or hidden respectively.
*
* @example
<doc:example>
<doc:source>
Click me: <input type="checkbox" ng-model="checked"><br/>
Show: <span ng-show="checked">I show up when you checkbox is checked?</span> <br/>
Hide: <span ng-hide="checked">I hide when you checkbox is checked?</span>
</doc:source>
<doc:scenario>
it('should check ng-show / ng-hide', function() {
expect(element('.doc-example-live span:first:hidden').count()).toEqual(1);
expect(element('.doc-example-live span:last:visible').count()).toEqual(1);
input('checked').check();
expect(element('.doc-example-live span:first:visible').count()).toEqual(1);
expect(element('.doc-example-live span:last:hidden').count()).toEqual(1);
});
</doc:scenario>
</doc:example>
*/
//TODO(misko): refactor to remove element from the DOM
var ngHideDirective = ngDirective(function(scope, element, attr){
scope.$watch(attr.ngHide, function ngHideWatchAction(value){
element.css('display', toBoolean(value) ? 'none' : '');
});
});
/**
* @ngdoc directive
* @name ng.directive:ngStyle
*
* @description
* The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
*
* @element ANY
* @param {expression} ngStyle {@link guide/expression Expression} which evals to an
* object whose keys are CSS style names and values are corresponding values for those CSS
* keys.
*
* @example
<example>
<file name="index.html">
<input type="button" value="set" ng-click="myStyle={color:'red'}">
<input type="button" value="clear" ng-click="myStyle={}">
<br/>
<span ng-style="myStyle">Sample Text</span>
<pre>myStyle={{myStyle}}</pre>
</file>
<file name="style.css">
span {
color: black;
}
</file>
<file name="scenario.js">
it('should check ng-style', function() {
expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)');
element('.doc-example-live :button[value=set]').click();
expect(element('.doc-example-live span').css('color')).toBe('rgb(255, 0, 0)');
element('.doc-example-live :button[value=clear]').click();
expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)');
});
</file>
</example>
*/
var ngStyleDirective = ngDirective(function(scope, element, attr) {
scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
if (oldStyles && (newStyles !== oldStyles)) {
forEach(oldStyles, function(val, style) { element.css(style, '');});
}
if (newStyles) element.css(newStyles);
}, true);
});
/**
* @ngdoc directive
* @name ng.directive:ngSwitch
* @restrict EA
*
* @description
* Conditionally change the DOM structure.
*
* @usage
* <ANY ng-switch="expression">
* <ANY ng-switch-when="matchValue1">...</ANY>
* <ANY ng-switch-when="matchValue2">...</ANY>
* ...
* <ANY ng-switch-default>...</ANY>
* </ANY>
*
* @scope
* @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.
* @paramDescription
* On child elments add:
*
* * `ngSwitchWhen`: the case statement to match against. If match then this
* case will be displayed.
* * `ngSwitchDefault`: the default case when no other casses match.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.items = ['settings', 'home', 'other'];
$scope.selection = $scope.items[0];
}
</script>
<div ng-controller="Ctrl">
<select ng-model="selection" ng-options="item for item in items">
</select>
<tt>selection={{selection}}</tt>
<hr/>
<div ng-switch on="selection" >
<div ng-switch-when="settings">Settings Div</div>
<span ng-switch-when="home">Home Span</span>
<span ng-switch-default>default</span>
</div>
</div>
</doc:source>
<doc:scenario>
it('should start in settings', function() {
expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Settings Div/);
});
it('should change to home', function() {
select('selection').option('home');
expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Home Span/);
});
it('should select deafault', function() {
select('selection').option('other');
expect(element('.doc-example-live [ng-switch]').text()).toMatch(/default/);
});
</doc:scenario>
</doc:example>
*/
var NG_SWITCH = 'ng-switch';
var ngSwitchDirective = valueFn({
restrict: 'EA',
require: 'ngSwitch',
// asks for $scope to fool the BC controller module
controller: ['$scope', function ngSwitchController() {
this.cases = {};
}],
link: function(scope, element, attr, ctrl) {
var watchExpr = attr.ngSwitch || attr.on,
selectedTransclude,
selectedElement,
selectedScope;
scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
if (selectedElement) {
selectedScope.$destroy();
selectedElement.remove();
selectedElement = selectedScope = null;
}
if ((selectedTransclude = ctrl.cases['!' + value] || ctrl.cases['?'])) {
scope.$eval(attr.change);
selectedScope = scope.$new();
selectedTransclude(selectedScope, function(caseElement) {
selectedElement = caseElement;
element.append(caseElement);
});
}
});
}
});
var ngSwitchWhenDirective = ngDirective({
transclude: 'element',
priority: 500,
require: '^ngSwitch',
compile: function(element, attrs, transclude) {
return function(scope, element, attr, ctrl) {
ctrl.cases['!' + attrs.ngSwitchWhen] = transclude;
};
}
});
var ngSwitchDefaultDirective = ngDirective({
transclude: 'element',
priority: 500,
require: '^ngSwitch',
compile: function(element, attrs, transclude) {
return function(scope, element, attr, ctrl) {
ctrl.cases['?'] = transclude;
};
}
});
/**
* @ngdoc directive
* @name ng.directive:ngTransclude
*
* @description
* Insert the transcluded DOM here.
*
* @element ANY
*
* @example
<doc:example module="transclude">
<doc:source>
<script>
function Ctrl($scope) {
$scope.title = 'Lorem Ipsum';
$scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
}
angular.module('transclude', [])
.directive('pane', function(){
return {
restrict: 'E',
transclude: true,
scope: { title:'@' },
template: '<div style="border: 1px solid black;">' +
'<div style="background-color: gray">{{title}}</div>' +
'<div ng-transclude></div>' +
'</div>'
};
});
</script>
<div ng-controller="Ctrl">
<input ng-model="title"><br>
<textarea ng-model="text"></textarea> <br/>
<pane title="{{title}}">{{text}}</pane>
</div>
</doc:source>
<doc:scenario>
it('should have transcluded', function() {
input('title').enter('TITLE');
input('text').enter('TEXT');
expect(binding('title')).toEqual('TITLE');
expect(binding('text')).toEqual('TEXT');
});
</doc:scenario>
</doc:example>
*
*/
var ngTranscludeDirective = ngDirective({
controller: ['$transclude', '$element', function($transclude, $element) {
$transclude(function(clone) {
$element.append(clone);
});
}]
});
/**
* @ngdoc directive
* @name ng.directive:ngView
* @restrict ECA
*
* @description
* # Overview
* `ngView` is a directive that complements the {@link ng.$route $route} service by
* including the rendered template of the current route into the main layout (`index.html`) file.
* Every time the current route changes, the included view changes with it according to the
* configuration of the `$route` service.
*
* @scope
* @example
<example module="ngView">
<file name="index.html">
<div ng-controller="MainCntl">
Choose:
<a href="Book/Moby">Moby</a> |
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
<a href="Book/Gatsby">Gatsby</a> |
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
<a href="Book/Scarlet">Scarlet Letter</a><br/>
<div ng-view></div>
<hr />
<pre>$location.path() = {{$location.path()}}</pre>
<pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
<pre>$route.current.params = {{$route.current.params}}</pre>
<pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
<pre>$routeParams = {{$routeParams}}</pre>
</div>
</file>
<file name="book.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
</file>
<file name="chapter.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
Chapter Id: {{params.chapterId}}
</file>
<file name="script.js">
angular.module('ngView', [], function($routeProvider, $locationProvider) {
$routeProvider.when('/Book/:bookId', {
templateUrl: 'book.html',
controller: BookCntl
});
$routeProvider.when('/Book/:bookId/ch/:chapterId', {
templateUrl: 'chapter.html',
controller: ChapterCntl
});
// configure html5 to get links working on jsfiddle
$locationProvider.html5Mode(true);
});
function MainCntl($scope, $route, $routeParams, $location) {
$scope.$route = $route;
$scope.$location = $location;
$scope.$routeParams = $routeParams;
}
function BookCntl($scope, $routeParams) {
$scope.name = "BookCntl";
$scope.params = $routeParams;
}
function ChapterCntl($scope, $routeParams) {
$scope.name = "ChapterCntl";
$scope.params = $routeParams;
}
</file>
<file name="scenario.js">
it('should load and compile correct template', function() {
element('a:contains("Moby: Ch1")').click();
var content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element('a:contains("Scarlet")').click();
content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
</file>
</example>
*/
/**
* @ngdoc event
* @name ng.directive:ngView#$viewContentLoaded
* @eventOf ng.directive:ngView
* @eventType emit on the current ngView scope
* @description
* Emitted every time the ngView content is reloaded.
*/
var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$compile',
'$controller',
function($http, $templateCache, $route, $anchorScroll, $compile,
$controller) {
return {
restrict: 'ECA',
terminal: true,
link: function(scope, element, attr) {
var lastScope,
onloadExp = attr.onload || '';
scope.$on('$routeChangeSuccess', update);
update();
function destroyLastScope() {
if (lastScope) {
lastScope.$destroy();
lastScope = null;
}
}
function clearContent() {
element.html('');
destroyLastScope();
}
function update() {
var locals = $route.current && $route.current.locals,
template = locals && locals.$template;
if (template) {
element.html(template);
destroyLastScope();
var link = $compile(element.contents()),
current = $route.current,
controller;
lastScope = current.scope = scope.$new();
if (current.controller) {
locals.$scope = lastScope;
controller = $controller(current.controller, locals);
element.children().data('$ngControllerController', controller);
}
link(lastScope);
lastScope.$emit('$viewContentLoaded');
lastScope.$eval(onloadExp);
// $anchorScroll might listen on event...
$anchorScroll();
} else {
clearContent();
}
}
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:script
*
* @description
* Load content of a script tag, with type `text/ng-template`, into `$templateCache`, so that the
* template can be used by `ngInclude`, `ngView` or directive templates.
*
* @restrict E
* @param {'text/ng-template'} type must be set to `'text/ng-template'`
*
* @example
<doc:example>
<doc:source>
<script type="text/ng-template" id="/tpl.html">
Content of the template.
</script>
<a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a>
<div id="tpl-content" ng-include src="currentTpl"></div>
</doc:source>
<doc:scenario>
it('should load template defined inside script tag', function() {
element('#tpl-link').click();
expect(element('#tpl-content').text()).toMatch(/Content of the template/);
});
</doc:scenario>
</doc:example>
*/
var scriptDirective = ['$templateCache', function($templateCache) {
return {
restrict: 'E',
terminal: true,
compile: function(element, attr) {
if (attr.type == 'text/ng-template') {
var templateUrl = attr.id,
// IE is not consistent, in scripts we have to read .text but in other nodes we have to read .textContent
text = element[0].text;
$templateCache.put(templateUrl, text);
}
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:select
* @restrict E
*
* @description
* HTML `SELECT` element with angular data-binding.
*
* # `ngOptions`
*
* Optionally `ngOptions` attribute can be used to dynamically generate a list of `<option>`
* elements for a `<select>` element using an array or an object obtained by evaluating the
* `ngOptions` expression.
*
* When an item in the `<select>` menu is selected, the value of array element or object property
* represented by the selected option will be bound to the model identified by the `ngModel`
* directive of the parent select element.
*
* Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
* be nested into the `<select>` element. This element will then represent `null` or "not selected"
* option. See example below for demonstration.
*
* Note: `ngOptions` provides iterator facility for `<option>` element which should be used instead
* of {@link ng.directive:ngRepeat ngRepeat} when you want the
* `select` model to be bound to a non-string value. This is because an option element can currently
* be bound to string values only.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required The control is considered valid only if value is entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {comprehension_expression=} ngOptions in one of the following forms:
*
* * for array data sources:
* * `label` **`for`** `value` **`in`** `array`
* * `select` **`as`** `label` **`for`** `value` **`in`** `array`
* * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
* * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array`
* * for object data sources:
* * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
* * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
* * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
* * `select` **`as`** `label` **`group by`** `group`
* **`for` `(`**`key`**`,`** `value`**`) in`** `object`
*
* Where:
*
* * `array` / `object`: an expression which evaluates to an array / object to iterate over.
* * `value`: local variable which will refer to each item in the `array` or each property value
* of `object` during iteration.
* * `key`: local variable which will refer to a property name in `object` during iteration.
* * `label`: The result of this expression will be the label for `<option>` element. The
* `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
* * `select`: The result of this expression will be bound to the model of the parent `<select>`
* element. If not specified, `select` expression will default to `value`.
* * `group`: The result of this expression will be used to group options using the `<optgroup>`
* DOM element.
*
* @example
<doc:example>
<doc:source>
<script>
function MyCntrl($scope) {
$scope.colors = [
{name:'black', shade:'dark'},
{name:'white', shade:'light'},
{name:'red', shade:'dark'},
{name:'blue', shade:'dark'},
{name:'yellow', shade:'light'}
];
$scope.color = $scope.colors[2]; // red
}
</script>
<div ng-controller="MyCntrl">
<ul>
<li ng-repeat="color in colors">
Name: <input ng-model="color.name">
[<a href ng-click="colors.splice($index, 1)">X</a>]
</li>
<li>
[<a href ng-click="colors.push({})">add</a>]
</li>
</ul>
<hr/>
Color (null not allowed):
<select ng-model="color" ng-options="c.name for c in colors"></select><br>
Color (null allowed):
<span class="nullable">
<select ng-model="color" ng-options="c.name for c in colors">
<option value="">-- chose color --</option>
</select>
</span><br/>
Color grouped by shade:
<select ng-model="color" ng-options="c.name group by c.shade for c in colors">
</select><br/>
Select <a href ng-click="color={name:'not in list'}">bogus</a>.<br>
<hr/>
Currently selected: {{ {selected_color:color} }}
<div style="border:solid 1px black; height:20px"
ng-style="{'background-color':color.name}">
</div>
</div>
</doc:source>
<doc:scenario>
it('should check ng-options', function() {
expect(binding('{selected_color:color}')).toMatch('red');
select('color').option('0');
expect(binding('{selected_color:color}')).toMatch('black');
using('.nullable').select('color').option('');
expect(binding('{selected_color:color}')).toMatch('null');
});
</doc:scenario>
</doc:example>
*/
var ngOptionsDirective = valueFn({ terminal: true });
var selectDirective = ['$compile', '$parse', function($compile, $parse) {
//0000111110000000000022220000000000000000000000333300000000000000444444444444444440000000005555555555555555500000006666666666666666600000000000000077770
var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,
nullModelCtrl = {$setViewValue: noop};
return {
restrict: 'E',
require: ['select', '?ngModel'],
controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
var self = this,
optionsMap = {},
ngModelCtrl = nullModelCtrl,
nullOption,
unknownOption;
self.databound = $attrs.ngModel;
self.init = function(ngModelCtrl_, nullOption_, unknownOption_) {
ngModelCtrl = ngModelCtrl_;
nullOption = nullOption_;
unknownOption = unknownOption_;
}
self.addOption = function(value) {
optionsMap[value] = true;
if (ngModelCtrl.$viewValue == value) {
$element.val(value);
if (unknownOption.parent()) unknownOption.remove();
}
};
self.removeOption = function(value) {
if (this.hasOption(value)) {
delete optionsMap[value];
if (ngModelCtrl.$viewValue == value) {
this.renderUnknownOption(value);
}
}
};
self.renderUnknownOption = function(val) {
var unknownVal = '? ' + hashKey(val) + ' ?';
unknownOption.val(unknownVal);
$element.prepend(unknownOption);
$element.val(unknownVal);
unknownOption.prop('selected', true); // needed for IE
}
self.hasOption = function(value) {
return optionsMap.hasOwnProperty(value);
}
$scope.$on('$destroy', function() {
// disable unknown option so that we don't do work when the whole select is being destroyed
self.renderUnknownOption = noop;
});
}],
link: function(scope, element, attr, ctrls) {
// if ngModel is not defined, we don't need to do anything
if (!ctrls[1]) return;
var selectCtrl = ctrls[0],
ngModelCtrl = ctrls[1],
multiple = attr.multiple,
optionsExp = attr.ngOptions,
nullOption = false, // if false, user will not be able to select it (used by ngOptions)
emptyOption,
// we can't just jqLite('<option>') since jqLite is not smart enough
// to create it in <select> and IE barfs otherwise.
optionTemplate = jqLite(document.createElement('option')),
optGroupTemplate =jqLite(document.createElement('optgroup')),
unknownOption = optionTemplate.clone();
// find "null" option
for(var i = 0, children = element.children(), ii = children.length; i < ii; i++) {
if (children[i].value == '') {
emptyOption = nullOption = children.eq(i);
break;
}
}
selectCtrl.init(ngModelCtrl, nullOption, unknownOption);
// required validator
if (multiple && (attr.required || attr.ngRequired)) {
var requiredValidator = function(value) {
ngModelCtrl.$setValidity('required', !attr.required || (value && value.length));
return value;
};
ngModelCtrl.$parsers.push(requiredValidator);
ngModelCtrl.$formatters.unshift(requiredValidator);
attr.$observe('required', function() {
requiredValidator(ngModelCtrl.$viewValue);
});
}
if (optionsExp) Options(scope, element, ngModelCtrl);
else if (multiple) Multiple(scope, element, ngModelCtrl);
else Single(scope, element, ngModelCtrl, selectCtrl);
////////////////////////////
function Single(scope, selectElement, ngModelCtrl, selectCtrl) {
ngModelCtrl.$render = function() {
var viewValue = ngModelCtrl.$viewValue;
if (selectCtrl.hasOption(viewValue)) {
if (unknownOption.parent()) unknownOption.remove();
selectElement.val(viewValue);
if (viewValue === '') emptyOption.prop('selected', true); // to make IE9 happy
} else {
if (isUndefined(viewValue) && emptyOption) {
selectElement.val('');
} else {
selectCtrl.renderUnknownOption(viewValue);
}
}
};
selectElement.bind('change', function() {
scope.$apply(function() {
if (unknownOption.parent()) unknownOption.remove();
ngModelCtrl.$setViewValue(selectElement.val());
});
});
}
function Multiple(scope, selectElement, ctrl) {
var lastView;
ctrl.$render = function() {
var items = new HashMap(ctrl.$viewValue);
forEach(selectElement.find('option'), function(option) {
option.selected = isDefined(items.get(option.value));
});
};
// we have to do it on each watch since ngModel watches reference, but
// we need to work of an array, so we need to see if anything was inserted/removed
scope.$watch(function selectMultipleWatch() {
if (!equals(lastView, ctrl.$viewValue)) {
lastView = copy(ctrl.$viewValue);
ctrl.$render();
}
});
selectElement.bind('change', function() {
scope.$apply(function() {
var array = [];
forEach(selectElement.find('option'), function(option) {
if (option.selected) {
array.push(option.value);
}
});
ctrl.$setViewValue(array);
});
});
}
function Options(scope, selectElement, ctrl) {
var match;
if (! (match = optionsExp.match(NG_OPTIONS_REGEXP))) {
throw Error(
"Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
" but got '" + optionsExp + "'.");
}
var displayFn = $parse(match[2] || match[1]),
valueName = match[4] || match[6],
keyName = match[5],
groupByFn = $parse(match[3] || ''),
valueFn = $parse(match[2] ? match[1] : valueName),
valuesFn = $parse(match[7]),
// This is an array of array of existing option groups in DOM. We try to reuse these if possible
// optionGroupsCache[0] is the options with no option group
// optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element
optionGroupsCache = [[{element: selectElement, label:''}]];
if (nullOption) {
// compile the element since there might be bindings in it
$compile(nullOption)(scope);
// remove the class, which is added automatically because we recompile the element and it
// becomes the compilation root
nullOption.removeClass('ng-scope');
// we need to remove it before calling selectElement.html('') because otherwise IE will
// remove the label from the element. wtf?
nullOption.remove();
}
// clear contents, we'll add what's needed based on the model
selectElement.html('');
selectElement.bind('change', function() {
scope.$apply(function() {
var optionGroup,
collection = valuesFn(scope) || [],
locals = {},
key, value, optionElement, index, groupIndex, length, groupLength;
if (multiple) {
value = [];
for (groupIndex = 0, groupLength = optionGroupsCache.length;
groupIndex < groupLength;
groupIndex++) {
// list of options for that group. (first item has the parent)
optionGroup = optionGroupsCache[groupIndex];
for(index = 1, length = optionGroup.length; index < length; index++) {
if ((optionElement = optionGroup[index].element)[0].selected) {
key = optionElement.val();
if (keyName) locals[keyName] = key;
locals[valueName] = collection[key];
value.push(valueFn(scope, locals));
}
}
}
} else {
key = selectElement.val();
if (key == '?') {
value = undefined;
} else if (key == ''){
value = null;
} else {
locals[valueName] = collection[key];
if (keyName) locals[keyName] = key;
value = valueFn(scope, locals);
}
}
ctrl.$setViewValue(value);
});
});
ctrl.$render = render;
// TODO(vojta): can't we optimize this ?
scope.$watch(render);
function render() {
var optionGroups = {'':[]}, // Temporary location for the option groups before we render them
optionGroupNames = [''],
optionGroupName,
optionGroup,
option,
existingParent, existingOptions, existingOption,
modelValue = ctrl.$modelValue,
values = valuesFn(scope) || [],
keys = keyName ? sortedKeys(values) : values,
groupLength, length,
groupIndex, index,
locals = {},
selected,
selectedSet = false, // nothing is selected yet
lastElement,
element,
label;
if (multiple) {
selectedSet = new HashMap(modelValue);
}
// We now build up the list of options we need (we merge later)
for (index = 0; length = keys.length, index < length; index++) {
locals[valueName] = values[keyName ? locals[keyName]=keys[index]:index];
optionGroupName = groupByFn(scope, locals) || '';
if (!(optionGroup = optionGroups[optionGroupName])) {
optionGroup = optionGroups[optionGroupName] = [];
optionGroupNames.push(optionGroupName);
}
if (multiple) {
selected = selectedSet.remove(valueFn(scope, locals)) != undefined;
} else {
selected = modelValue === valueFn(scope, locals);
selectedSet = selectedSet || selected; // see if at least one item is selected
}
label = displayFn(scope, locals); // what will be seen by the user
label = label === undefined ? '' : label; // doing displayFn(scope, locals) || '' overwrites zero values
optionGroup.push({
id: keyName ? keys[index] : index, // either the index into array or key from object
label: label,
selected: selected // determine if we should be selected
});
}
if (!multiple) {
if (nullOption || modelValue === null) {
// insert null option if we have a placeholder, or the model is null
optionGroups[''].unshift({id:'', label:'', selected:!selectedSet});
} else if (!selectedSet) {
// option could not be found, we have to insert the undefined item
optionGroups[''].unshift({id:'?', label:'', selected:true});
}
}
// Now we need to update the list of DOM nodes to match the optionGroups we computed above
for (groupIndex = 0, groupLength = optionGroupNames.length;
groupIndex < groupLength;
groupIndex++) {
// current option group name or '' if no group
optionGroupName = optionGroupNames[groupIndex];
// list of options for that group. (first item has the parent)
optionGroup = optionGroups[optionGroupName];
if (optionGroupsCache.length <= groupIndex) {
// we need to grow the optionGroups
existingParent = {
element: optGroupTemplate.clone().attr('label', optionGroupName),
label: optionGroup.label
};
existingOptions = [existingParent];
optionGroupsCache.push(existingOptions);
selectElement.append(existingParent.element);
} else {
existingOptions = optionGroupsCache[groupIndex];
existingParent = existingOptions[0]; // either SELECT (no group) or OPTGROUP element
// update the OPTGROUP label if not the same.
if (existingParent.label != optionGroupName) {
existingParent.element.attr('label', existingParent.label = optionGroupName);
}
}
lastElement = null; // start at the beginning
for(index = 0, length = optionGroup.length; index < length; index++) {
option = optionGroup[index];
if ((existingOption = existingOptions[index+1])) {
// reuse elements
lastElement = existingOption.element;
if (existingOption.label !== option.label) {
lastElement.text(existingOption.label = option.label);
}
if (existingOption.id !== option.id) {
lastElement.val(existingOption.id = option.id);
}
// lastElement.prop('selected') provided by jQuery has side-effects
if (lastElement[0].selected !== option.selected) {
lastElement.prop('selected', (existingOption.selected = option.selected));
}
} else {
// grow elements
// if it's a null option
if (option.id === '' && nullOption) {
// put back the pre-compiled element
element = nullOption;
} else {
// jQuery(v1.4.2) Bug: We should be able to chain the method calls, but
// in this version of jQuery on some browser the .text() returns a string
// rather then the element.
(element = optionTemplate.clone())
.val(option.id)
.attr('selected', option.selected)
.text(option.label);
}
existingOptions.push(existingOption = {
element: element,
label: option.label,
id: option.id,
selected: option.selected
});
if (lastElement) {
lastElement.after(element);
} else {
existingParent.element.append(element);
}
lastElement = element;
}
}
// remove any excessive OPTIONs in a group
index++; // increment since the existingOptions[0] is parent element not OPTION
while(existingOptions.length > index) {
existingOptions.pop().element.remove();
}
}
// remove any excessive OPTGROUPs from select
while(optionGroupsCache.length > groupIndex) {
optionGroupsCache.pop()[0].element.remove();
}
}
}
}
}
}];
var optionDirective = ['$interpolate', function($interpolate) {
var nullSelectCtrl = {
addOption: noop,
removeOption: noop
};
return {
restrict: 'E',
priority: 100,
compile: function(element, attr) {
if (isUndefined(attr.value)) {
var interpolateFn = $interpolate(element.text(), true);
if (!interpolateFn) {
attr.$set('value', element.text());
}
}
return function (scope, element, attr) {
var selectCtrlName = '$selectController',
parent = element.parent(),
selectCtrl = parent.data(selectCtrlName) ||
parent.parent().data(selectCtrlName); // in case we are in optgroup
if (selectCtrl && selectCtrl.databound) {
// For some reason Opera defaults to true and if not overridden this messes up the repeater.
// We don't want the view to drive the initialization of the model anyway.
element.prop('selected', false);
} else {
selectCtrl = nullSelectCtrl;
}
if (interpolateFn) {
scope.$watch(interpolateFn, function interpolateWatchAction(newVal, oldVal) {
attr.$set('value', newVal);
if (newVal !== oldVal) selectCtrl.removeOption(oldVal);
selectCtrl.addOption(newVal);
});
} else {
selectCtrl.addOption(attr.value);
}
element.bind('$destroy', function() {
selectCtrl.removeOption(attr.value);
});
};
}
}
}];
var styleDirective = valueFn({
restrict: 'E',
terminal: true
});
//try to bind to jquery now so that one can write angular.element().read()
//but we will rebind on bootstrap again.
bindJQuery();
publishExternalAPI(angular);
jqLite(document).ready(function() {
angularInit(document, bootstrap);
});
})(window, document);
angular.element(document).find('head').append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak{display:none !important;}ng\\:form{display:block;}</style>');
<!DOCTYPE html>
<html ng-app="app">
<head>
<title ng-cloak>Backup Info For {{space.name}}</title>
<link rel="stylesheet" href="/bags/common/tiddlers/normalize.css">
<link rel="stylesheet" href="/backups.css">
</head>
<body ng-controller="BackupsCtrl">
<header>
<div>
<h1 ng-cloak>Backup Info For {{space.name}}</h1>
</div>
</header>
<article>
<div class="intro">
<p>This is a single page application that presents information about
backing up the content of a space, public and private. It also provides
links for doing a quick backup of <em>only</em> the latest revisions of
all your tiddlers. If you need something more complex, hopefully some of
the information provided here can guide you.</p>
</div>
<div class="warning" ng-show="space.isSelf">
<p>Note: In order for the backup links to display, you must include the
<strong>backups</strong> space in your space, via the <em>space control
panel</em> found by visiting the blue and pink dot in the upper right
when viewing your space. Once you do that, visit <code>/backups</code>.</p>
</div>
<div class="meat">
<p ng-show="space.notSelf"><a href="#downloads">Go straight to the links.</a></p>
<h1>About Backups</h1>
<p>When making a backup of your space there are several options, some
requiring more effort than others:</p>
<ul>
<li>You can get just the content in this space, or also content
included from other spaces.</li>
<li>You can choose to get the content as a collection of <a
href="http://json.org/">JSON</a> or as a <a
href="http://tiddlywiki.com/">TiddlyWiki Classic</a> file.</li>
<li>You can choose to get just the latest revision of each tiddler or
all the revisions of all tiddlers.</li>
</ul>
<p>Getting all the tiddlers in a space means getting the tiddlers
generated by the <a href="http://tiddlyweb.tiddlyspace.com/recipe">
recipes</a> whereas to get just the content created in this space
means getting the tiddlers generated by the <a
href="http://tiddlyweb.tiddlyspace.com/bag">bags</a>. The links below
use the bags method.</p>
<p>Which type of output you choose for the content depends on what you
intend to do with the content. If you want to use it somewhere that
uses TiddlyWiki but does <em>not</em> use TiddlyWeb then TiddlyWiki is
the right choice. If you want to use it somewhere uses neither TiddlyWeb
nor TiddlyWiki then JSON is the right choice. If you are making a
simple backup for safekeeping or to move to another TiddlySpace-based
server then either JSON or TiddlyWiki are suitable choices. TiddlyWiki
files can be imported directly, JSON files will require some code to
parse the data and <code>PUT</code> it to the server.</p>
<p>If you want to get all revisions of tiddlers, the links below will
not work, instead you will need to write code that traverses the <a
href="http://tiddlyweb.tiddlyspace.com/%2Fbags%2F%7Bbag_name%7D%2Ftiddlers">list of tiddlers</a>
and then gets all the <a href="http://tiddlyweb.tiddlyspace.com/%2Fbags%2F%7Bbag_name%7D%2Ftiddlers%2F%7Btiddler_title%7D%2Frevisions">revisions</a>
for each tiddler.</p>
<p>Ideally this page would provide links to importing data. Unfortunately
time does not currently allow this.</p>
</div>
<div id="downloads" ng-cloak ng-show="space.notSelf" class="actions">
<h1>Download</h1>
<p>Right click the following links to save all the tiddlers from your
{{ space.name }} to different files, one for public and one for private.
Keep in mind that this is <em>only</em> the latest revisions of the tiddlers
in the space. If you have a large number of tiddlers these will be
a very large files.</p>
<p>In some modern browsers with support for the <code>download</code>
attribute a standard click will work.</p>
<div ng-show="space.isMember" class="downlinks">
<p><a class="downlink public" download="{{space.publicFileName}}.json" href="/bags/{{ space.publicBag }}/tiddlers.json?fat=1">Public Tiddlers as JSON</a>
<a class="downlink private" download={{space.privateFileName}}.json" href="/bags/{{ space.privateBag }}/tiddlers.json?fat=1">Private Tiddlers as JSON</a></p>
<p><a class="downlink public" download="{{space.publicFileName}}.wiki" href="/bags/{{ space.publicBag }}/tiddlers.wiki?fat=1">Public Tiddlers as Wiki</a>
<a class="downlink private" download={{space.privateFileName}}.wiki" href="/bags/{{ space.privateBag }}/tiddlers.wiki?fat=1">Private Tiddlers as Wiki</a></p>
</div>
<p>No links? Are you sure you are logged in or a member of this space?</p>
</div>
<div ng-cloak ng-show="space.isSelf" class="actions">
Include this space (<strong>backups</strong>) in your space to display
backup links here.
</div>
</article>
<footer>
<p>Another fine <a href="//tiddlyspace.com">TiddlySpace</a> <a href="//tsapp.tiddlyspace.com">tsapp</a> from <a href="//cdent.tiddlyspace.com/">cdent</a>.</p>
</footer>
<script src="/status.js"></script>
<script src="/bags/backups_public/tiddlers/angular.js"></script>
<script src="/bags/backups_public/tiddlers/backups.js"></script>
<script src="/bags/common/tiddlers/backstage.js"></script>
</body>
</html>
html {
margin: 0;
padding: 0;
}
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}
#app-picker {
top: 6px !important;
right: 24px !important;
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #35313b;
margin: 0;
padding: 0;
}
header {
background: #2c2c2c;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
border-color: #252525;
min-height: 40px;
color: #999;
}
header h1 {
text-transform: uppercase;
font-size: 1.25em;
font-weight: 200;
line-height: 2em;
padding-left: 12px;
margin: 0;
}
a {
color: #0082af;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
article {
width: 50%;
margin: 0 auto 0 auto;
}
.downlinks p {
padding-bottom: 1em;
}
.downlink {
border: thin solid black;
border-radius: .5em;
padding: .5em 2em .5em 2em;
color: black;
}
.public {
background-color: #c1e6fd;
}
.private {
background-color: #f4c4e2;
}
footer {
position: absolute;
right: 20px;
font-size: small;
}
@media all and (max-width: 700px) {
article {
width: 90%;
}
}
var app = angular.module('app', []);
app.controller('BackupsCtrl', ['$scope', function($scope) {
var space = {},
name = tiddlyweb.status.space.name,
timeStamp = +new Date / 1e3 | 0,
isMember = tiddlyweb.status.space.recipe.match(/_private$/);
space.name = name;
space.publicBag = space.name + '_public';
space.privateBag = space.name + '_private';
space.publicFileName = space.publicBag + '-' + timeStamp;
space.privateFileName = space.privateBag + '-' + timeStamp;
space.isSelf = (space.name === 'backups');
space.notSelf = !space.isSelf;
space.isMember = isMember;
$scope.$parent.space = space;
}]);
@@Please do not modify this tiddler; it was created automatically upon space creation.@@
So, @alexhough reads a bit about mentalizing, and edits a version of my tiddler about it in his site.
Because I am following him, and he has tagged his edited version of my tiddler with @dickon, I am alerted in my following stream.
This is unsatisfactory because I may have missed it, as I don't check in that regularly, and his yeloow highlighted tiddler may get swept away by all the other tiddlers that are not specifically alerting me.
>can I have a way of filtering out just the edits and forks and posts that are //specifically related to me//?
>Can I select a list of 'key words' or tags that I can watch over (I would pick "mentalizing", for instance)?
Next, when I "reply" I am taken back to my [[Mentalizing]] tiddler (@dickon) - which is one sense fine, except that in order to let Alex know I am replying to him I have to add a title, and a date, and reply under that (see [[Mentalizing]] for my entry at 28.02.11 that stimulated this thought.) ...this turns my tiddler into a "discussion-field", rather than a 'definitive description' that I might want to be curating (if, O reader, you want that, please go and look at the definition in @ambit, not here!)...
>Can I reply to Alex in a tiddler that is perhaps ''tagged'' with {{{Mentalizing}}} and @alexhough? or somehow separate out my discussion about content of a tiddler with teh actual content of that tiddler? Or perhaps using a "Discuss this topic" thread that is attached to my tiddler, but not in teh middle of it is what I am really after...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>edit</title>
<link rel="stylesheet"
type="text/css"
href="/bags/common/tiddlers/reset.css">
<link rel="stylesheet"
type="text/css"
href="/edit.css">
</head>
<body>
<div id="container">
<div class="cleancol" id="recents">
<h1>Changes</h1>
<ul>
</ul>
</div>
<div class="cleancol" id="info">
<ul id="actions">
<li><button id="saver">Save & Return</button></li>
<li><button id="save">Save</button></li>
<li><button id="revert">Revert</button></li>
<li><button id="delete">Delete</button></li>
</ul>
<div id="type">
<ul>
<li><label><input name="type" type="radio"
value="text/x-tiddlywiki">TiddlyWikiText</label></li>
<li><label><input name="type" type="radio"
value="text/x-markdown">Markdown</label></li>
<li><label><input name="type" type="radio"
value="text/css">CSS</label></li>
<li><label><input name="type" type="radio"
value="text/javascript">JavaScript</label></li>
<li><label><input name="type" type="radio"
value="text/html">HTML</label></li>
<li><label><input name="type" type="radio"
value="text/plain">Plain Text</label></li>
<li><label><input name="type" type="radio"
value="other">Other</label></li>
</ul>
</div>
<div id="message"></div>
<div id="tags">
</div>
</div>
<div class="cleancol" id="editor">
<h1></h1>
<textarea class="inputs" name="text"></textarea><br/>
<input class="inputs" name="tags" value="">
</div>
</div>
<script src="/bags/common/tiddlers/jquery.js"></script>
<script src="/bags/edit_public/tiddlers/edit.js"></script>
<script src="/status.js"></script>
<script src="/bags/common/tiddlers/backstage.js"></script>
</body>
</html>
html, body {
height: 100%;
max-height: 100%;
background: #F0F4F8;
font-family: "Helvetica Neue",helvetica,arial,sans-serif;
line-height: 1.4;
overflow: auto;
}
button {
cursor: pointer;
}
.privacyicon {
float: right;
}
#delete {
margin-top: 1em;
}
.cleancol > h1 {
font-size: 150%;
text-align: center;
}
#message {
padding: 1em;
display: none;
}
#container {
height: 90%;
margin: 1em auto 0 auto;
width: 100%;
}
.inputs {
white-space: pre-wrap;
font: 90% "Andale Mono", "Lucida Console", "Bitstream Vera Sans Mono", "Courier New", monospace;
border: none;
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.5);
}
#editor textarea {
height: 85%;
width: 96%;
padding: 2%;
border-radius: .5em .5em 0 0;
border-top: thin solid lightgrey;
border-left: thin solid lightgrey;
}
#editor input {
width: 100%;
border-radius: 0 0 .5em .5em;
}
.cleancol {
height: 90%;
background: #DCE7F1;
padding: 1em;
border-radius: .5em;
border-top: thin solid #ACA7FF;
border-left: thin solid #ACA7FF;
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.5);
overflow-x: hide;
}
#recents {
float: right;
width: 20%;
overflow: hide;
margin-right: 1em;
}
#recents span {
cursor: pointer;
padding-right: 1em;
}
#editor {
margin-left: auto;
margin-right: auto;
width: 45%;
}
#info {
position: relative;
float: left;
width: 20%;
margin-left: 1em;
}
#info button {
width: 100%;
}
#tags {
position: absolute;
bottom: 0;
max-height: 15em;
overflow: hide;
width: 90%;
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
column-gap: 1em;
-moz-column-gap: 1em;
-webkit-column-gap: 1em;
}
.taglink {
cursor: pointer;
display: block;
}
a {
color: #BC4378;
text-decoration: none;
}
@media all and (max-width: 50em) {
#recents {
display: none;
}
#editor {
width: 65%;
margin-right: 1em;
}
}
$(function() {
"use strict";
var recentTags,
Set,
localStorage = window.localStorage,
currentFields = {},
currentTimeout = 0,
startHash,
space = tiddlyweb.status.space.name,
freshTiddler = false,
defaultBag = space + '_public',
currentBag = defaultBag,
defaultType = 'text/x-tiddlywiki',
host = '/',
publicIcon = 'bags/tiddlyspace/tiddlers/publicIcon',
privateIcon = 'bags/tiddlyspace/tiddlers/privateIcon',
extracludeRE = /^.extraclude (.+?)\s*$([\s\S]*?)^.extraclude$/mg,
extracludeReplace = {
'text/x-markdown': '{{$1}}'
};
// because we can't use a variable just above...
extracludeReplace[defaultType] = '<<tiddler [[$1]]>>';
Set = function() {};
Set.prototype.add = function(o) { this[o] = true; };
Set.prototype.remove = function(o) { delete this[o]; };
recentTags = new Set();
startHash = adler32('');
$(window).bind('beforeunload', function(e) {
var currentHash = adler32($('input[name=tags]').val()
+ $('textarea[name=text]').val());
e.stopPropagation();
if (currentHash !== startHash) {
e.returnValue = 'You have unsaved changes.';
return e.returnValue;
}
});
$(window).bind('hashchange', checkHash);
$('#revert').bind('click', function() {
$('button, input, .inputs').attr('disabled', 'disabled');
var title = $('#editor > h1').text(),
uri = tiddlerURI(host, currentBag, title);
flushStorage(uri);
startEdit($('#editor > h1').text());
});
$('#save').bind('click', function() {
$('button, input, .inputs').attr('disabled', 'disabled');
saveEdit(function() {
var title = $('#editor > h1').text(),
uri = tiddlerURI(host, currentBag, title);
flushStorage(uri);
changes();
});
});
$('#saver').bind('click', function() {
$('button, input, .inputs').attr('disabled', 'disabled');
saveEdit(function() {
var title = encodeURIComponent($('#editor > h1').text()),
uri = tiddlerURI(host, currentBag, title);
flushStorage(uri);
startHash = adler32($('input[name=tags]').val()
+ $('textarea[name=text]').val());
window.location.href = '/' + title;
});
});
$('#delete').bind('click', function() {
var title = encodeURIComponent($('#editor > h1').text());
$('button, input, .inputs').attr('disabled', 'disabled');
if (currentBag) {
if (confirm('Are you sure you want to delete ' + title + '?')) {
$('input[name=tags]').val('');
$('textarea[name=text]').val('');
$('#editor > h1').text('');
startHash = adler32('');
deleteTiddler(title);
}
} else {
displayMessage('Tiddler never saved to server.');
}
});
/*
* Establish a timeout for auto-saving.
*/
function establishInterval() {
var timeoutId = 0,
currentHash;
if (localStorage) {
timeoutId = setInterval(function () {
var title = $('#editor > h1').text(),
text = $('textarea[name=text]').val(),
tags = readTagView(),
tiddler = {
title: title,
text: text,
tags: tags,
fields: currentFields,
bag: currentBag,
contentType: $('[name=type]:checked').val()
},
uri = tiddlerURI(host, currentBag, title);
currentHash = adler32($('input[name=tags]').val()
+ $('textarea[name=text]').val());
if (currentHash !== startHash) {
localStorage.setItem(uri, JSON.stringify(tiddler));
}
}, 10000);
}
return timeoutId;
}
/*
* Flush the current data out of localStorage.
*/
function flushStorage(uri) {
if (localStorage) {
if (currentTimeout) {
window.clearInterval(currentTimeout);
}
localStorage.removeItem(uri);
}
}
/*
* Fade in an announcement text message.
*/
function displayMessage(message, extra) {
var content = $('<p>').text(message);
$('#message').empty();
$('#message').append(content);
if (extra) {
$('#message').append(extra);
}
$('#message').fadeIn();
}
/*
* Display an icon indicating privacy status of tiddler.
*/
function setIcon(privatep) {
$('.privacyicon').remove();
var img = $('<img>').attr({
src: host + (privatep ? privateIcon : publicIcon),
'class': 'privacyicon'
});
if (freshTiddler) {
img.css('cursor', 'pointer')
.click(function() {
var target = privatep ? 'public' : 'private';
if (confirm('Switch to '
+ (privatep ? 'public' : 'private') + '?')) {
currentBag = space + '_' + target;
setIcon(!privatep);
}
});
}
$('#type').prepend(img);
}
/*
* Given host, bag and title make a good URI
* for a tiddler.
*/
function tiddlerURI(host, bag, title) {
return host + 'bags/'
+ encodeURIComponent(bag ? bag : defaultBag)
+ '/tiddlers/'
+ encodeURIComponent(title);
}
/*
* Send a DELETE for the tiddler named by title.
*/
function deleteTiddler(title) {
if (title && currentBag) {
$(window).unbind('hashchange');
window.location.hash = '';
$(window).bind('hashchange', checkHash);
var uri = tiddlerURI(host, currentBag, title);
$.ajax({
url: uri,
type: 'DELETE',
success: changes
});
} else {
displayMessage('Nothing to delete.');
}
}
/*
* Inform a non-member that they may not edit.
*/
function guestPage() {
$('button, input, .inputs').attr('disabled', 'disabled');
$('#message').text('You are not a member of this space, so cannot edit. ');
var link = $('<a>')
.attr('href', host)
.text('Visit the space.');
$('#message').append(link).fadeIn();
}
/*
* Save the text and tags to the title in currentBag.
*/
function saveEdit(callback) {
callback = callback || changes;
var title = $('#editor > h1').text();
if (title) {
_processText(title, $('textarea[name=text]').val(), callback);
} else {
displayMessage('There is nothing to save');
}
}
/*
* Search for '.extraclude' in page and do an
* extraclusion if found. Multiples possible.
*/
function _processText(title, text, callback) {
var newTiddlers = {},
match,
subtitle,
subtext,
tiddler;
while (match = extracludeRE.exec(text)) {
subtitle = match[1];
subtext = match[2].replace(/^\s*/, '').replace(/\s*$/, '');
tiddler = {
text: subtext,
type: currentFields.type
};
newTiddlers[subtitle] = tiddler;
}
var countTiddlers = Object.keys(newTiddlers).length,
countSuccess = 0,
postExtra = function() {
var replaceType = extracludeReplace[currentFields.type ?
currentFields.type : defaultType];
countSuccess += 1;
if (countSuccess >= countTiddlers) {
text = text.replace(extracludeRE, replaceType);
_saveEdit(title, text, callback);
}
},
postExtraFail = function(xhr, status, errorThrown) {
displayMessage('Extraclude failed' + status);
};
if (countTiddlers) {
for (subtitle in newTiddlers) {
if (newTiddlers.hasOwnProperty(subtitle)) {
_putTiddler(subtitle, newTiddlers[subtitle], postExtra,
postExtraFail);
}
}
} else {
_saveEdit(title, text, callback);
}
}
/*
* PUT a tiddler that was extracluded.
*/
function _putTiddler(title, tiddlerData, successCall, errorCall) {
var jsonText = JSON.stringify(tiddlerData);
$.ajax({
url: tiddlerURI(host, currentBag, title),
type: 'PUT',
data: jsonText,
contentType: 'application/json',
success: successCall,
error: errorCall
});
}
function _saveEdit(title, text, callback) {
var tags = readTagView(),
tiddler = {};
tiddler.text = text;
tiddler.tags = tags;
tiddler.type = currentFields.type;
delete currentFields.type;
tiddler.fields = currentFields;
// update content based on radio buttons
var matchedType = $('[name=type]:checked').val();
if (matchedType !== 'other') {
tiddler.type = matchedType;
}
var jsonText = JSON.stringify(tiddler);
$.ajax({
beforeSend: function(xhr) {
if (tiddler.fields['server.etag']) {
xhr.setRequestHeader('If-Match',
tiddler.fields['server.etag']);
}
},
url: tiddlerURI(host, currentBag, title),
type: "PUT",
contentType: 'application/json',
data: jsonText,
success: callback,
statusCode: {
412: function() {
displayMessage('Edit Conflict');
// re-enable text and tags to allow copy
$('.inputs').removeAttr('disabled');
},
409: function() {
displayMessage('Malformed Tiddler (long title?)');
// re-enable text and tags to allow copy
$('.inputs').removeAttr('disabled');
}
}
});
}
/*
* Read the current tags from the input into an array.
*/
function readTagView(tagString) {
var tags = [];
tagString = tagString || $('input[name=tags]').val();
var matches = tagString.match(/([^ \]\[]+)|(?:\[\[([^\]]+)\]\])/g) || [];
$.each(matches, function(index, value) {
tags.push(value.replace(/[\]\[]+/g, ''));
});
return tags;
}
/*
* Write updated tags into the tag view. If a non-false second
* argument is passed, it is assumed to be a tag that is being
* added or removed.
*/
function updateTagView(tags, changedTag) {
var outputTags = [],
changedIndex;
if (changedTag) {
changedIndex = tags.indexOf(changedTag);
if (changedIndex === -1) {
tags.push(changedTag);
} else {
tags.splice(changedIndex, 1);
}
}
$.each(tags, function(index, tag) {
if (tag.match(/ /)) {
outputTags.push('[[' + tag + ']]');
} else {
outputTags.push(tag);
}
});
$('#editor input').val(outputTags.join(' '));
}
/*
* Display the most recently used tags.
*/
function updateTags(tags) {
$('#tags').empty();
tags = Object.keys(tags);
tags = tags.sort();
$.each(tags, function(index, tag) {
var taglink = $('<a>')
.text(tag)
.addClass('taglink')
.bind('click', function() {
updateTagView(readTagView(), tag);
});
$('#tags').append(taglink);
});
}
function updateContentType(tiddlerType) {
$('[name=type]').prop('checked', false);
var matchedType = $('[name=type]')
.filter('[value="' + tiddlerType + '"]');
if (matchedType.length) {
matchedType.prop('checked', true);
} else if (tiddlerType) {
$('[name=type]')
.filter('[value=other]')
.prop('checked', true);
} else {
$('[name=type]')
.filter('[value="' + defaultType + '"]')
.prop('checked', true);
}
}
/*
* Ask if we'd like to clone.
*/
function cloneTiddler(tiddler) {
var button = $('<button>').attr('id', 'clone')
.text('Clone'),
li = $('<li>').attr('id', 'clone').append(button);
button.on('click', function() {
tiddler.bag = space + '_public';
delete tiddler.fields['server.etag'];
$('#message').fadeOut('slow');
establishEdit(tiddler);
$('button, input, .inputs').removeAttr('disabled');
});
$('#actions').append(li);
}
/*
* Callback after tiddler is GET from server, filling in forms,
* preparing for edit.
*/
function establishEdit(tiddler, status, xhr) {
currentBag = tiddler.bag;
$('#clone').remove();
$('textarea[name=text]').val(tiddler.text);
currentFields = tiddler.fields;
currentFields.type = tiddler.type;
// update the content type buttons
updateContentType(tiddler.type);
if (xhr) {
currentFields['server.etag'] = xhr.getResponseHeader('etag');
}
updateTagView(tiddler.tags, null);
if (tiddler.permissions && tiddler.permissions.indexOf('write') === -1) {
$('button, input, .inputs').attr('disabled', 'disabled');
displayMessage('Edit permission denied. '
+ 'Choose another tiddler or clone.');
return cloneTiddler(tiddler);
} else if (!currentBag.match(space + '_(?:private|public)')) {
$('button, input, .inputs').attr('disabled', 'disabled');
displayMessage('Tiddler must be cloned to edit.');
return cloneTiddler(tiddler);
}
startHash = adler32($('input[name=tags]').val()
+ $('textarea[name=text]').val());
currentTimeout = establishInterval();
if (currentBag.match(/_(private|public)$/)) {
setIcon(currentBag.match(/_private$/));
}
}
/*
* Check to see if there is backup data for the current tiddler
*/
function checkBackup(tiddlerTitle) {
if (localStorage) {
var uri = tiddlerURI(host, currentBag, tiddlerTitle),
data = localStorage.getItem(uri);
return data;
}
return null;
}
/*
* Get the named tiddler to do an edit.
*/
function startEdit(tiddlerTitle, freshTags, freshType) {
$('#message').fadeOut('slow');
$('button, input, .inputs').removeAttr('disabled');
$('#editor > h1').text(tiddlerTitle);
var tiddlerBackup = checkBackup(tiddlerTitle);
if (tiddlerBackup) {
/*
* We flushStorage whether they confirm or cancel:
* we already have the data.
*/
var uri = tiddlerURI(host, currentBag, tiddlerTitle);
flushStorage(uri);
if (confirm("There's a backup for this tiddler. Use it?")) {
var data = JSON.parse(tiddlerBackup);
data.type = data.contentType;
delete data.contentType;
return establishEdit(data);
}
}
$.ajax({
dataType: 'json',
headers: {'Cache-Control': 'max-age=0'},
url: host + encodeURIComponent(tiddlerTitle),
success: establishEdit,
statusCode: {
404: function() {
$('[name=type]')
.filter('[value="' + defaultType + '"]')
.prop('checked', true);
$('textarea[name=text]').val('');
freshTiddler = true;
setIcon(false);
currentTimeout = establishInterval();
updateContentType(freshType);
updateTagView(readTagView(freshTags), null);
currentFields = {};
}
}
});
}
function emptyEdit() {
$('button, input, .inputs').attr('disabled', 'disabled');
var titler = $('<input id="editnew">')
.attr('placeholder', 'Or enter a new title')
.bind('change', editNew);
displayMessage('Select a tiddler to edit from the right.', titler);
}
function editNew() {
var newTitle = $(this).val();
if (newTitle) {
startEdit(newTitle);
}
}
/*
* Check the href anchor to see if we've been told what to edit.
*/
function checkHash() {
var hash = window.location.hash,
title,
tagString,
type,
args;
if (hash) {
hash = hash.replace(/^#/, '');
args = hash.split('/');
if (args.length === 4) {
args[2] = args.slice(2).join('/');
args.pop();
}
$.each(args, function(index, arg) {
args[index] = decodeURIComponent(arg);
});
title = args[0] || emptyEdit();
tagString = args[1] || '';
type = args[2] || '';
startEdit(title, tagString, type);
} else {
emptyEdit();
}
}
/*
* Display the recent changes.
*/
function displayChanges(tiddlers) {
$.each(tiddlers, function(index, tiddler) {
if (!tiddler.type ||
tiddler.type.match(/^text/)) {
$.each(tiddler.tags, function(index, tag) {
recentTags.add(tag);
});
var penSpan = $('<span>').text('\u270E')
.bind('click', function() {
var title = $(this).parent().attr('data-tiddler-title');
$(window).unbind('hashchange');
window.location.hash = title;
$(window).bind('hashchange', checkHash);
startEdit(title);
}),
tiddlerLink = $('<a>').attr({
href: '/' + encodeURIComponent(tiddler.title),
target: '_blank'
}).text(tiddler.title),
list = $('<li>').attr('data-tiddler-title',
tiddler.title).append(tiddlerLink).prepend(penSpan);
$('#recents > ul').append(list);
}
});
updateTags(recentTags);
}
/*
* Get the 20 most recently changed tiddlers in the public and private
* bag of the space, callback to displayChanges.
*/
function changes() {
$('#recents > ul').empty();
$.ajax({
dataType: 'json',
headers: {'Cache-Control': 'max-age=0'},
url: host + 'search?q=bag:' + encodeURIComponent(space)
+ '_public%20OR%20bag:' + encodeURIComponent(space)
+ '_private',
success: displayChanges
});
checkHash();
}
/*
* Start up, establishing if the current user has the power to edit.
*/
function init() {
$.ajaxSetup({
beforeSend: function(xhr) {
xhr.setRequestHeader("X-ControlView", "false");
}
});
var recipe = tiddlyweb.status.space.recipe;
if (recipe.match(/_private$/)) {
changes();
} else {
guestPage();
}
}
function adler32(a){for(var b=65521,c=1,d=0,e=0,f;f=a.charCodeAt(e++);d=(d+c)%b)c=(c+f)%b;return(d<<16)|c}; // see https://gist.github.com/1200559/1c2b2093a661c4727958ff232cd12de8b8fb9db9
init();
});
@@Please do not modify this tiddler; it was created automatically upon space creation.@@
$(document).ready(function() {
// leave if there's no tiddler to work with
var wholething = $('#text-html.section');
if (wholething.length == 0) return;
var place = $("#container").length > 0 ? $("#container")[0] : document.body;
var space = window.location.host.split(".")[0]
var title = $("#title").text();
var bagInfo = $('.bag').first().text().split(/_/);
// don't show edit link if tiddler is not in this space
if (bagInfo[0] !== space) return;
function addLink() {
$("<a id='editLink' />").attr('href'
, '/edit#' + encodeURIComponent(title))
.text("edit tiddler").prependTo(place);
}
// add edit link if user is member
if (window.tiddlyweb && tiddlyweb.status) {
if (tiddlyweb.status.space.recipe.match(/_private$/)) {
addLink();
}
} else {
$.ajax({ url: "/spaces/" + space + "/members",
success: function(r) {
if(r) {
addLink();
}
}
});
}
});
If transclusion is the process of including content from somewhere else, by reference, then extraclusion is the process whereby content in a document is removed to another location and a reference to it is left in its place. With tiddlers, this is a good way of breaking a large tiddler down into several smaller tiddlers while maintaining the overview.
To engage extraclusion in @edit you use some special syntax that wraps around the content you wish to move to another tiddler:
{{{
.extraclude The Name of the New Tiddler
the content
.extraclude
}}}
Those {{{.extraclude}}} statements are at the beginning of the line.
You can have multiple extraclusions in an edit. When the tiddlers is saved each one will be replaced with
{{{<<tiddler [[The Name of the New Tiddler]]>>}}}
and the new tiddler will be created in the same bag as the current tiddler. If the tiddler already exists it will be overwritten.
If you are editing a Markdown syntax tiddler, then the created tiddlers will also be Markdown and the markup left behind in the original tiddler will be correct Markdown transclusion syntax
{{{{{The Name of the New Tiddler}}}}}
Dickon is <<tag follow>>ing the following people (and he then uses an iframe to capture a ''@tapas - eye - view'' of the activity of people he follows in TiddlySpace at a tiddler he wrote called [[01. My Tiddlyspace Monitor (Tapas)]]):
var user, userbag;
var friends = [];
var host = "http://tiddlyspace.com";
$.ajaxSetup({
beforeSend: function(xhr) {
xhr.setRequestHeader("X-ControlView", "false");
}
});
function printMessage(txt) {
alert(txt);
}
function printError(txt) {
alert(txt);
}
var simpleDate = (function() {
var measures = {
second: 1,
minute: 60,
hour: 3600,
day: 86400,
week: 604800,
month: 2592000,
year: 31536000
};
var chkMultiple = function(amount, type) {
return (amount > 1) ? amount + " " + type + "s":"a " + type;
};
return function(thedate) {
var dateStr, amount,
current = new Date().getTime(),
diff = (current - thedate.getTime()) / 1000; // work with seconds
if(diff > measures.year) {
amount = Math.round(diff/measures.year);
dateStr = "about " + chkMultiple(amount, "year") + " ago";
} else if(diff > measures.month) {
amount = Math.round(diff/measures.month);
//if(typeof amount == "")
dateStr = "about " + chkMultiple(amount, "month") + " ago";
} else if(diff > measures.week) {
amount = Math.round(diff/measures.week);
dateStr = "about " + chkMultiple(amount, "week") + " ago";
} else if(diff > measures.day) {
amount = Math.round(diff/measures.day);
dateStr = "about " + chkMultiple(amount, "day") + " ago";
} else if(diff > measures.hour) {
amount = Math.round(diff/measures.hour);
dateStr = "about " + chkMultiple(amount, "hour") + " ago";
} else if(diff > measures.minute) {
amount = Math.round(diff/measures.minute);
dateStr = "about " + chkMultiple(amount, "minute") + " ago";
} else {
dateStr = "a few seconds ago";
}
return dateStr;
};
})();
function prettyDate(t) {
var date = new Date(Date.UTC(
parseInt(t.substr(0, 4), 10),
parseInt(t.substr(4, 2), 10) - 1,
parseInt(t.substr(6, 2), 10),
parseInt(t.substr(8, 2), 10),
parseInt(t.substr(10, 2), 10),
parseInt(t.substr(12, 2) || "0", 10),
parseInt(t.substr(14, 3) || "0", 10)
));
return simpleDate(date);
}
function endsWith(str, suffix) {
return str.indexOf(suffix) == str.length - suffix.length;
}
function isShadow(tid) {
var shadows = ["MarkupPreHead", "DefaultTiddlers", "PageTemplate", "SideBarTabs",
"GettingStarted", "MainMenu", "SiteTitle", "SiteSubtitle", "ColorPalette",
"SiteIcon", "ViewTemplate", "EditTemplate", "ServerSettings", "MarkupPostHead",
"MarkupPostBody", "MarkupPreBody"];
return tid.title.indexOf("StyleSheet") === 0 ||
tid.title.indexOf("SideBar") === 0 ||
shadows.indexOf(tid.title) > -1 || endsWith(tid.title, "SetupFlag") ? true : false;
}
function isPlugin(tid) {
return tid.tags.indexOf("systemConfig") > -1 ? true : false;
}
function isArtifact(tid) {
var follow = tid.tags.indexOf("follow") > -1;
var type = tid.type;
if(follow || type) {
return true;
} else {
return false;
}
}
function chooseTiddlers(tiddlers) {
var _tiddlers = [];
for(var i = 0; i < tiddlers.length; i++) {
var tid = tiddlers[i];
if(!isPlugin(tid) && !isShadow(tid) && !isArtifact(tid)) {
_tiddlers.push(tid);
}
}
return _tiddlers;
}
function bubbleDown() {
var friends = $(".friend");
friends.css({ position: "relative" });
var target;
friends.each(function(i, el) {
if(!target && $(el).hasClass("silentFriend") &&
$(el).next(".friend").hasClass("noisyFriend")) {
target = el;
}
});
if(target) {
var other = $(target).next(".friend");
// we want to move target above the prev element
// target is an element which has the class noisy and the previous node is quiet
var swapDuration = 50;
var otherHeight = other.height();
var thisHeight = $(target).height();
$(target).animate({ top: + otherHeight }, { duration: swapDuration });
$(other).animate({ top: - thisHeight }, { duration: swapDuration,
complete: function() {
var newTarget = $(target).clone(true).insertAfter(other)[0];
$(target).remove();
$(other).css({ top: 0 });
$(newTarget).css({ top: 0 });
bubbleDown();
}
});
}
}
function renderTiddlerList(container,friend) {
var tidList = $("<ul />").appendTo(container)[0];
$("<li />").text("loading").appendTo(tidList);
var oncompletion = function() {
if($(".errorFriend,.silentFriend,.noisyFriend").length === $(".friend").length) {
bubbleDown();
}
}
$.ajax({ dataType: "json",
url: "/search?q=modifier:" + friend + "&select=modified:>3d&sort=-modified",
error: function() {
$(container).addClass("errorFriend");
oncompletion();
},
success: function(tiddlers) {
$(tidList).empty();
tiddlers = chooseTiddlers(tiddlers);
if(tiddlers.length === 0) {
$(container).addClass("silentFriend");
$("<li />").text("No recent activity.").appendTo(tidList);
oncompletion();
return;
} else {
$(container).addClass("noisyFriend").removeClass("inactiveFriend");
oncompletion();
}
for(var i=0; i < tiddlers.length; i++) {
var tiddler = tiddlers[i];
var item = $("<li />").appendTo(tidList)[0];
var win;
var space = tiddler.bag.split("_")[0];
var spaceUrl = "http://" + space + ".tiddlyspace.com";
var path = "/bags/" + tiddler.bag + "/tiddlers/" + encodeURIComponent(tiddler.title);
var link = $("<a />").text(tiddler.title).
attr("href", spaceUrl + path).
data("path", path).
click(function(ev) {
var win = $(ev.target).data("win");
if($(ev.target).hasClass("active")) {
$(win).toggle(1000);
} else {
$(ev.target).addClass("active");
$(".text", win).text("loading...");
$(win).show();
$.ajax({
url: $(ev.target).data("path"),
data: {
render: "y"
},
dataType: "json",
success: function(tiddler) {
$(".text",win).html(tiddler.render);
$(win).show(1000);
},
error: function() {
$(".text", win).text("error loading that tiddler");
}
});
}
ev.preventDefault();
}).
appendTo(item)[0];
var space = tiddler.bag.split("_")[0];
$("<span />").text(" in ").appendTo(item);
$("<a />").attr("href", spaceUrl).text(space).appendTo(item);
$("<span />").text(" (" + prettyDate(tiddler.modified) + ")").appendTo(item);
win = $("<div />").addClass("tiddler").appendTo(item)[0];
$("<div />").addClass("text").appendTo(win);
var toolbar = $("<div />").addClass("toolbar").appendTo(win)[0];
var extra = $("<div />").addClass("extra").appendTo(win)[0];
$("<button />").data("bag", tiddler.bag).data("title", tiddler.title).text("give feedback").
data("revision", tiddler.revision).click(function(ev) {
var title = $(ev.target).data("title");
var revision = $(ev.target).data("revision");
var bag = $(ev.target).data("bag");
var revisionURL = host + "/bags/" + bag + "/tiddlers/" + encodeURIComponent(title) + "/revisions/" + revision;
var space = bag.split("_")[0];
var area = $(ev.target).parents(".tiddler").children(".extra")[0];
$(area).hide();
$("<textarea />").appendTo(area);
$("<button />").text("save feedback").click(function(ev) {
var tid = new tiddlyweb.Tiddler("Feedback for " + title, userbag);
tid.tags = ["feedback", "@" + space];
tid.text = ["In reply to [[", title, "]]@", space,
" (revision [[", revision, "|", revisionURL, "]])\n\n"].join("") + $("textarea", area).val();
tid.put(function(tiddler) {
$(area).empty();
$("<span />").text("your comment: ").appendTo(area);
$("<a />").attr("href", "/" + encodeURIComponent(tiddler.title)).text(tiddler.title).appendTo(area);
}, function() {
printError("error commenting!");
});
}).appendTo(area);
$(area).show(1000);
ev.preventDefault();
$(ev.target).remove();
return false;
}).appendTo(toolbar);
$(win).hide();
$(link).data("win", win);
}
}
})
}
function removeFriend(friend) {
var tiddler = new tiddlyweb.Tiddler("@" + friend, userbag);
var success = function() {
printMessage("User removed from friends");
var newFriends = [];
for(var i = 0; i < friends.length; i++) {
var f = friends[i];
if(f !== friend) {
newFriends.push(f);
}
}
friends = newFriends;
$("#friend-" + friend).hide(2000);
};
tiddler["delete"](success, function() {
var old = new tiddlyweb.Tiddler(friend, userbag);
old["delete"](success, function() {
printError("Unable to remove friend " + friend);
})
})
}
function renderFriend(list, friend) {
var bag = friend + "_public";
var item = $("<li />").addClass("friend").attr("id", "friend-" + friend).addClass("inactiveFriend").appendTo(list)[0];
$("<img />").attr("alt", friend).attr("title", friend).
attr("src", host + "/bags/" + bag + "/tiddlers/SiteIcon").css({ width: 48, height: 48 }).appendTo(item);
var heading = $("<h2>").appendTo(item)[0];
$("<a />").attr("href", "#friend-" + friend).attr("name", "friend-" + friend).text(friend).appendTo(heading);
$("<button />").data("who", friend).text("remove from friends").
click(function(ev) {
if(confirm("Are you sure you want to remove " + friend + " as a friend?")) {
removeFriend($(ev.target).data("who"));
}
}).appendTo(item)[0];
renderTiddlerList(item,friend);
}
function renderFriends() {
var list = $("<ul />").appendTo("#friends")[0];
$("<li />").text("Activity of your friends will appear below when available").appendTo(list);
for(var i = 0; i < friends.length; i++) {
var friend = friends[i];
renderFriend(list, friend);
}
}
function followWidget() {
$("#friends").empty();
var container = $("<div />").addClass("addfriends").appendTo("#friends")[0];
$("<input />").attr("name", "friend").appendTo(container);
$("<button />").text("add friend").click(function(ev) {
var friend = $(ev.target).parent().children("[name='friend']").val();
if(friends.indexOf(friend) > -1) {
return printError("You already follow " + friend + "!");
}
var title;
if(friend.indexOf("@") !== 0) {
title = "@" + friend;
} else {
title = friend;
}
$.ajax({ dataType: "text", url: "/users/" + friend,
success: function() {
var tid = new tiddlyweb.Tiddler(title, userbag);
tid.tags = ["follow", "excludeLists"];
tid.put(function(tiddler) {
printMessage("Added friend " + friend);
renderFriend($("#friends ul")[0], friend);
window.location.hash = "#friend-" + friend;
}, function() {
printError("Failed to add friend " + friend);
})
},
error: function() {
printError("No one with name " + friend + " exists!");
}
});
}).appendTo(container);
renderFriends();
}
$.ajax({
url: "/status",
dataType: "json",
success: function(status) {
user = status.username;
userbag = new tiddlyweb.Bag(user + "_public", "/");
$.ajax({ url: "/bags/" + user + "_public/tiddlers?select=tag:follow", dataType: "json", success: function(tiddlers) {
for(var i = 0; i < tiddlers.length; i++) {
var title = tiddlers[i].title;
if(title.indexOf("@") === 0) {
title = title.substr(1, title.length);
}
friends.push(title);
}
friends.sort();
followWidget();
}
});
}
})
<html>
<head>
<title>Friends</title>
<style type='text/css'>
ul {
list-style: none;
}
ul .friend {
border-bottom: solid 1px black;
}
ul .friend .tiddler {
margin-left: 10px;
margin-bottom: 30px;
padding: 10px;
border: dotted 2px #CCC;
color: #006100;
}
textarea {
width: 100%;
height: 150px;
}
.friend h2 {
display: inline-block;
}
button {
display: inline-block;
}
.inactiveFriend {
background-color: #ccc;
opacity: 0.1;
}
</style>
<link rel="stylesheet" href="/HtmlCss" type="text/css">
</head>
<body>
<div id="container">
<div id="header">
<h1>Your friends</h1>
</div>
<noscript>
javascript is required to see friend's activity
</noscript>
<div id='friends' class="section">loading...</div>
</div>
<script src="/bags/common/tiddlers/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="/bags/common/tiddlers/jquery-json.js" type="text/javascript" charset="utf-8"></script>
<script src="/bags/tiddlyspace/tiddlers/chrjs" type="text/javascript" charset="utf-8"></script>
<script type='text/javascript' src='/friendjs'></script>
</body>
</html>
@ambit-content is where editors do their editing of manual content.
@ambit-aim is a standalone site that contains the AIM (Adolescent Integrative Measure) which is integrated in the @ambit manual - it is designed to work as a standalone site to complete and export scores for the AIM questionnaire.
@ambit-help is where we store material about tiddlywiki/tiddlyspace.
@ambit-howto is where we store stuff relating to the use of the tiddlymanual as a way of using the wiki format to share evidence-based practice and blend it with local practice-based evidence.
Type the text for list@groupie
@@Please do not modify this tiddler; it was created automatically upon space creation.@@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="218 585 69 54" width="69pt" height="54pt"><metadata xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:date>2010-12-03 11:58Z</dc:date><!-- Produced by OmniGraffle Professional 5.2.3 --></metadata><defs></defs><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><title>Canvas 1</title><g><title>Layer 1</title><path d="M 266.56598 627.5846 C 271.53827 627.25446 276.417 625.1891 280.21747 621.38855 C 288.54193 613.06415 288.54193 599.5677 280.21747 591.24335 C 271.8931 582.91882 258.39667 582.91882 250.07231 591.24335 C 244.07489 597.24072 242.3984 605.92297 245.04286 613.42126 L 258.18323 613.42126 C 258.15912 613.39752 258.13501 613.3737 258.11108 613.34985 C 254.22633 609.4652 254.22633 603.1667 258.11108 599.28204 C 261.99579 595.3974 268.2941 595.3974 272.17877 599.28204 C 276.0635 603.1667 276.0635 609.4652 272.17877 613.34985 C 270.59888 614.9297 268.61966 615.867 266.56598 616.16193 L 266.56598 616.26294 L 235.3027 616.26294 L 235.3027 604.89484 L 218.25 621.9472 L 235.3027 638.99994 L 235.3027 627.631 L 266.56598 627.631 Z" fill="black"/></g></g></svg>
!Update: 28.02.11
>See [[crankiness of social exchange in Tiddlyspace]] for some thoughts
I am still not quite sure about the mechanics of social discourse in TiddlySpace, but I like jon's @flicktiddler a lot and this seems to be getting much closer to what I am after - though the space I may want to flick a tiddler //from// will need to have flicktiddler included, yes?
>In flicktiddler... What about a drop-down menu for some of the commoner sites I might want to flick it to (my home space, or other spaces I am working on?) - save me having to type out the address...
In general it seems important to clarify the mechanics for social discourse across tiddlyspace, at least in those spaces that might flourish with non-technical users; my guess is that such users do not want too much choice and configurability, they want self-explanatory clarity.
Re: the tiddlymanuals (see @ambit) I am after ways for different teams who have customised their own local versions of the core manual to share and collaborate in improving this curated material. Say a browser from one team (call her Janet) is looking at another team's manual - she wants a few choices of what to do:
(a) ''Reply to this'': This would //automatically tag// the tiddler she copies into her space (and edits, by way of comment, improvement, etc) from ~AnotherAuthor with {{{@anotherauthor}}} so that the original writer immediately //knows// that his content has been [[forked]], commented upon, etc (through using the @follow function or similar)
(b) ''Copy this in order to redraft it'' (this would //not// automatically tag Janet's copy of the tiddler as above... she has simply 'absorbed' the tiddler from AnotherAuthor... ready to fork it.) However, Janet would like her version to be instantly distinguishable from material originating from her in view mode - i.e. imported tiddlers a different colour, etc. I find the [@me] addition to the title (in @social) too 'technical' - even the phrase "[This tiddler originates from @BlahBlah]" would improve this...
(c) ''Ideally'' there might be some way by which, //whenever Janet is eventually ready//, a single button press would provide a "notify original author" (thereby adding the tag {{{@anotherauthor}}} (the originator of the tiddler) so as to notify the original author of your recent changes.
The point of these changes is to make what we are doing more //explicit//, rather than //implicit// - see [[How the human capacity for Mentalizing arises]] - it needs to be absolutely clear that "this is my current thinking" and "this is thinking that originates from X"...
@@Please do not modify this tiddler; it was created automatically upon space creation.@@
@@Please do not modify this tiddler; it was created automatically upon space creation.@@
...in which the eponymous irritant absolutely makes his way by 'knowing' (or at least acting as if he does) what is going in the private mental space of his colleagues and the crims. This is precisely, diametrically, the opposite of everything that the mentalization-based therapies are about.
@@Please do not modify this tiddler; it was created automatically upon space creation.@@
/***
|''Name''|tsScanCountPlugin|
|''Description''|Provides ability to count tiddlers at a given tiddlyspace url and display a button that when clicked lists them. Also upgrades tsScan to replace any options containing with $1 with the current space|
|''Version''|0.2.0|
***/
//{{{
(function($) {
var tsScan = config.macros.tsScan;
var tiddlyspace = config.extensions.tiddlyspace;
var macro = config.macros.tsScanCount = {
cache: true,
countCache: {},
handler: function(place, macroName, params, w, paramString, tiddler) {
var container = $("<a href='#' class='button' />").attr("refresh", "macro").attr("macroName", macroName).appendTo(place)[0];
$(container).data("params", paramString);
macro.refresh(container);
},
refresh: function(container) {
var paramString = $(container).data("params");
var options = tsScan.getOptions(paramString, tiddler);
var url = options.url;
options.cache = macro.cache;
options.callback = function(tiddlers) {
options.cache = true;
macro.cache = true;
var count = tiddlers[0] ? tiddlers[0].fields['server.page.revision'] : 0;
var lastCount = macro.countCache[url] || 0;
if(lastCount != count) {
var interval, step = 0;
interval = window.setInterval(function() {
var last = step;
step += 1;
$(container).removeClass("step" + last);
if(step > 10) {
macro.countCache[url] = count;
window.clearInterval(interval);
} else {
$(container).addClass("step" + step);
}
}, 500)
}
$(container).empty().addClass("enabled").text(tiddlers.length).click(function(ev) {
$(ev.target).addClass("active");
var target = options.popupSelector ? $(options.popupSelector)[0] : ev.target;
var p = Popup.create(target, "div");
var container;
if(options.heading) {
container = $("<div />").addClass("heading").appendTo(p)[0];
wikify(store.getTiddlerText(options.heading) || "", container);
}
container = $("<div />").addClass("followTiddlersList").appendTo(p)[0];
tsScan.scan(container, options);
Popup.show();
ev.stopPropagation();
return false;
});
};
tsScan.scan(container, options);
}
}
var _getOptions = tsScan.getOptions;
config.macros.tsScan.getOptions = function(paramString, tiddler) {
var options = _getOptions.apply(this, arguments);
var optionsClone = {};
for(var i in options) {
if(typeof(options[i]) == "string") {
optionsClone[i] = options[i].format(tiddlyspace.currentSpace.name);
} else {
optionsClone[i] = options[i];
}
}
return optionsClone;
}
// every 5 minutes make tsScan update.
window.setInterval(function() {
macro.cache = false;
$("[macroName=tsScanCount]").each(function(i, el) {
macro.refresh(el);
});
}, 1000 * 60 * 5);
})(jQuery);
//}}}
{"tiddlers":{"$:/Acknowledgements":{"title":"$:/Acknowledgements","text":"TiddlyWiki incorporates code from these fine OpenSource projects:\n\n* [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]]\n* [[The Jasmine JavaScript Test Framework|https://jasmine.github.io/]]\n* [[Normalize.css by Nicolas Gallagher|http://necolas.github.io/normalize.css/]]\n\nAnd media from these projects:\n\n* World flag icons from [[Wikipedia|http://commons.wikimedia.org/wiki/Category:SVG_flags_by_country]]\n"},"$:/core/copyright.txt":{"title":"$:/core/copyright.txt","type":"text/plain","text":"TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)\n\nCopyright (c) 2004-2007, Jeremy Ruston\nCopyright (c) 2007-2024, UnaMesa Association\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."},"$:/core/icon":{"title":"$:/core/icon","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> viewBox=\"0 0 128 128\"><path d=\"M64 0l54.56 32v64L64 128 9.44 96V32L64 0zm21.127 95.408c-3.578-.103-5.15-.094-6.974-3.152l-1.42.042c-1.653-.075-.964-.04-2.067-.097-1.844-.07-1.548-1.86-1.873-2.8-.52-3.202.687-6.43.65-9.632-.014-1.14-1.593-5.17-2.157-6.61-1.768.34-3.546.406-5.34.497-4.134-.01-8.24-.527-12.317-1.183-.8 3.35-3.16 8.036-1.21 11.44 2.37 3.52 4.03 4.495 6.61 4.707 2.572.212 3.16 3.18 2.53 4.242-.55.73-1.52.864-2.346 1.04l-1.65.08c-1.296-.046-2.455-.404-3.61-.955-1.93-1.097-3.925-3.383-5.406-5.024.345.658.55 1.938.24 2.53-.878 1.27-4.665 1.26-6.4.47-1.97-.89-6.73-7.162-7.468-11.86 1.96-3.78 4.812-7.07 6.255-11.186-3.146-2.05-4.83-5.384-4.61-9.16l.08-.44c-3.097.59-1.49.37-4.82.628-10.608-.032-19.935-7.37-14.68-18.774.34-.673.664-1.287 1.243-.994.466.237.4 1.18.166 2.227-3.005 13.627 11.67 13.732 20.69 11.21.89-.25 2.67-1.936 3.905-2.495 2.016-.91 4.205-1.282 6.376-1.55 5.4-.63 11.893 2.276 15.19 2.37 3.3.096 7.99-.805 10.87-.615 2.09.098 4.143.483 6.16 1.03 1.306-6.49 1.4-11.27 4.492-12.38 1.814.293 3.213 2.818 4.25 4.167 2.112-.086 4.12.46 6.115 1.066 3.61-.522 6.642-2.593 9.833-4.203-3.234 2.69-3.673 7.075-3.303 11.127.138 2.103-.444 4.386-1.164 6.54-1.348 3.507-3.95 7.204-6.97 7.014-1.14-.036-1.805-.695-2.653-1.4-.164 1.427-.81 2.7-1.434 3.96-1.44 2.797-5.203 4.03-8.687 7.016-3.484 2.985 1.114 13.65 2.23 15.594 1.114 1.94 4.226 2.652 3.02 4.406-.37.58-.936.785-1.54 1.01l-.82.11zm-40.097-8.85l.553.14c.694-.27 2.09.15 2.83.353-1.363-1.31-3.417-3.24-4.897-4.46-.485-1.47-.278-2.96-.174-4.46l.02-.123c-.582 1.205-1.322 2.376-1.72 3.645-.465 1.71 2.07 3.557 3.052 4.615l.336.3z\" fill-rule=\"evenodd\"/></svg>"},"$:/core/images/add-comment":{"title":"$:/core/images/add-comment","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-add-comment tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M56 56H36a8 8 0 100 16h20v20a8 8 0 1016 0V72h20a8 8 0 100-16H72V36a8 8 0 10-16 0v20zm-12.595 58.362c-6.683 7.659-20.297 12.903-36.006 12.903-2.196 0-4.35-.102-6.451-.3 9.652-3.836 17.356-12.24 21.01-22.874C8.516 94.28 0 79.734 0 63.5 0 33.953 28.206 10 63 10s63 23.953 63 53.5S97.794 117 63 117c-6.841 0-13.428-.926-19.595-2.638z\"/></svg>"},"$:/core/images/advanced-search-button":{"title":"$:/core/images/advanced-search-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-advanced-search-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M74.565 87.985A47.776 47.776 0 0148 96C21.49 96 0 74.51 0 48S21.49 0 48 0s48 21.49 48 48c0 9.854-2.97 19.015-8.062 26.636l34.347 34.347a9.443 9.443 0 010 13.36 9.446 9.446 0 01-13.36 0l-34.36-34.358zM48 80c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32z\"/><circle cx=\"48\" cy=\"48\" r=\"8\"/><circle cx=\"28\" cy=\"48\" r=\"8\"/><circle cx=\"68\" cy=\"48\" r=\"8\"/></g></svg>"},"$:/core/images/auto-height":{"title":"$:/core/images/auto-height","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-auto-height tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M67.987 114.356l-.029-14.477a4 4 0 00-2.067-3.494l-15.966-8.813-1.933 7.502H79.9c4.222 0 5.564-5.693 1.786-7.58L49.797 71.572 48.01 79.15h31.982c4.217 0 5.564-5.682 1.795-7.575L49.805 55.517l-1.795 7.575h31.982c4.212 0 5.563-5.67 1.805-7.57l-16.034-8.105 2.195 3.57V35.614l9.214 9.213a4 4 0 105.656-5.656l-16-16a4 4 0 00-5.656 0l-16 16a4 4 0 105.656 5.656l9.13-9.13v15.288a4 4 0 002.195 3.57l16.035 8.106 1.804-7.57H48.01c-4.217 0-5.564 5.682-1.795 7.574l31.982 16.059 1.795-7.575H48.01c-4.222 0-5.564 5.693-1.787 7.579l31.89 15.923 1.787-7.578H47.992c-4.133 0-5.552 5.504-1.933 7.501l15.966 8.813-2.067-3.494.029 14.436-9.159-9.158a4 4 0 00-5.656 5.656l16 16a4 4 0 005.656 0l16-16a4 4 0 10-5.656-5.656l-9.185 9.184zM16 20h96a4 4 0 100-8H16a4 4 0 100 8z\"/></svg>"},"$:/core/images/blank":{"title":"$:/core/images/blank","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-blank tc-image-button\" viewBox=\"0 0 128 128\"/>"},"$:/core/images/bold":{"title":"$:/core/images/bold","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-bold tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M41.146 51.81V21.87h26.353c2.51 0 4.93.21 7.26.628 2.33.418 4.392 1.165 6.185 2.24 1.793 1.076 3.227 2.57 4.302 4.482 1.076 1.913 1.614 4.363 1.614 7.35 0 5.379-1.613 9.263-4.84 11.653-3.227 2.39-7.35 3.586-12.37 3.586H41.146zM13 0v128h62.028a65.45 65.45 0 0016.762-2.151c5.438-1.434 10.278-3.645 14.52-6.633 4.244-2.988 7.62-6.842 10.13-11.563 2.51-4.721 3.764-10.308 3.764-16.762 0-8.008-1.942-14.85-5.826-20.527-3.884-5.677-9.77-9.65-17.658-11.921 5.737-2.75 10.069-6.275 12.997-10.577 2.928-4.303 4.392-9.681 4.392-16.135 0-5.976-.986-10.995-2.958-15.059-1.972-4.063-4.75-7.32-8.336-9.77-3.585-2.45-7.888-4.213-12.907-5.289C84.888.538 79.33 0 73.235 0H13zm28.146 106.129V70.992H71.8c6.095 0 10.995 1.404 14.7 4.212 3.705 2.81 5.558 7.5 5.558 14.073 0 3.347-.568 6.096-1.703 8.247-1.136 2.151-2.66 3.854-4.572 5.11-1.912 1.254-4.123 2.15-6.633 2.688-2.51.538-5.139.807-7.888.807H41.146z\"/></svg>"},"$:/core/images/cancel-button":{"title":"$:/core/images/cancel-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-cancel-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M64 76.314l-16.97 16.97a7.999 7.999 0 01-11.314 0c-3.118-3.118-3.124-8.19 0-11.313L52.686 65l-16.97-16.97a7.999 7.999 0 010-11.314c3.118-3.118 8.19-3.124 11.313 0L64 53.686l16.97-16.97a7.999 7.999 0 0111.314 0c3.118 3.118 3.124 8.19 0 11.313L75.314 65l16.97 16.97a7.999 7.999 0 010 11.314c-3.118 3.118-8.19 3.124-11.313 0L64 76.314zM64 129c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64C28.654 1 0 29.654 0 65c0 35.346 28.654 64 64 64zm0-16c26.51 0 48-21.49 48-48S90.51 17 64 17 16 38.49 16 65s21.49 48 48 48z\"/></svg>"},"$:/core/images/chevron-down":{"title":"$:/core/images/chevron-down","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-chevron-down tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M64.053 85.456a7.889 7.889 0 01-5.6-2.316L2.473 27.16a7.92 7.92 0 010-11.196c3.086-3.085 8.105-3.092 11.196 0L64.05 66.344l50.382-50.382a7.92 7.92 0 0111.195 0c3.085 3.086 3.092 8.105 0 11.196l-55.98 55.98a7.892 7.892 0 01-5.595 2.317z\"/><path d=\"M64.053 124.069a7.889 7.889 0 01-5.6-2.316l-55.98-55.98a7.92 7.92 0 010-11.196c3.086-3.085 8.105-3.092 11.196 0l50.382 50.382 50.382-50.382a7.92 7.92 0 0111.195 0c3.085 3.086 3.092 8.104 0 11.196l-55.98 55.98a7.892 7.892 0 01-5.595 2.316z\"/></g></svg>"},"$:/core/images/chevron-left":{"title":"$:/core/images/chevron-left","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-chevron-left tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M47.544 64.053c0-2.027.77-4.054 2.316-5.6l55.98-55.98a7.92 7.92 0 0111.196 0c3.085 3.086 3.092 8.105 0 11.196L66.656 64.05l50.382 50.382a7.92 7.92 0 010 11.195c-3.086 3.085-8.105 3.092-11.196 0l-55.98-55.98a7.892 7.892 0 01-2.317-5.595z\"/><path d=\"M8.931 64.053c0-2.027.77-4.054 2.316-5.6l55.98-55.98a7.92 7.92 0 0111.196 0c3.085 3.086 3.092 8.105 0 11.196L28.041 64.05l50.382 50.382a7.92 7.92 0 010 11.195c-3.086 3.085-8.104 3.092-11.196 0l-55.98-55.98a7.892 7.892 0 01-2.316-5.595z\"/></g></svg>"},"$:/core/images/chevron-right":{"title":"$:/core/images/chevron-right","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-chevron-right tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M83.456 63.947c0 2.027-.77 4.054-2.316 5.6l-55.98 55.98a7.92 7.92 0 01-11.196 0c-3.085-3.086-3.092-8.105 0-11.196L64.344 63.95 13.963 13.567a7.92 7.92 0 010-11.195c3.086-3.085 8.105-3.092 11.196 0l55.98 55.98a7.892 7.892 0 012.317 5.595z\"/><path d=\"M122.069 63.947c0 2.027-.77 4.054-2.316 5.6l-55.98 55.98a7.92 7.92 0 01-11.196 0c-3.085-3.086-3.092-8.105 0-11.196l50.382-50.382-50.382-50.382a7.92 7.92 0 010-11.195c3.086-3.085 8.104-3.092 11.196 0l55.98 55.98a7.892 7.892 0 012.316 5.595z\"/></g></svg>"},"$:/core/images/chevron-up":{"title":"$:/core/images/chevron-up","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-chevron-up tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M63.947 44.544c2.027 0 4.054.77 5.6 2.316l55.98 55.98a7.92 7.92 0 010 11.196c-3.086 3.085-8.105 3.092-11.196 0L63.95 63.656l-50.382 50.382a7.92 7.92 0 01-11.195 0c-3.085-3.086-3.092-8.105 0-11.196l55.98-55.98a7.892 7.892 0 015.595-2.317z\"/><path d=\"M63.947 5.931c2.027 0 4.054.77 5.6 2.316l55.98 55.98a7.92 7.92 0 010 11.196c-3.086 3.085-8.105 3.092-11.196 0L63.95 25.041 13.567 75.423a7.92 7.92 0 01-11.195 0c-3.085-3.086-3.092-8.104 0-11.196l55.98-55.98a7.892 7.892 0 015.595-2.316z\"/></g></svg>"},"$:/core/images/clone-button":{"title":"$:/core/images/clone-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-clone-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M32.265 96v24.002A7.996 7.996 0 0040.263 128h79.74a7.996 7.996 0 007.997-7.998v-79.74a7.996 7.996 0 00-7.998-7.997H96V48h12.859a2.99 2.99 0 012.994 2.994v57.865a2.99 2.99 0 01-2.994 2.994H50.994A2.99 2.99 0 0148 108.859V96H32.265z\"/><path d=\"M40 56h-7.993C27.588 56 24 52.418 24 48c0-4.41 3.585-8 8.007-8H40v-7.993C40 27.588 43.582 24 48 24c4.41 0 8 3.585 8 8.007V40h7.993C68.412 40 72 43.582 72 48c0 4.41-3.585 8-8.007 8H56v7.993C56 68.412 52.418 72 48 72c-4.41 0-8-3.585-8-8.007V56zM8 0C3.58 0 0 3.588 0 8v80c0 4.419 3.588 8 8 8h80c4.419 0 8-3.588 8-8V8c0-4.419-3.588-8-8-8H8zM19 16A2.997 2.997 0 0016 19.001v57.998A2.997 2.997 0 0019.001 80h57.998A2.997 2.997 0 0080 76.999V19.001A2.997 2.997 0 0076.999 16H19.001z\"/></g></svg>"},"$:/core/images/close-all-button":{"title":"$:/core/images/close-all-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-close-all-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M28 111.314l-14.144 14.143a8 8 0 01-11.313-11.313L16.686 100 2.543 85.856a8 8 0 0111.313-11.313L28 88.686l14.144-14.143a8 8 0 0111.313 11.313L39.314 100l14.143 14.144a8 8 0 01-11.313 11.313L28 111.314zM28 39.314L13.856 53.457A8 8 0 012.543 42.144L16.686 28 2.543 13.856A8 8 0 0113.856 2.543L28 16.686 42.144 2.543a8 8 0 0111.313 11.313L39.314 28l14.143 14.144a8 8 0 01-11.313 11.313L28 39.314zM100 39.314L85.856 53.457a8 8 0 01-11.313-11.313L88.686 28 74.543 13.856A8 8 0 0185.856 2.543L100 16.686l14.144-14.143a8 8 0 0111.313 11.313L111.314 28l14.143 14.144a8 8 0 01-11.313 11.313L100 39.314zM100 111.314l-14.144 14.143a8 8 0 01-11.313-11.313L88.686 100 74.543 85.856a8 8 0 0111.313-11.313L100 88.686l14.144-14.143a8 8 0 0111.313 11.313L111.314 100l14.143 14.144a8 8 0 01-11.313 11.313L100 111.314z\"/></g></svg>"},"$:/core/images/close-button":{"title":"$:/core/images/close-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-close-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M65.086 75.41l-50.113 50.113c-3.121 3.121-8.192 3.126-11.316.002-3.118-3.118-3.123-8.19.002-11.316l50.114-50.114L3.659 13.982C.538 10.86.533 5.79 3.657 2.666c3.118-3.118 8.19-3.123 11.316.002l50.113 50.114L115.2 2.668c3.121-3.121 8.192-3.126 11.316-.002 3.118 3.118 3.123 8.19-.002 11.316L76.4 64.095l50.114 50.114c3.121 3.121 3.126 8.192.002 11.316-3.118 3.118-8.19 3.123-11.316-.002L65.086 75.409z\"/></svg>"},"$:/core/images/close-others-button":{"title":"$:/core/images/close-others-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-close-others-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M64 128c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64C28.654 0 0 28.654 0 64c0 35.346 28.654 64 64 64zm0-16c26.51 0 48-21.49 48-48S90.51 16 64 16 16 37.49 16 64s21.49 48 48 48zm0-16c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32zm0-16c8.837 0 16-7.163 16-16s-7.163-16-16-16-16 7.163-16 16 7.163 16 16 16z\"/></svg>"},"$:/core/images/copy-clipboard":{"title":"$:/core/images/copy-clipboard","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-copy-clipboard tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"33\" height=\"8\" x=\"40\" y=\"40\" rx=\"4\"/><rect width=\"17\" height=\"8\" x=\"40\" y=\"82\" rx=\"4\"/><rect width=\"17\" height=\"8\" x=\"40\" y=\"54\" rx=\"4\"/><rect width=\"33\" height=\"8\" x=\"40\" y=\"96\" rx=\"4\"/><rect width=\"12\" height=\"8\" x=\"40\" y=\"68\" rx=\"4\"/><path d=\"M40 16H24c-4.419 0-8 3.59-8 8a8.031 8.031 0 000 .01v95.98a8.03 8.03 0 000 .01c0 4.41 3.581 8 8 8h80a7.975 7.975 0 005.652-2.34 7.958 7.958 0 002.348-5.652v-16.016c0-4.414-3.582-7.992-8-7.992-4.41 0-8 3.578-8 7.992V112H32V32h64v8.008C96 44.422 99.582 48 104 48c4.41 0 8-3.578 8-7.992V23.992a7.963 7.963 0 00-2.343-5.651A7.995 7.995 0 00104.001 16H88c0-4.41-3.585-8-8.007-8H48.007C43.588 8 40 11.582 40 16zm4-1.004A4.001 4.001 0 0148 11h32c2.21 0 4 1.797 4 3.996v4.008A4.001 4.001 0 0180 23H48c-2.21 0-4-1.797-4-3.996v-4.008z\"/><rect width=\"66\" height=\"16\" x=\"62\" y=\"64\" rx=\"8\"/><path d=\"M84.657 82.343l-16-16v11.314l16-16a8 8 0 10-11.314-11.314l-16 16a8 8 0 000 11.314l16 16a8 8 0 1011.314-11.314z\"/></g></svg>"},"$:/core/images/delete-button":{"title":"$:/core/images/delete-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-delete-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\" transform=\"translate(12)\"><rect width=\"105\" height=\"16\" y=\"11\" rx=\"8\"/><rect width=\"48\" height=\"16\" x=\"28\" rx=\"8\"/><rect width=\"16\" height=\"112\" x=\"8\" y=\"16\" rx=\"8\"/><rect width=\"88\" height=\"16\" x=\"8\" y=\"112\" rx=\"8\"/><rect width=\"16\" height=\"112\" x=\"80\" y=\"16\" rx=\"8\"/><rect width=\"16\" height=\"112\" x=\"56\" y=\"16\" rx=\"8\"/><rect width=\"16\" height=\"112\" x=\"32\" y=\"16\" rx=\"8\"/></g></svg>"},"$:/core/images/discord":{"title":"$:/core/images/discord","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-discord tc-image-button\" viewBox=\"0 -28.5 256 256\"><path d=\"M216.856 16.597A208.502 208.502 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046-19.692-2.961-39.203-2.961-58.533 0-1.832-4.4-4.55-9.933-6.846-14.046a207.809 207.809 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161.094 161.094 0 0 0 79.735 175.3a136.413 136.413 0 0 1-21.846-10.632 108.636 108.636 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a131.66 131.66 0 0 0 5.355 4.237 136.07 136.07 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848 21.142-6.58 42.646-16.637 64.815-33.213 5.316-56.288-9.08-105.09-38.056-148.36ZM85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2c12.867 0 23.236 11.804 23.015 26.2.02 14.375-10.148 26.18-23.015 26.18Zm85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2 0 14.375-10.148 26.18-23.015 26.18Z\"/></svg>"},"$:/core/images/done-button":{"title":"$:/core/images/done-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-done-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M42.26 111.032c-2.051.001-4.103-.78-5.668-2.345L2.662 74.758a8 8 0 01-.005-11.32c3.118-3.117 8.192-3.12 11.32.007l28.278 28.278 72.124-72.124a8.002 8.002 0 0111.314-.001c3.118 3.118 3.124 8.19 0 11.315l-77.78 77.78a7.978 7.978 0 01-5.658 2.343z\"/></svg>"},"$:/core/images/down-arrow":{"title":"$:/core/images/down-arrow","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-down-arrow tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M64.177 100.069a7.889 7.889 0 01-5.6-2.316l-55.98-55.98a7.92 7.92 0 010-11.196c3.086-3.085 8.105-3.092 11.196 0l50.382 50.382 50.382-50.382a7.92 7.92 0 0111.195 0c3.086 3.086 3.092 8.104 0 11.196l-55.98 55.98a7.892 7.892 0 01-5.595 2.316z\"/></svg>"},"$:/core/images/download-button":{"title":"$:/core/images/download-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-download-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M64 128c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64C28.654 0 0 28.654 0 64c0 35.346 28.654 64 64 64zm0-16c26.51 0 48-21.49 48-48S90.51 16 64 16 16 37.49 16 64s21.49 48 48 48z\" class=\"tc-image-download-button-ring\"/><path d=\"M34.35 66.43l26.892 27.205a4.57 4.57 0 006.516 0L94.65 66.43a4.7 4.7 0 000-6.593 4.581 4.581 0 00-3.258-1.365h-8.46c-2.545 0-4.608-2.087-4.608-4.661v-15.15c0-2.575-2.063-4.662-4.608-4.662H55.284c-2.545 0-4.608 2.087-4.608 4.662v15.15c0 2.574-2.063 4.661-4.608 4.661h-8.46c-2.545 0-4.608 2.087-4.608 4.662a4.69 4.69 0 001.35 3.296z\"/></g></svg>"},"$:/core/images/edit-button":{"title":"$:/core/images/edit-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-edit-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M95.627 10.059l-5.656 5.657 11.313 11.313 5.657-5.656-11.314-11.314zm5.657-5.657l1.966-1.966c3.123-3.122 8.194-3.129 11.319-.005 3.117 3.118 3.122 8.192-.005 11.32l-1.966 1.965-11.314-11.314zm-16.97 16.97l-60.25 60.25a8.12 8.12 0 00-.322.342c-.1.087-.198.179-.295.275-5.735 5.735-10.702 22.016-10.702 22.016s16.405-5.09 22.016-10.702c.095-.096.186-.193.272-.292a8.12 8.12 0 00.345-.325l60.25-60.25-11.314-11.313zM35.171 124.19c6.788-.577 13.898-2.272 23.689-5.348 1.825-.573 3.57-1.136 6.336-2.04 16-5.226 21.877-6.807 28.745-7.146 8.358-.413 13.854 2.13 17.58 8.699a4 4 0 006.959-3.946c-5.334-9.406-13.745-13.296-24.933-12.744-7.875.39-14.057 2.052-30.835 7.533-2.739.894-4.46 1.45-6.25 2.012-19.46 6.112-30.77 7.072-39.597 1.747a4 4 0 10-4.132 6.85c6.333 3.82 13.754 5.12 22.438 4.383z\"/></g></svg>"},"$:/core/images/erase":{"title":"$:/core/images/erase","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-erase tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M60.087 127.996l63.015-63.015c6.535-6.535 6.528-17.115-.003-23.646L99.466 17.702c-6.539-6.538-17.117-6.532-23.646-.003L4.898 88.62c-6.535 6.534-6.528 17.115.003 23.646l15.73 15.73h39.456zm-34.95-7.313l-14.324-14.325c-3.267-3.268-3.268-8.564-.008-11.824L46.269 59.07l35.462 35.462-26.15 26.15H25.137z\"/></svg>"},"$:/core/images/excise":{"title":"$:/core/images/excise","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-excise tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M56 107.314l-2.343 2.343a8 8 0 11-11.314-11.314l16-16a8 8 0 0111.314 0l16 16a8 8 0 11-11.314 11.314L72 107.314v14.284c0 3.536-3.582 6.402-8 6.402s-8-2.866-8-6.402v-14.284zM0 40.007C0 35.585 3.59 32 8 32c4.418 0 8 3.588 8 8.007v31.986C16 76.415 12.41 80 8 80c-4.418 0-8-3.588-8-8.007V40.007zm32 0C32 35.585 35.59 32 40 32c4.418 0 8 3.588 8 8.007v31.986C48 76.415 44.41 80 40 80c-4.418 0-8-3.588-8-8.007V40.007zm48 0C80 35.585 83.59 32 88 32c4.418 0 8 3.588 8 8.007v31.986C96 76.415 92.41 80 88 80c-4.418 0-8-3.588-8-8.007V40.007zm-24-32C56 3.585 59.59 0 64 0c4.418 0 8 3.588 8 8.007v31.986C72 44.415 68.41 48 64 48c-4.418 0-8-3.588-8-8.007V8.007zm56 32c0-4.422 3.59-8.007 8-8.007 4.418 0 8 3.588 8 8.007v31.986c0 4.422-3.59 8.007-8 8.007-4.418 0-8-3.588-8-8.007V40.007z\"/></svg>"},"$:/core/images/export-button":{"title":"$:/core/images/export-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-export-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8.003 128H119.993a7.984 7.984 0 005.664-2.349v.007A7.975 7.975 0 00128 120V56c0-4.418-3.59-8-8-8-4.418 0-8 3.58-8 8v56H16V56c0-4.418-3.59-8-8-8-4.418 0-8 3.58-8 8v64c0 4.418 3.59 8 8 8h.003zm48.62-100.689l-8.965 8.966c-3.125 3.125-8.195 3.13-11.319.005-3.118-3.118-3.122-8.192.005-11.319L58.962 2.346A7.986 7.986 0 0164.625 0l-.006.002c2.05-.001 4.102.78 5.666 2.344l22.618 22.617c3.124 3.125 3.129 8.195.005 11.319-3.118 3.118-8.192 3.122-11.319-.005l-8.965-8.966v61.256c0 4.411-3.582 8-8 8-4.41 0-8-3.582-8-8V27.311z\"/></svg>"},"$:/core/images/file":{"title":"$:/core/images/file","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-file tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M111.968 30.5H112V120a8 8 0 01-8 8H24a8 8 0 01-8-8V8a8 8 0 018-8h57v.02a7.978 7.978 0 015.998 2.337l22.627 22.627a7.975 7.975 0 012.343 5.516zM81 8H24v112h80V30.5H89c-4.418 0-8-3.578-8-8V8z\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"36\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"52\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"68\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"84\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"100\" rx=\"4\"/><rect width=\"40\" height=\"8\" x=\"32\" y=\"20\" rx=\"4\"/></svg>"},"$:/core/images/fixed-height":{"title":"$:/core/images/fixed-height","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-fixed-height tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M60 35.657l-9.172 9.171a4 4 0 11-5.656-5.656l16-16a4 4 0 015.656 0l16 16a4 4 0 01-5.656 5.656L68 35.657v57.686l9.172-9.171a4 4 0 115.656 5.656l-16 16a4 4 0 01-5.656 0l-16-16a4 4 0 115.656-5.656L60 93.343V35.657zM16 116h96a4 4 0 100-8H16a4 4 0 100 8zm0-96h96a4 4 0 100-8H16a4 4 0 100 8z\"/></svg>"},"$:/core/images/fold-all-button":{"title":"$:/core/images/fold-all-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-fold-all tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" rx=\"8\"/><rect width=\"128\" height=\"16\" y=\"64\" rx=\"8\"/><path d=\"M64.03 20.004c-2.05 0-4.102.78-5.667 2.344L35.746 44.966c-3.125 3.124-3.13 8.194-.005 11.318 3.118 3.118 8.192 3.122 11.319-.005l16.965-16.965 16.966 16.965c3.124 3.125 8.194 3.13 11.318.005 3.118-3.118 3.122-8.191-.005-11.318L69.687 22.348a7.986 7.986 0 00-5.663-2.346zM64.03 85.002c-2.05-.001-4.102.78-5.667 2.344l-22.617 22.617c-3.125 3.125-3.13 8.195-.005 11.319 3.118 3.118 8.192 3.122 11.319-.005l16.965-16.966 16.966 16.966c3.124 3.125 8.194 3.13 11.318.005 3.118-3.118 3.122-8.192-.005-11.319L69.687 87.346A7.986 7.986 0 0064.024 85z\"/></g></svg>"},"$:/core/images/fold-button":{"title":"$:/core/images/fold-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-fold tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" rx=\"8\"/><path d=\"M64.03 25.004c-2.05 0-4.102.78-5.667 2.344L35.746 49.966c-3.125 3.124-3.13 8.194-.005 11.318 3.118 3.118 8.192 3.122 11.319-.005l16.965-16.965 16.966 16.965c3.124 3.125 8.194 3.13 11.318.005 3.118-3.118 3.122-8.191-.005-11.318L69.687 27.348a7.986 7.986 0 00-5.663-2.346zM64.005 67.379c-2.05 0-4.102.78-5.666 2.344L35.722 92.34c-3.125 3.125-3.13 8.195-.006 11.32 3.118 3.117 8.192 3.121 11.32-.006L64 86.69l16.965 16.965c3.125 3.125 8.195 3.13 11.319.005 3.118-3.118 3.122-8.192-.005-11.319L69.663 69.723A7.986 7.986 0 0064 67.377z\"/></g></svg>"},"$:/core/images/fold-others-button":{"title":"$:/core/images/fold-others-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-fold-others tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" y=\"56.031\" rx=\"8\"/><path d=\"M86.632 79.976c-2.05 0-4.102.78-5.666 2.345L64 99.286 47.034 82.321a7.986 7.986 0 00-5.662-2.346l.005.001c-2.05 0-4.102.78-5.666 2.345l-22.618 22.617c-3.124 3.125-3.129 8.195-.005 11.319 3.118 3.118 8.192 3.122 11.319-.005l16.966-16.966 16.965 16.966a7.986 7.986 0 005.663 2.346l-.005-.002c2.05 0 4.102-.78 5.666-2.344l16.965-16.966 16.966 16.966c3.125 3.124 8.194 3.129 11.319.005 3.118-3.118 3.122-8.192-.005-11.319L92.289 82.321a7.986 7.986 0 00-5.663-2.346zM86.7 48.024c-2.05 0-4.102-.78-5.666-2.345L64.07 28.714 47.103 45.679a7.986 7.986 0 01-5.663 2.346l.005-.001c-2.05 0-4.101-.78-5.666-2.345L13.162 23.062c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.192-3.122 11.319.005L41.44 28.714l16.966-16.966a7.986 7.986 0 015.662-2.346l-.005.002c2.05 0 4.102.78 5.666 2.344l16.966 16.966 16.966-16.966c3.124-3.124 8.194-3.129 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319L92.358 45.679a7.986 7.986 0 01-5.663 2.346z\"/></g></svg>"},"$:/core/images/folder":{"title":"$:/core/images/folder","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-folder tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M55.694 128H8C3.58 128 0 124.414 0 119.996V48.004C0 43.584 3.584 40 7.999 40H16v-8c0-4.418 3.578-8 8-8h32a8 8 0 018 8v8h40.001c4.418 0 7.999 3.586 7.999 8.004V59.83l-8-.082v-7.749A4 4 0 0099.997 48H56V36c0-2.21-1.793-4-4.004-4H28.004A4 4 0 0024 36v12H12.003A4 4 0 008 52v64a4 4 0 004.003 4h46.76l-3.069 8z\"/><path d=\"M23.873 55.5h96.003c4.417 0 7.004 4.053 5.774 9.063l-13.344 54.374c-1.228 5.005-5.808 9.063-10.223 9.063H6.08c-4.417 0-7.003-4.053-5.774-9.063L13.65 64.563c1.228-5.005 5.808-9.063 10.223-9.063zm1.78 8.5h87.994c2.211 0 3.504 2.093 2.891 4.666l-11.12 46.668c-.614 2.577-2.902 4.666-5.115 4.666H12.31c-2.211 0-3.504-2.093-2.891-4.666l11.12-46.668C21.152 66.09 23.44 64 25.653 64z\"/></g></svg>"},"$:/core/images/full-screen-button":{"title":"$:/core/images/full-screen-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-full-screen-button tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M0 8a8 8 0 018-8h32a8 8 0 110 16H16v24a8 8 0 11-16 0V8zM128 120a8 8 0 01-8 8H88a8 8 0 110-16h24V88a8 8 0 1116 0v32zM8 128a8 8 0 01-8-8V88a8 8 0 1116 0v24h24a8 8 0 110 16H8zM120 0a8 8 0 018 8v32a8 8 0 11-16 0V16H88a8 8 0 110-16h32z\"/></svg>"},"$:/core/images/github":{"title":"$:/core/images/github","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-github tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M63.938 1.607c-35.336 0-63.994 28.69-63.994 64.084 0 28.312 18.336 52.329 43.768 60.802 3.202.59 4.37-1.388 4.37-3.088 0-1.518-.056-5.55-.087-10.897-17.802 3.871-21.558-8.591-21.558-8.591-2.911-7.404-7.108-9.375-7.108-9.375-5.81-3.973.44-3.895.44-3.895 6.424.453 9.803 6.606 9.803 6.606 5.709 9.791 14.981 6.963 18.627 5.322.582-4.138 2.236-6.963 4.063-8.564-14.211-1.617-29.153-7.117-29.153-31.672 0-6.995 2.495-12.718 6.589-17.195-.66-1.621-2.856-8.14.629-16.96 0 0 5.37-1.722 17.597 6.57 5.104-1.424 10.58-2.132 16.022-2.16 5.438.028 10.91.736 16.022 2.16 12.22-8.292 17.582-6.57 17.582-6.57 3.493 8.82 1.297 15.339.64 16.96 4.102 4.477 6.578 10.2 6.578 17.195 0 24.618-14.966 30.035-29.22 31.62 2.295 1.98 4.342 5.89 4.342 11.87 0 8.564-.079 15.476-.079 17.576 0 1.715 1.155 3.71 4.4 3.084 25.413-8.493 43.733-32.494 43.733-60.798 0-35.394-28.657-64.084-64.006-64.084\"/></svg>"},"$:/core/images/gitter":{"title":"$:/core/images/gitter","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-gitter tc-image-button\" viewBox=\"0 0 18 25\"><path d=\"M15 5h2v10h-2zM10 5h2v20h-2zM5 5h2v20H5zM0 0h2v15H0z\"/></svg>"},"$:/core/images/globe":{"title":"$:/core/images/globe","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-globe tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M72.811 37.128v2.554c0 2.196.978 6.881 0 8.832-1.466 2.928-4.65 3.54-6.394 5.867-1.182 1.577-4.618 10.601-3.69 12.92 3.969 9.922 11.534 3.187 17.962 9.293.864.821 2.887 2.273 3.296 3.296 3.29 8.223-7.576 15.009 3.757 26.3 1.245 1.24 3.813-3.817 4.079-4.614.852-2.563 6.725-5.45 9.088-7.053 2.02-1.37 4.873-2.667 6.328-4.745 2.27-3.244 1.48-7.514 3.098-10.745 2.139-4.274 3.828-9.635 5.998-13.966 3.898-7.781 4.721 2.093 5.067 2.439.358.357 1.011 0 1.517 0 .094 0 1.447.099 1.516 0 .65-.935-1.043-17.92-1.318-19.297-1.404-7.01-6.944-15.781-11.865-20.5-6.274-6.015-7.09-16.197-18.259-14.954-.204.022-5.084 10.148-7.777 13.512-3.728 4.657-2.47-4.153-6.526-4.153-.081 0-1.183-.103-1.253 0-.586.88-1.44 3.896-2.306 4.417-.265.16-1.722-.239-1.846 0-2.243 4.3 8.256 2.212 5.792 7.952-2.352 5.481-6.328-1.997-6.328 8.56M44.467 7.01c9.685 6.13.682 12.198 2.694 16.215 1.655 3.303 4.241 5.395 1.714 9.814-2.063 3.608-6.87 3.966-9.623 6.723-3.04 3.044-5.464 8.94-6.79 12.911-1.617 4.843 14.547 6.866 12.063 11.008-1.386 2.311-6.746 1.466-8.437.198-1.165-.873-3.593-.546-4.417-1.78-2.613-3.915-2.26-8.023-3.625-12.128-.938-2.822-6.313-2.12-7.844-.593-.523.522-.33 1.792-.33 2.505 0 5.285 7.12 3.316 7.12 6.46 0 14.636 3.927 6.534 11.14 11.336 10.036 6.683 7.844 7.303 14.946 14.404 3.673 3.673 7.741 3.686 9.425 9.294 1.602 5.331-9.327 5.339-11.716 7.448-1.123.991-2.813 4.146-4.219 4.615-1.792.598-3.234.496-4.944 1.78-2.427 1.82-3.9 4.932-4.02 4.81-2.148-2.147-3.52-15.479-3.89-18.257-.588-4.42-5.59-5.54-6.986-9.03-1.57-3.927 1.524-9.52-1.129-13.761-6.52-10.424-11.821-14.5-15.35-26.292-.942-3.148 3.342-6.529 4.877-8.833 1.877-2.816 2.662-5.854 4.746-8.635C22.147 24.19 40.855 9.461 43.857 8.635l.61-1.625z\"/><path d=\"M64 126c34.242 0 62-27.758 62-62 0-34.242-27.758-62-62-62C29.758 2 2 29.758 2 64c0 34.242 27.758 62 62 62zm0-6c30.928 0 56-25.072 56-56S94.928 8 64 8 8 33.072 8 64s25.072 56 56 56z\"/></g></svg>"},"$:/core/images/heading-1":{"title":"$:/core/images/heading-1","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-heading-1 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M14 30h13.25v30.104H61.7V30h13.25v75.684H61.7V71.552H27.25v34.132H14V30zm70.335 13.78c2.544 0 5.017-.212 7.42-.636 2.403-.424 4.576-1.13 6.52-2.12 1.942-.99 3.603-2.261 4.981-3.816 1.378-1.555 2.28-3.463 2.703-5.724h9.858v74.2h-13.25V53.32H84.335v-9.54z\"/></svg>"},"$:/core/images/heading-2":{"title":"$:/core/images/heading-2","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-heading-2 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M6 30h13.25v30.104H53.7V30h13.25v75.684H53.7V71.552H19.25v34.132H6V30zm119.52 75.684H74.85c.07-6.148 1.555-11.519 4.452-16.112 2.897-4.593 6.855-8.586 11.872-11.978a133.725 133.725 0 017.526-5.141 59.6 59.6 0 007.208-5.353c2.19-1.908 3.993-3.975 5.406-6.201 1.413-2.226 2.155-4.788 2.226-7.685 0-1.343-.159-2.774-.477-4.293a11.357 11.357 0 00-1.855-4.24c-.919-1.307-2.19-2.403-3.816-3.286-1.625-.883-3.745-1.325-6.36-1.325-2.403 0-4.399.477-5.989 1.431-1.59.954-2.862 2.261-3.816 3.922-.954 1.66-1.66 3.622-2.12 5.883-.46 2.261-.724 4.7-.795 7.314H76.23c0-4.099.548-7.897 1.643-11.395 1.095-3.498 2.738-6.519 4.93-9.063 2.19-2.544 4.857-4.54 8.002-5.989C93.95 30.724 97.606 30 101.775 30c4.523 0 8.303.742 11.342 2.226 3.039 1.484 5.494 3.357 7.367 5.618 1.873 2.261 3.198 4.717 3.975 7.367.777 2.65 1.166 5.176 1.166 7.579 0 2.968-.46 5.653-1.378 8.056a25.942 25.942 0 01-3.71 6.625 37.5 37.5 0 01-5.3 5.565 79.468 79.468 0 01-6.148 4.77 165.627 165.627 0 01-6.36 4.24 94.28 94.28 0 00-5.883 4.028c-1.802 1.343-3.374 2.738-4.717 4.187-1.343 1.449-2.261 2.986-2.756 4.611h36.146v10.812z\"/></svg>"},"$:/core/images/heading-3":{"title":"$:/core/images/heading-3","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-heading-3 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M6 30h13.25v30.104H53.7V30h13.25v75.684H53.7V71.552H19.25v34.132H6V30zm88.885 32.224c1.979.07 3.957-.07 5.936-.424 1.979-.353 3.745-.972 5.3-1.855a10.365 10.365 0 003.763-3.657c.954-1.555 1.431-3.463 1.431-5.724 0-3.18-1.078-5.724-3.233-7.632-2.155-1.908-4.929-2.862-8.32-2.862-2.12 0-3.958.424-5.513 1.272a11.318 11.318 0 00-3.869 3.445c-1.025 1.449-1.784 3.074-2.279 4.876a18.335 18.335 0 00-.636 5.565H75.381c.141-3.604.813-6.943 2.014-10.017 1.201-3.074 2.844-5.742 4.93-8.003 2.084-2.261 4.61-4.028 7.578-5.3C92.871 30.636 96.228 30 99.973 30a29.2 29.2 0 018.533 1.272c2.791.848 5.3 2.085 7.526 3.71s4.01 3.692 5.353 6.201c1.343 2.509 2.014 5.388 2.014 8.639 0 3.745-.848 7.014-2.544 9.805-1.696 2.791-4.346 4.823-7.95 6.095v.212c4.24.848 7.544 2.95 9.911 6.307s3.551 7.438 3.551 12.243c0 3.533-.707 6.696-2.12 9.487a21.538 21.538 0 01-5.724 7.102c-2.403 1.943-5.194 3.445-8.374 4.505-3.18 1.06-6.537 1.59-10.07 1.59-4.31 0-8.074-.618-11.289-1.855s-5.9-2.986-8.056-5.247c-2.155-2.261-3.798-4.982-4.929-8.162-1.13-3.18-1.731-6.713-1.802-10.6h12.084c-.141 4.523.972 8.286 3.34 11.289 2.366 3.003 5.917 4.505 10.652 4.505 4.028 0 7.402-1.148 10.123-3.445 2.72-2.297 4.081-5.565 4.081-9.805 0-2.897-.565-5.194-1.696-6.89a10.97 10.97 0 00-4.452-3.869c-1.837-.883-3.904-1.431-6.2-1.643a58.067 58.067 0 00-7.05-.212v-9.01z\"/></svg>"},"$:/core/images/heading-4":{"title":"$:/core/images/heading-4","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-heading-4 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8 30h13.25v30.104H55.7V30h13.25v75.684H55.7V71.552H21.25v34.132H8V30zm76.59 48.548h22.471V45.9h-.212L84.59 78.548zm43.46 9.54h-9.54v17.596H107.06V88.088h-31.8V76.11l31.8-44.626h11.448v47.064h9.54v9.54z\"/></svg>"},"$:/core/images/heading-5":{"title":"$:/core/images/heading-5","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-heading-5 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M6 30h13.25v30.104H53.7V30h13.25v75.684H53.7V71.552H19.25v34.132H6V30zm77.755 1.484h38.372v10.812H92.765L88.95 61.164l.212.212c1.625-1.837 3.692-3.233 6.201-4.187 2.509-.954 5-1.431 7.473-1.431 3.675 0 6.96.618 9.858 1.855 2.897 1.237 5.335 2.968 7.314 5.194s3.48 4.858 4.505 7.897c1.025 3.039 1.537 6.325 1.537 9.858 0 2.968-.477 6.024-1.43 9.169a25.161 25.161 0 01-4.559 8.586c-2.085 2.58-4.752 4.7-8.003 6.36-3.25 1.66-7.137 2.491-11.66 2.491-3.604 0-6.943-.477-10.017-1.431-3.074-.954-5.777-2.385-8.109-4.293-2.332-1.908-4.187-4.258-5.565-7.049-1.378-2.791-2.138-6.06-2.279-9.805h12.084c.353 4.028 1.731 7.12 4.134 9.275 2.403 2.155 5.583 3.233 9.54 3.233 2.544 0 4.7-.424 6.466-1.272 1.767-.848 3.198-2.014 4.293-3.498 1.095-1.484 1.873-3.215 2.332-5.194.46-1.979.69-4.099.69-6.36 0-2.05-.284-4.01-.849-5.883-.565-1.873-1.413-3.516-2.544-4.929-1.13-1.413-2.597-2.544-4.399-3.392-1.802-.848-3.904-1.272-6.307-1.272-2.544 0-4.929.477-7.155 1.431-2.226.954-3.834 2.738-4.823 5.353H75.805l7.95-40.598z\"/></svg>"},"$:/core/images/heading-6":{"title":"$:/core/images/heading-6","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-heading-6 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M6 30h13.25v30.104H53.7V30h13.25v75.684H53.7V71.552H19.25v34.132H6V30zm106.587 20.246c-.283-3.039-1.36-5.494-3.233-7.367-1.873-1.873-4.399-2.809-7.579-2.809-2.19 0-4.08.406-5.67 1.219a12.435 12.435 0 00-4.029 3.233c-1.095 1.343-1.979 2.88-2.65 4.611a37.696 37.696 0 00-1.643 5.459 46.08 46.08 0 00-.9 5.671 722.213 722.213 0 00-.478 5.247l.212.212c1.625-2.968 3.87-5.176 6.731-6.625 2.862-1.449 5.954-2.173 9.275-2.173 3.675 0 6.96.636 9.858 1.908 2.897 1.272 5.353 3.021 7.367 5.247 2.014 2.226 3.551 4.858 4.611 7.897 1.06 3.039 1.59 6.325 1.59 9.858 0 3.604-.583 6.943-1.749 10.017-1.166 3.074-2.844 5.76-5.035 8.056-2.19 2.297-4.805 4.081-7.844 5.353-3.039 1.272-6.395 1.908-10.07 1.908-5.441 0-9.91-1.007-13.409-3.021-3.498-2.014-6.254-4.77-8.268-8.268-2.014-3.498-3.41-7.597-4.187-12.296-.777-4.7-1.166-9.77-1.166-15.211 0-4.452.477-8.94 1.431-13.462.954-4.523 2.526-8.639 4.717-12.349 2.19-3.71 5.07-6.731 8.64-9.063C92.676 31.166 97.075 30 102.304 30c2.968 0 5.76.495 8.374 1.484 2.615.99 4.93 2.367 6.943 4.134 2.014 1.767 3.657 3.887 4.93 6.36 1.271 2.473 1.978 5.23 2.12 8.268h-12.085zm-11.66 46.852c2.19 0 4.099-.442 5.724-1.325a12.869 12.869 0 004.081-3.445c1.095-1.413 1.908-3.056 2.438-4.929.53-1.873.795-3.798.795-5.777s-.265-3.887-.795-5.724c-.53-1.837-1.343-3.445-2.438-4.823-1.095-1.378-2.456-2.491-4.08-3.339-1.626-.848-3.534-1.272-5.725-1.272-2.19 0-4.116.406-5.777 1.219-1.66.813-3.056 1.908-4.187 3.286-1.13 1.378-1.979 2.986-2.544 4.823-.565 1.837-.848 3.78-.848 5.83 0 2.05.283 3.993.848 5.83.565 1.837 1.413 3.48 2.544 4.929a12.39 12.39 0 004.187 3.445c1.66.848 3.586 1.272 5.777 1.272z\"/></svg>"},"$:/core/images/help":{"title":"$:/core/images/help","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-help tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M36.055 111.441c-5.24 4.396-15.168 7.362-26.555 7.362-1.635 0-3.24-.06-4.806-.179 7.919-2.64 14.062-8.6 16.367-16.014C8.747 92.845 1.05 78.936 1.05 63.5c0-29.547 28.206-53.5 63-53.5s63 23.953 63 53.5-28.206 53.5-63 53.5c-10.055 0-19.56-2-27.994-5.559zm35.35-33.843a536.471 536.471 0 00.018-4.682 199.02 199.02 0 00-.023-3.042c.008-1.357.595-2.087 3.727-4.235.112-.077 1.085-.74 1.386-.948 3.093-2.133 5.022-3.786 6.762-6.187 2.34-3.228 3.558-7.077 3.558-11.649 0-13.292-9.86-21.952-21.455-21.952-11.103 0-22.499 9.609-24.066 22.295a6.023 6.023 0 1011.956 1.477c.806-6.527 6.972-11.726 12.11-11.726 5.265 0 9.408 3.64 9.408 9.906 0 3.634-1.1 5.153-5.111 7.919l-1.362.93c-2.682 1.84-4.227 3.1-5.7 4.931-2.109 2.62-3.242 5.717-3.258 9.314.013.892.02 1.86.022 2.981a470.766 470.766 0 01-.022 4.943 6.023 6.023 0 1012.046.12l.003-.395zm-6.027 24.499a7.529 7.529 0 100-15.058 7.529 7.529 0 000 15.058z\"/></svg>"},"$:/core/images/home-button":{"title":"$:/core/images/home-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-home-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M112.985 119.502c.01-.165.015-.331.015-.499V67.568c3.137 2.948 8.076 2.884 11.134-.174a7.999 7.999 0 00-.002-11.316L70.396 2.343A7.978 7.978 0 0064.734 0a7.957 7.957 0 00-5.656 2.343L33 28.42V8.007C33 3.585 29.41 0 25 0c-4.418 0-8 3.59-8 8.007V44.42L5.342 56.078c-3.125 3.125-3.12 8.198-.002 11.316a7.999 7.999 0 0011.316-.003l.344-.343v52.945a8.11 8.11 0 000 .007c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8a8.11 8.11 0 00-.015-.498zM97 112V51.574L64.737 19.31 33 51.048V112h64z\"/></svg>"},"$:/core/images/import-button":{"title":"$:/core/images/import-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-import-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M114.832 60.436s3.235-3.27 6.921.417c3.686 3.686.231 7.14.231 7.14l-42.153 42.92s-30.765 32.367-58.798 4.333C-7 87.213 24.59 55.623 24.59 55.623L67.363 12.85s22.725-24.6 43.587-3.738c20.862 20.862-3.96 43.09-3.96 43.09l-35.04 35.04S49.903 112.546 36.426 99.07c-13.476-13.477 11.83-35.523 11.83-35.523l35.04-35.04s3.902-3.902 7.78-.023c3.879 3.878.118 7.921.118 7.921l-35.04 35.04s-13.212 13.212-8.872 17.551c4.34 4.34 16.77-9.653 16.77-9.653l35.04-35.04s16.668-14.598 3.966-27.3c-13.893-13.892-27.565 3.702-27.565 3.702l-42.91 42.91s-23.698 23.698-3.658 43.738 43.012-4.385 43.012-4.385l42.895-42.533z\"/></svg>"},"$:/core/images/info-button":{"title":"$:/core/images/info-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-info-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\" transform=\"translate(.05)\"><path d=\"M64 128c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64C28.654 0 0 28.654 0 64c0 35.346 28.654 64 64 64zm0-16c26.51 0 48-21.49 48-48S90.51 16 64 16 16 37.49 16 64s21.49 48 48 48z\"/><circle cx=\"64\" cy=\"32\" r=\"8\"/><rect width=\"16\" height=\"56\" x=\"56\" y=\"48\" rx=\"8\"/></g></svg>"},"$:/core/images/input-button":{"title":"$:/core/images/input-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-input-button tc-image-button\" viewBox=\"0 0 22 22\"><path d=\"M1.375 22h19.249c.365 0 .716-.145.973-.404v.001c.258-.257.404-.607.403-.972v-11a1.376 1.376 0 0 0-2.75 0v9.625H2.75V9.625a1.376 1.376 0 0 0-2.75 0v11C0 21.384.617 22 1.375 22Z\"/><path d=\"m9.732 11.904-1.541-1.541a1.375 1.375 0 1 0-1.944 1.944l3.887 3.888c.258.258.608.402.973.402h-.001c.353 0 .705-.134.974-.402l3.888-3.889a1.376 1.376 0 0 0 .001-1.944 1.377 1.377 0 0 0-1.946 0l-1.541 1.542V1.376a1.375 1.375 0 1 0-2.75 0v10.528Z\"/></svg>"},"$:/core/images/italic":{"title":"$:/core/images/italic","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-italic tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M66.711 0h22.41L62.408 128H40z\"/></svg>"},"$:/core/images/layout-button":{"title":"$:/core/images/layout-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-layout-button tc-image-button\" viewBox=\"0 0 24 24\" stroke-width=\"1\" stroke=\"none\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><rect x=\"2\" y=\"2\" width=\"7\" height=\"7\" rx=\"2\"/><rect x=\"2\" y=\"13\" width=\"7\" height=\"9\" rx=\"2\"/><rect x=\"12\" y=\"2\" width=\"10\" height=\"20\" rx=\"2\"/></svg>"},"$:/core/images/left-arrow":{"title":"$:/core/images/left-arrow","created":"20150315234410875","modified":"20150315235324760","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-left-arrow tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M0 64.177c0-2.026.771-4.054 2.317-5.6l55.98-55.98a7.92 7.92 0 0111.195.001c3.086 3.085 3.092 8.104.001 11.195L19.111 64.175l50.382 50.382a7.92 7.92 0 010 11.195c-3.086 3.086-8.105 3.092-11.196.001l-55.98-55.98A7.892 7.892 0 010 64.177z\"/></svg>"},"$:/core/images/line-width":{"title":"$:/core/images/line-width","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-line-width tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M16 18h96a2 2 0 000-4H16a2 2 0 100 4zm0 17h96a4 4 0 100-8H16a4 4 0 100 8zm0 21h96a6 6 0 000-12H16a6 6 0 100 12zm0 29h96c5.523 0 10-4.477 10-10s-4.477-10-10-10H16c-5.523 0-10 4.477-10 10s4.477 10 10 10zm0 43h96c8.837 0 16-7.163 16-16s-7.163-16-16-16H16c-8.837 0-16 7.163-16 16s7.163 16 16 16z\"/></svg>"},"$:/core/images/link":{"title":"$:/core/images/link","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-link tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M42.263 69.38a31.919 31.919 0 006.841 10.13c12.5 12.5 32.758 12.496 45.255 0l22.627-22.628c12.502-12.501 12.497-32.758 0-45.255-12.5-12.5-32.758-12.496-45.254 0L49.104 34.255a32.333 32.333 0 00-2.666 3.019 36.156 36.156 0 0121.94.334l14.663-14.663c6.25-6.25 16.382-6.254 22.632-.004 6.248 6.249 6.254 16.373-.004 22.631l-22.62 22.62c-6.25 6.25-16.381 6.254-22.631.004a15.93 15.93 0 01-4.428-8.433 11.948 11.948 0 00-7.59 3.48l-6.137 6.137z\"/><path d=\"M86.35 59.234a31.919 31.919 0 00-6.84-10.13c-12.5-12.5-32.758-12.497-45.255 0L11.627 71.732c-12.501 12.5-12.496 32.758 0 45.254 12.5 12.5 32.758 12.497 45.255 0L79.51 94.36a32.333 32.333 0 002.665-3.02 36.156 36.156 0 01-21.94-.333l-14.663 14.663c-6.25 6.25-16.381 6.253-22.63.004-6.25-6.249-6.255-16.374.003-22.632l22.62-22.62c6.25-6.25 16.381-6.253 22.631-.003a15.93 15.93 0 014.428 8.432 11.948 11.948 0 007.59-3.48l6.137-6.136z\"/></g></svg>"},"$:/core/images/linkify":{"title":"$:/core/images/linkify","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-linkify-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M17.031 31.919H9.048V96.85h7.983v6.92H0V25h17.031v6.919zm24.66 0h-7.983V96.85h7.983v6.92H24.66V25h17.03v6.919zM67.77 56.422l11.975-3.903 2.306 7.096-12.063 3.903 7.628 10.379-6.12 4.435-7.63-10.467-7.45 10.2-5.943-4.523L58.1 63.518 45.95 59.35l2.306-7.096 12.064 4.17V43.825h7.45v12.596zM86.31 96.85h7.982V31.92H86.31V25h17.031v78.77H86.31v-6.92zm24.659 0h7.983V31.92h-7.983V25H128v78.77h-17.031v-6.92z\"/></svg>"},"$:/core/images/list-bullet":{"title":"$:/core/images/list-bullet","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-list-bullet tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M11.636 40.273c6.427 0 11.637-5.21 11.637-11.637C23.273 22.21 18.063 17 11.636 17 5.21 17 0 22.21 0 28.636c0 6.427 5.21 11.637 11.636 11.637zm0 34.909c6.427 0 11.637-5.21 11.637-11.637 0-6.426-5.21-11.636-11.637-11.636C5.21 51.91 0 57.12 0 63.545c0 6.427 5.21 11.637 11.636 11.637zm0 34.909c6.427 0 11.637-5.21 11.637-11.636 0-6.427-5.21-11.637-11.637-11.637C5.21 86.818 0 92.028 0 98.455c0 6.426 5.21 11.636 11.636 11.636zM34.91 22.818H128v11.637H34.91V22.818zm0 34.91H128v11.636H34.91V57.727zm0 34.908H128v11.637H34.91V92.636z\"/></svg>"},"$:/core/images/list-number":{"title":"$:/core/images/list-number","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-list-number tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M33.84 22.356H128v11.77H33.84v-11.77zm0 35.31H128v11.77H33.84v-11.77zm0 35.311H128v11.77H33.84v-11.77zM.38 42.631v-2.223h.998c.826 0 1.445-.14 1.858-.42.413-.28.619-.948.619-2.002V22.769c0-1.442-.193-2.336-.58-2.683-.385-.347-1.477-.52-3.275-.52v-2.143c3.502-.147 6.252-.955 8.25-2.423h2.117v22.865c0 .921.15 1.575.449 1.963.3.387.949.58 1.948.58h.998v2.223H.38zm-.3 35.356v-1.902c7.19-6.554 10.786-12.58 10.786-18.08 0-1.562-.326-2.81-.979-3.744-.652-.934-1.524-1.402-2.616-1.402-.893 0-1.655.317-2.287.952-.633.634-.95 1.364-.95 2.192 0 .974.247 1.829.74 2.563.106.16.16.28.16.36 0 .147-.16.28-.48.4-.213.08-.752.308-1.618.681-.839.374-1.358.561-1.558.561-.24 0-.512-.37-.819-1.111A6.2 6.2 0 010 57.064c0-1.949.849-3.544 2.547-4.785 1.698-1.242 3.798-1.862 6.302-1.862 2.463 0 4.53.67 6.202 2.012 1.67 1.341 2.506 3.093 2.506 5.256a8.644 8.644 0 01-.849 3.724c-.566 1.201-1.92 3.053-4.064 5.556a165.471 165.471 0 01-6.272 6.938h11.445l-1.019 5.726h-2.117c.08-.28.12-.534.12-.76 0-.388-.1-.631-.3-.731-.2-.1-.599-.15-1.198-.15H.08zm12.124 19.207c1.745.04 3.236.637 4.474 1.792 1.239 1.154 1.858 2.773 1.858 4.855 0 2.99-1.132 5.393-3.396 7.208-2.263 1.815-5 2.723-8.209 2.723-2.01 0-3.669-.384-4.974-1.151C.652 111.853 0 110.849 0 109.607c0-.774.27-1.398.809-1.872.54-.474 1.128-.71 1.768-.71.639 0 1.162.2 1.568.6.406.4.782 1.055 1.128 1.962.466 1.268 1.239 1.902 2.317 1.902 1.265 0 2.287-.477 3.066-1.431.78-.955 1.169-2.686 1.169-5.196 0-1.709-.12-3.023-.36-3.944-.24-.921-.792-1.382-1.658-1.382-.586 0-1.185.307-1.797.921-.493.494-.932.741-1.319.741-.333 0-.602-.147-.809-.44-.206-.294-.31-.574-.31-.841 0-.32.104-.594.31-.821.207-.227.69-.594 1.449-1.102 2.876-1.922 4.314-4.017 4.314-6.287 0-1.188-.306-2.092-.919-2.713a3.001 3.001 0 00-2.217-.93c-.799 0-1.525.263-2.177.79-.653.528-.979 1.158-.979 1.892 0 .641.253 1.235.76 1.782.172.2.259.367.259.5 0 .121-.57.428-1.708.922-1.139.494-1.854.74-2.147.74-.413 0-.75-.333-1.009-1-.26-.668-.39-1.282-.39-1.842 0-1.749.93-3.224 2.787-4.425 1.858-1.202 3.965-1.802 6.322-1.802 2.064 0 3.851.447 5.363 1.341 1.511.895 2.267 2.116 2.267 3.664 0 1.362-.57 2.623-1.708 3.784a13.387 13.387 0 01-3.945 2.784z\"/></svg>"},"$:/core/images/list":{"title":"$:/core/images/list","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-list tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M87.748 128H23.999c-4.418 0-7.999-3.59-7.999-8.007V8.007C16 3.585 19.588 0 24 0h80c4.419 0 8 3.59 8 8.007V104H91.25c-.965 0-1.84.392-2.473 1.025a3.476 3.476 0 00-1.029 2.476V128zm8-.12l15.88-15.88h-15.88v15.88zM40 15.508A3.502 3.502 0 0143.5 12h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 20h-55a3.498 3.498 0 01-3.5-3.509v-.982zM32 22a6 6 0 100-12 6 6 0 000 12zm8 9.509A3.502 3.502 0 0143.5 28h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 36h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.502 3.502 0 0143.5 44h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 52h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.502 3.502 0 0143.5 60h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 68h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.502 3.502 0 0143.5 76h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 84h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.502 3.502 0 0143.5 92h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 100h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.505 3.505 0 0143.497 108h33.006A3.497 3.497 0 0180 111.509v.982A3.505 3.505 0 0176.503 116H43.497A3.497 3.497 0 0140 112.491v-.982zM32 38a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12z\"/></svg>"},"$:/core/images/locked-padlock":{"title":"$:/core/images/locked-padlock","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-locked-padlock tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M96.472 64H105v32.01C105 113.674 90.674 128 73.001 128H56C38.318 128 24 113.677 24 96.01V64h8c.003-15.723.303-47.731 32.16-47.731 31.794 0 32.305 32.057 32.312 47.731zm-15.897 0H48.44c.002-16.287.142-32 15.719-32 15.684 0 16.977 16.136 16.415 32zM67.732 92.364A8.503 8.503 0 0064.5 76a8.5 8.5 0 00-3.498 16.25l-5.095 22.77H72.8l-5.07-22.656z\"/></svg>"},"$:/core/images/mail":{"title":"$:/core/images/mail","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-mail tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M122.827 104.894a7.986 7.986 0 01-2.834.516H8.007c-.812 0-1.597-.12-2.335-.345l34.163-34.163 20.842 20.842a3.998 3.998 0 003.418 1.134 4.003 4.003 0 003.395-1.134L88.594 70.64c.075.09.155.176.24.26l33.993 33.994zm5.076-6.237c.064-.406.097-.823.097-1.247v-64c0-.669-.082-1.318-.237-1.94L94.23 65.006c.09.075.177.154.261.239l33.413 33.413zm-127.698.56A8.023 8.023 0 010 97.41v-64c0-.716.094-1.41.271-2.071l33.907 33.906L.205 99.218zM5.93 25.684a8.012 8.012 0 012.078-.273h111.986c.766 0 1.507.108 2.209.308L64.083 83.837 5.93 25.683z\"/></svg>"},"$:/core/images/mastodon":{"title":"$:/core/images/mastodon","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-mastodon tc-image-button\" viewBox=\"0 0 128 128\">\n <path d=\"M112.716,76.735C111.231,85.764 99.411,95.646 85.836,97.561C78.757,98.559 71.787,99.476 64.355,99.073C52.201,98.415 42.61,95.646 42.61,95.646C42.61,97.044 42.683,98.374 42.829,99.619C44.409,113.79 54.723,114.639 64.493,115.035C74.354,115.434 83.134,112.163 83.134,112.163L83.539,122.695C83.539,122.695 76.642,127.071 64.355,127.875C57.58,128.315 49.167,127.674 39.369,124.61C18.118,117.965 14.463,91.202 13.904,64.048C13.733,55.985 13.839,48.383 13.839,42.024C13.839,14.257 29.238,6.118 29.238,6.118C37.002,1.905 50.326,0.134 64.177,-0L64.517,-0C78.369,0.134 91.701,1.905 99.465,6.118C99.465,6.118 114.864,14.257 114.864,42.024C114.864,42.024 115.057,62.511 112.716,76.735ZM96.7,44.179C96.7,37.307 95.219,31.847 92.245,27.807C89.177,23.767 85.16,21.696 80.174,21.696C74.403,21.696 70.034,24.316 67.146,29.556L64.337,35.118L61.529,29.556C58.64,24.316 54.271,21.696 48.501,21.696C43.514,21.696 39.497,23.767 36.43,27.807C33.455,31.847 31.974,37.307 31.974,44.179L31.974,77.8L43.249,77.8L43.249,45.167C43.249,38.288 45.699,34.796 50.599,34.796C56.017,34.796 58.733,38.938 58.733,47.128L58.733,64.99L69.941,64.99L69.941,47.128C69.941,38.938 72.657,34.796 78.075,34.796C82.975,34.796 85.425,38.288 85.425,45.167L85.425,77.8L96.7,77.8L96.7,44.179Z\"/>\n</svg>\n"},"$:/core/images/menu-button":{"title":"$:/core/images/menu-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-menu-button tc-image-button\" viewBox=\"0 0 128 128\"><rect width=\"128\" height=\"16\" y=\"16\" rx=\"8\"/><rect width=\"128\" height=\"16\" y=\"56\" rx=\"8\"/><rect width=\"128\" height=\"16\" y=\"96\" rx=\"8\"/></svg>"},"$:/core/images/minus-button":{"title":"$:/core/images/minus-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-minus-button tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M64 0c35.346 0 64 28.654 64 64 0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64C0 28.654 28.654 0 64 0zm.332 16c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z\"/><rect width=\"80\" height=\"16\" x=\"24\" y=\"56\" rx=\"8\"/></svg>"},"$:/core/images/mono-block":{"title":"$:/core/images/mono-block","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-mono-block tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M23.965 32.967h.357c.755 0 1.328.192 1.72.577.39.384.586.947.586 1.688 0 .824-.206 1.418-.618 1.782-.413.363-1.094.545-2.045.545h-6.31c-.965 0-1.65-.178-2.056-.535-.405-.356-.608-.954-.608-1.792 0-.811.203-1.391.608-1.74.406-.35 1.09-.525 2.055-.525h.734l-.86-2.453H8.471l-.902 2.453h.734c.95 0 1.632.178 2.044.535.413.356.619.933.619 1.73 0 .824-.206 1.418-.619 1.782-.412.363-1.094.545-2.044.545h-5.41c-.964 0-1.649-.182-2.054-.545-.406-.364-.608-.958-.608-1.782 0-.741.195-1.304.587-1.688.391-.385.964-.577 1.719-.577h.356l5.62-15.641H6.835c-.95 0-1.632-.182-2.044-.546-.412-.363-.619-.95-.619-1.76 0-.825.207-1.42.619-1.783.412-.363 1.094-.545 2.044-.545h7.863c1.244 0 2.118.67 2.62 2.013v.063l6.647 18.2zM12.98 17.326l-3.04 8.848h6.08l-3.04-8.848zm22.402 9.372v6.395h3.145c2.223 0 3.788-.245 4.697-.734.908-.49 1.362-1.307 1.362-2.453 0-1.16-.433-1.985-1.3-2.474-.866-.49-2.383-.734-4.55-.734h-3.354zm10.693-2.327c1.524.559 2.642 1.324 3.355 2.295.713.972 1.07 2.212 1.07 3.722 0 1.272-.308 2.432-.923 3.48-.615 1.049-1.496 1.909-2.642 2.58a7.499 7.499 0 01-2.254.849c-.832.174-2.01.262-3.533.262H30.202c-.922 0-1.583-.182-1.981-.545-.399-.364-.598-.958-.598-1.782 0-.741.189-1.304.566-1.688.378-.385.93-.577 1.657-.577h.356V17.326h-.356c-.727 0-1.28-.196-1.657-.587-.377-.392-.566-.965-.566-1.72 0-.81.203-1.401.608-1.771.406-.37 1.062-.556 1.971-.556h9.645c2.95 0 5.19.573 6.72 1.72 1.53 1.145 2.296 2.823 2.296 5.031 0 1.09-.234 2.052-.703 2.883-.468.832-1.163 1.513-2.086 2.045zM35.381 17.2v5.284h2.83c1.72 0 2.932-.203 3.638-.609.706-.405 1.06-1.09 1.06-2.054 0-.909-.319-1.573-.955-1.992-.636-.42-1.667-.63-3.093-.63h-3.48zm35.863-3.816c.28-.503.566-.86.86-1.07.293-.21.664-.314 1.111-.314.685 0 1.17.182 1.457.545.287.364.43.986.43 1.866l.042 5.452c0 .964-.157 1.614-.472 1.95-.314.335-.884.503-1.709.503-.587 0-1.037-.14-1.352-.42-.314-.28-.584-.796-.807-1.551-.364-1.328-.944-2.282-1.74-2.862-.797-.58-1.901-.87-3.313-.87-2.153 0-3.802.727-4.948 2.18-1.147 1.454-1.72 3.558-1.72 6.311 0 2.74.58 4.844 1.74 6.311 1.16 1.468 2.817 2.202 4.97 2.202 1.467 0 3.085-.49 4.854-1.468 1.768-.978 2.883-1.467 3.344-1.467.545 0 1.003.23 1.373.692.37.46.556 1.034.556 1.719 0 1.23-1.084 2.39-3.25 3.48-2.167 1.09-4.606 1.636-7.318 1.636-3.662 0-6.625-1.21-8.89-3.627-2.264-2.419-3.396-5.578-3.396-9.478 0-3.76 1.146-6.884 3.438-9.372 2.293-2.488 5.2-3.732 8.723-3.732.992 0 1.97.112 2.935.335.964.224 1.992.574 3.082 1.049zm10.22 19.583V17.326h-.356c-.755 0-1.328-.196-1.72-.587-.39-.392-.586-.965-.586-1.72 0-.81.21-1.401.629-1.771.42-.37 1.097-.556 2.034-.556h5.178c2.922 0 5.06.126 6.416.377 1.356.252 2.51.671 3.46 1.258 1.691 1.007 2.988 2.443 3.89 4.31.9 1.865 1.352 4.021 1.352 6.467 0 2.586-.514 4.847-1.541 6.783-1.028 1.936-2.485 3.4-4.372 4.393-.853.447-1.852.772-2.998.975-1.147.203-2.852.304-5.116.304h-6.269c-.965 0-1.65-.178-2.055-.535-.406-.356-.608-.954-.608-1.792 0-.741.195-1.304.587-1.688.391-.385.964-.577 1.72-.577h.356zm5.41-15.725v15.725h1.195c2.642 0 4.592-.646 5.85-1.94 1.258-1.292 1.887-3.28 1.887-5.965 0-2.641-.64-4.612-1.918-5.912-1.28-1.3-3.205-1.95-5.777-1.95-.335 0-.59.003-.765.01a7.992 7.992 0 00-.472.032zm35.067-.126h-9.75v5.368h3.69v-.252c0-.797.175-1.39.524-1.782.35-.392.88-.587 1.594-.587.629 0 1.142.178 1.54.534.4.357.598.808.598 1.353 0 .028.007.118.021.272.014.154.021.308.021.462v4.34c0 .936-.167 1.607-.503 2.013-.335.405-.88.608-1.635.608-.713 0-1.251-.19-1.615-.567-.363-.377-.545-.936-.545-1.677v-.377h-3.69v6.269h9.75v-2.495c0-.937.178-1.608.534-2.013.357-.405.94-.608 1.75-.608.798 0 1.367.2 1.71.597.342.399.513 1.073.513 2.024v5.074c0 .755-.146 1.258-.44 1.51-.293.251-.873.377-1.74.377h-17.172c-.923 0-1.583-.182-1.982-.545-.398-.364-.597-.958-.597-1.782 0-.741.189-1.304.566-1.688.377-.385.93-.577 1.656-.577h.357V17.326h-.357c-.712 0-1.261-.2-1.646-.598-.384-.398-.576-.968-.576-1.709 0-.81.203-1.401.608-1.771.405-.37 1.062-.556 1.97-.556h17.173c.853 0 1.43.13 1.73.388.3.258.45.772.45 1.54v4.698c0 .95-.174 1.631-.524 2.044-.35.412-.915.618-1.698.618-.81 0-1.394-.21-1.75-.629-.357-.419-.535-1.097-.535-2.033v-2.202zM19.77 47.641c.267-.504.55-.86.85-1.07.3-.21.675-.314 1.122-.314.685 0 1.17.181 1.457.545.287.363.43.985.43 1.866l.042 5.451c0 .965-.157 1.615-.472 1.95-.314.336-.891.504-1.73.504-.587 0-1.045-.144-1.373-.43-.329-.287-.598-.8-.807-1.541-.378-1.342-.958-2.3-1.74-2.873-.783-.573-1.88-.86-3.292-.86-2.153 0-3.799.727-4.938 2.181-1.14 1.454-1.709 3.557-1.709 6.311s.598 4.882 1.793 6.385C10.599 67.248 12.294 68 14.488 68c.503 0 1.077-.06 1.72-.179a23.809 23.809 0 002.264-.555v-3.313h-2.37c-.95 0-1.624-.175-2.023-.524-.398-.35-.597-.93-.597-1.74 0-.84.199-1.437.597-1.793.399-.357 1.073-.535 2.024-.535h7.569c.978 0 1.667.175 2.065.524.398.35.598.937.598 1.762 0 .74-.2 1.31-.598 1.708-.398.399-.975.598-1.73.598h-.335v5.242c0 .447-.05.758-.147.933-.098.174-.293.353-.587.534-.797.476-2.062.895-3.795 1.258a25.576 25.576 0 01-5.263.546c-3.662 0-6.625-1.21-8.89-3.628-2.264-2.418-3.397-5.577-3.397-9.477 0-3.76 1.147-6.884 3.44-9.372 2.292-2.488 5.199-3.732 8.721-3.732.979 0 1.954.112 2.925.335.972.224 2.003.573 3.093 1.049zm15.84 3.941v4.823h6.857v-4.823h-.336c-.754 0-1.331-.195-1.73-.587-.398-.391-.597-.964-.597-1.719 0-.825.206-1.419.619-1.782.412-.364 1.093-.545 2.044-.545h5.41c.95 0 1.624.181 2.023.545.398.363.597.957.597 1.782 0 .755-.192 1.328-.576 1.72-.385.39-.947.586-1.688.586h-.357v15.642h.357c.755 0 1.328.192 1.719.576.391.385.587.947.587 1.688 0 .825-.203 1.419-.608 1.782-.405.364-1.09.546-2.055.546h-5.41c-.964 0-1.649-.179-2.054-.535-.405-.357-.608-.954-.608-1.793 0-.74.2-1.303.598-1.688.398-.384.975-.576 1.73-.576h.335v-6.186h-6.856v6.186h.335c.755 0 1.331.192 1.73.576.398.385.597.947.597 1.688 0 .825-.206 1.419-.618 1.782-.412.364-1.094.546-2.044.546h-5.41c-.964 0-1.65-.179-2.055-.535-.405-.357-.608-.954-.608-1.793 0-.74.196-1.303.587-1.688.392-.384.965-.576 1.72-.576h.356V51.582h-.356c-.741 0-1.304-.195-1.688-.587-.385-.391-.577-.964-.577-1.719 0-.825.2-1.419.598-1.782.398-.364 1.073-.545 2.023-.545h5.41c.936 0 1.614.181 2.033.545.42.363.63.957.63 1.782 0 .755-.2 1.328-.598 1.72-.399.39-.975.586-1.73.586h-.335zm31.754 0v15.642h3.523c.95 0 1.632.178 2.044.534.412.357.618.933.618 1.73 0 .811-.21 1.402-.629 1.772-.419.37-1.097.556-2.033.556H58.433c-.95 0-1.632-.182-2.044-.546-.412-.363-.619-.957-.619-1.782 0-.81.203-1.39.608-1.74.406-.35 1.09-.524 2.055-.524h3.523V51.582h-3.523c-.95 0-1.632-.181-2.044-.545-.412-.363-.619-.95-.619-1.761 0-.825.203-1.412.608-1.761.406-.35 1.09-.524 2.055-.524h12.455c.992 0 1.684.174 2.075.524.392.35.587.936.587 1.761 0 .81-.202 1.398-.608 1.761-.405.364-1.09.545-2.054.545h-3.523zm30.496 0v11.994c0 1.873-.122 3.228-.367 4.067a5.876 5.876 0 01-1.227 2.244c-.74.852-1.768 1.495-3.082 1.929-1.314.433-2.893.65-4.738.65-1.3 0-2.555-.126-3.764-.378a16.843 16.843 0 01-3.491-1.132c-.615-.28-1.017-.643-1.206-1.09-.188-.448-.283-1.175-.283-2.18v-4.32c0-1.202.175-2.04.525-2.516.349-.475.957-.713 1.824-.713 1.244 0 1.929.915 2.054 2.747.014.321.035.566.063.733.168 1.622.545 2.73 1.133 3.324.587.594 1.523.89 2.81.89 1.593 0 2.714-.422 3.364-1.268.65-.845.975-2.386.975-4.623V51.582H88.93c-.95 0-1.632-.181-2.044-.545-.413-.363-.619-.95-.619-1.761 0-.825.2-1.412.598-1.761.398-.35 1.086-.524 2.065-.524h10.693c.979 0 1.667.174 2.065.524.399.35.598.936.598 1.761 0 .81-.206 1.398-.619 1.761-.412.364-1.093.545-2.044.545h-1.761zm14.644 0v6.353l6.48-6.478c-.728-.084-1.238-.29-1.531-.619-.294-.328-.44-.85-.44-1.562 0-.825.198-1.419.597-1.782.398-.364 1.073-.545 2.023-.545h5.137c.95 0 1.625.181 2.023.545.399.363.598.957.598 1.782 0 .769-.2 1.345-.598 1.73-.398.384-.982.576-1.75.576h-.483l-6.101 6.06c1.132.839 2.167 1.94 3.103 3.302.937 1.363 2.034 3.456 3.292 6.28h.692c.825 0 1.44.188 1.845.566.405.377.608.943.608 1.698 0 .825-.206 1.419-.619 1.782-.412.364-1.093.546-2.044.546h-2.579c-1.132 0-2.048-.762-2.746-2.286-.126-.28-.224-.503-.294-.67-.923-1.958-1.768-3.467-2.537-4.53a16.616 16.616 0 00-2.705-2.914l-1.97 1.887v3.92h.335c.755 0 1.331.193 1.73.577.398.385.597.947.597 1.688 0 .825-.206 1.419-.618 1.782-.413.364-1.094.546-2.045.546h-5.41c-.964 0-1.649-.179-2.054-.535-.405-.357-.608-.954-.608-1.793 0-.74.196-1.303.587-1.688.391-.384.965-.576 1.72-.576h.356V51.582h-.357c-.74 0-1.303-.195-1.687-.587-.385-.391-.577-.964-.577-1.719 0-.825.2-1.419.598-1.782.398-.364 1.072-.545 2.023-.545h5.41c.936 0 1.614.181 2.033.545.42.363.63.957.63 1.782 0 .755-.2 1.328-.598 1.72-.399.39-.975.586-1.73.586h-.336zM13.44 96.326l4.005-11.889c.251-.782.6-1.352 1.048-1.709.447-.356 1.041-.534 1.782-.534h3.271c.95 0 1.632.182 2.044.545.413.363.619.957.619 1.782 0 .755-.2 1.328-.598 1.72-.398.39-.975.587-1.73.587h-.335l.587 15.641h.357c.754 0 1.32.192 1.698.577.377.384.566.947.566 1.687 0 .825-.2 1.42-.598 1.783-.398.363-1.072.545-2.023.545h-4.718c-.95 0-1.624-.178-2.023-.535-.398-.356-.597-.954-.597-1.793 0-.74.192-1.303.576-1.687.385-.385.954-.577 1.709-.577h.335l-.293-12.79-3.061 9.52c-.224.712-.542 1.226-.954 1.54-.413.315-.982.472-1.709.472-.727 0-1.303-.157-1.73-.472-.426-.314-.751-.828-.975-1.54l-3.04-9.52-.294 12.79h.336c.755 0 1.324.192 1.709.577.384.384.576.947.576 1.687 0 .825-.202 1.42-.608 1.783-.405.363-1.076.545-2.013.545H2.621c-.937 0-1.608-.182-2.013-.545-.405-.364-.608-.958-.608-1.783 0-.74.192-1.303.577-1.687.384-.385.954-.577 1.708-.577h.336l.608-15.641h-.336c-.754 0-1.331-.196-1.73-.588-.398-.39-.597-.964-.597-1.719 0-.825.206-1.419.619-1.782.412-.363 1.093-.545 2.044-.545h3.27c.728 0 1.311.175 1.752.524.44.35.8.923 1.08 1.72l4.109 11.888zm30.454 2.054V86.828H42.74c-.922 0-1.583-.182-1.981-.546-.398-.363-.598-.95-.598-1.76 0-.812.2-1.402.598-1.773.398-.37 1.059-.555 1.981-.555h5.955c.909 0 1.566.185 1.97.555.406.37.609.961.609 1.772 0 .741-.192 1.31-.577 1.709-.384.398-.933.598-1.646.598h-.356v19.038c0 .657-.07 1.069-.21 1.237-.14.167-.454.251-.943.251h-2.097c-.67 0-1.143-.07-1.415-.21-.273-.14-.507-.384-.703-.733l-8.722-15.327v11.385h1.216c.909 0 1.559.175 1.95.524.392.35.587.93.587 1.74 0 .825-.199 1.42-.597 1.783-.399.363-1.045.545-1.94.545h-6.017c-.909 0-1.566-.182-1.971-.545-.406-.364-.608-.958-.608-1.783 0-.74.188-1.303.566-1.687.377-.385.936-.577 1.677-.577h.336V86.828h-.336c-.713 0-1.265-.2-1.656-.598-.392-.398-.587-.968-.587-1.709 0-.81.206-1.401.618-1.772.413-.37 1.066-.555 1.96-.555h3.44c.824 0 1.383.108 1.677.325.293.216.622.653.985 1.31l7.989 14.551zM64.66 86.366c-1.803 0-3.218.727-4.245 2.18-1.028 1.455-1.541 3.474-1.541 6.06 0 2.586.517 4.613 1.551 6.08 1.034 1.468 2.446 2.202 4.235 2.202 1.804 0 3.222-.73 4.257-2.19 1.034-1.461 1.551-3.492 1.551-6.092 0-2.586-.513-4.605-1.54-6.06-1.028-1.453-2.45-2.18-4.268-2.18zm0-4.864c3.44 0 6.27 1.23 8.492 3.69 2.223 2.46 3.334 5.598 3.334 9.414 0 3.844-1.104 6.99-3.313 9.436-2.208 2.446-5.046 3.669-8.513 3.669-3.424 0-6.255-1.234-8.491-3.701-2.237-2.467-3.355-5.602-3.355-9.404 0-3.83 1.108-6.971 3.323-9.424 2.216-2.454 5.057-3.68 8.523-3.68zM87.461 98.17v4.298h2.16c.908 0 1.555.175 1.94.524.384.35.576.93.576 1.74 0 .825-.196 1.42-.587 1.783-.392.363-1.035.545-1.93.545h-7.254c-.922 0-1.583-.182-1.981-.545-.399-.364-.598-.958-.598-1.783 0-.74.189-1.303.566-1.687.378-.385.93-.577 1.657-.577h.356V86.828h-.356c-.713 0-1.262-.2-1.646-.598-.385-.398-.577-.968-.577-1.709 0-.81.203-1.401.608-1.772.406-.37 1.063-.555 1.971-.555h8.66c3.424 0 6.014.657 7.768 1.97 1.754 1.315 2.631 3.25 2.631 5.809 0 2.697-.873 4.738-2.62 6.122-1.748 1.384-4.34 2.076-7.78 2.076h-3.564zm0-11.343v6.625h2.977c1.65 0 2.89-.28 3.722-.839.832-.559 1.248-1.397 1.248-2.516 0-1.048-.43-1.855-1.29-2.421-.86-.566-2.086-.85-3.68-.85h-2.977zm27.267 20.568l-1.636 1.636a12.37 12.37 0 011.772-.44c.58-.098 1.15-.147 1.709-.147 1.104 0 2.268.164 3.491.492 1.223.329 1.967.493 2.233.493.447 0 1.03-.15 1.75-.45.72-.301 1.206-.452 1.458-.452.517 0 .947.2 1.29.598.342.398.513.898.513 1.5 0 .796-.472 1.474-1.415 2.033-.944.56-2.1.839-3.47.839-.937 0-2.139-.22-3.607-.66-1.467-.441-2.53-.661-3.187-.661-.992 0-2.11.272-3.354.817-1.244.546-2.013.818-2.307.818a2.14 2.14 0 01-1.53-.597c-.42-.399-.63-.878-.63-1.437 0-.391.134-.807.4-1.247.265-.44.733-1.01 1.404-1.709l2.118-2.139c-2.335-.852-4.194-2.386-5.578-4.602-1.384-2.215-2.075-4.763-2.075-7.642 0-3.802 1.104-6.909 3.312-9.32 2.209-2.411 5.053-3.617 8.534-3.617 3.467 0 6.304 1.209 8.513 3.627 2.208 2.418 3.312 5.522 3.312 9.31 0 3.774-1.097 6.884-3.291 9.33-2.195 2.446-4.977 3.67-8.345 3.67a22.5 22.5 0 01-1.384-.043zm1.195-21.03c-1.803 0-3.218.727-4.246 2.18-1.027 1.455-1.54 3.474-1.54 6.06 0 2.586.516 4.613 1.55 6.08 1.035 1.468 2.447 2.202 4.236 2.202 1.803 0 3.222-.73 4.256-2.19 1.035-1.461 1.552-3.492 1.552-6.092 0-2.586-.514-4.605-1.541-6.06-1.028-1.453-2.45-2.18-4.267-2.18z\"/></svg>"},"$:/core/images/mono-line":{"title":"$:/core/images/mono-line","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-mono-line tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M60.437 84.523h.908c1.922 0 3.381.489 4.378 1.468.997.979 1.495 2.411 1.495 4.298 0 2.1-.525 3.612-1.575 4.538-1.05.925-2.785 1.388-5.206 1.388h-16.07c-2.456 0-4.2-.454-5.232-1.361-1.032-.908-1.548-2.43-1.548-4.565 0-2.065.516-3.542 1.548-4.432 1.032-.89 2.776-1.334 5.232-1.334h1.869l-2.19-6.247H20.983l-2.296 6.247h1.87c2.42 0 4.155.453 5.205 1.361 1.05.908 1.575 2.376 1.575 4.405 0 2.1-.525 3.612-1.575 4.538-1.05.925-2.785 1.388-5.206 1.388H6.781c-2.456 0-4.2-.463-5.233-1.388C.516 93.9 0 92.389 0 90.289c0-1.887.498-3.32 1.495-4.298.997-.979 2.456-1.468 4.378-1.468h.908l14.308-39.83h-4.271c-2.42 0-4.156-.462-5.206-1.387-1.05-.926-1.575-2.42-1.575-4.485 0-2.1.525-3.613 1.575-4.538 1.05-.926 2.785-1.388 5.206-1.388h20.021c3.168 0 5.392 1.708 6.674 5.125v.16l16.924 46.343zm-27.976-39.83L24.72 67.225h15.483l-7.742-22.53zM89.506 68.56v16.284h8.008c5.66 0 9.646-.623 11.96-1.869 2.313-1.245 3.47-3.328 3.47-6.246 0-2.955-1.103-5.055-3.31-6.3-2.207-1.246-6.069-1.869-11.586-1.869h-8.542zm27.229-5.926c3.88 1.423 6.727 3.372 8.542 5.846 1.815 2.474 2.723 5.633 2.723 9.477 0 3.239-.783 6.193-2.35 8.862-1.565 2.67-3.808 4.859-6.726 6.567-1.709.997-3.622 1.718-5.74 2.163-2.118.445-5.116.667-8.996.667h-27.87c-2.349 0-4.03-.463-5.045-1.388-1.014-.926-1.521-2.438-1.521-4.538 0-1.887.48-3.32 1.441-4.298.961-.979 2.367-1.468 4.218-1.468h.907v-39.83h-.907c-1.851 0-3.257-.498-4.218-1.494-.961-.997-1.441-2.456-1.441-4.378 0-2.065.516-3.568 1.548-4.512 1.032-.943 2.705-1.414 5.018-1.414h24.56c7.51 0 13.214 1.459 17.111 4.377 3.898 2.92 5.847 7.19 5.847 12.814 0 2.776-.597 5.223-1.789 7.341-1.192 2.118-2.963 3.853-5.312 5.206zm-27.23-18.26v13.455h7.208c4.378 0 7.466-.516 9.264-1.549 1.797-1.032 2.696-2.776 2.696-5.232 0-2.313-.81-4.004-2.43-5.072-1.619-1.068-4.244-1.602-7.874-1.602h-8.863z\"/></svg>"},"$:/core/images/network-activity":{"title":"$:/core/images/network-activity","tags":"$:/tags/Image","text":"<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-network-activity tc-image-button\" viewBox=\"0 0 128 128\"><g class={{{ [{$:/state/http-requests}match[0]then[]else[tc-network-activity-background]] }}}>\n<$list filter=\"[{$:/state/http-requests}match[0]]\" variable=\"ignore\">\n<path d=\"M64.043 45.153a4.002 4.002 0 0 1 4.367 2.21l.084.188 30.403 73.4a4 4 0 0 1-7.307 3.25l-.084-.188-3.103-7.49-8.898 8.899a3.985 3.985 0 0 1-2.624 1.166l-.205.005a3.987 3.987 0 0 1-2.828-1.171l-9.849-9.848-9.847 9.848a3.985 3.985 0 0 1-2.624 1.166l-.204.005a3.987 3.987 0 0 1-2.829-1.171l-8.899-8.9-3.102 7.491a4 4 0 1 1-7.391-3.062l30.403-73.4a4.001 4.001 0 0 1 4.495-2.39l.042-.008Zm13.636 56.74-8.023 8.024 7.02 7.019 8.023-8.022-7.02-7.02Zm-27.353.008-7.019 7.019 8.016 8.016 7.019-7.02-8.016-8.015Zm13.68-13.68-8.023 8.023 8.016 8.016 8.023-8.023-8.016-8.016Zm-8.971-8.971-4.687 11.315 8.001-8.001-3.314-3.314Zm17.933.009-3.305 3.305 7.979 7.979-4.674-11.284ZM64 57.607l-5.666 13.68c.096.072.188.15.278.232l.133.126 5.261 5.262 5.262-5.262c.128-.127.261-.244.4-.35L64 57.607Zm0-34.69a8 8 0 1 1 0 16 8 8 0 0 1 0-16Z\"/>\n</$list>\n<$list filter=\"[{$:/state/http-requests}!match[0]]\" variable=\"ignore\">\n<path d=\"M109.395.952a4.002 4.002 0 0 1 3.787 2.708C117.529 11.62 120 20.753 120 30.462c0 15.186-6.044 28.96-15.858 39.047a4 4 0 1 1-6.47-4.626l-.12-.094C106.466 56.074 112 43.914 112 30.462c0-8.492-2.205-16.469-6.074-23.39l.054-.036a4 4 0 0 1 3.415-6.084Zm-90.762 0a4 4 0 0 1 3.072 6.562l.093.06A47.786 47.786 0 0 0 16 30.463c0 13.315 5.42 25.363 14.176 34.058l-.01.007a4 4 0 1 1-6.312 4.863l-.063.05C14.017 59.359 8 45.613 8 30.462c0-9.77 2.502-18.956 6.9-26.952A4.002 4.002 0 0 1 18.634.952Z\"/><path d=\"M64.043 44.698a4.002 4.002 0 0 1 4.367 2.21l.084.188 30.403 73.4a4 4 0 0 1-7.307 3.25l-.084-.188-3.103-7.49-8.898 8.9a3.985 3.985 0 0 1-2.624 1.166l-.205.005a3.987 3.987 0 0 1-2.828-1.172l-9.849-9.848-9.847 9.848a3.985 3.985 0 0 1-2.624 1.167l-.204.005a3.987 3.987 0 0 1-2.829-1.172l-8.899-8.899-3.102 7.49a4 4 0 0 1-7.391-3.061l30.403-73.4a4.001 4.001 0 0 1 4.495-2.39l.042-.009ZM77.68 101.44l-8.023 8.023 7.02 7.019 8.023-8.022-7.02-7.02Zm-27.353.007-7.019 7.019 8.016 8.016 7.019-7.019-8.016-8.016Zm13.68-13.68-8.023 8.023 8.016 8.016 8.023-8.023-8.016-8.016Zm-8.971-8.971L50.348 90.11l8.001-8.001-3.314-3.314Zm17.933.009-3.305 3.305 7.979 7.979-4.674-11.284ZM64 57.152l-5.666 13.68c.096.073.188.15.278.232l.133.127 5.261 5.261 5.262-5.261c.128-.128.261-.244.4-.351L64 57.152ZM38.503 1.058a4 4 0 0 1 2.7 6.952l.17-.175C35.582 13.625 32 21.625 32 30.462c0 8.838 3.582 16.838 9.374 22.629a4 4 0 0 1-5.659 5.658l-.01.01C28.473 51.52 24 41.526 24 30.485 24 19.567 28.374 9.67 35.466 2.453a3.995 3.995 0 0 1 3.037-1.395ZM89.369.952c1.14 0 2.17.478 2.899 1.244l.005-.006C99.518 9.43 104 19.434 104 30.485c0 10.826-4.3 20.648-11.287 27.85a4 4 0 1 1-6.054-5.213l-.032-.032C92.418 47.299 96 39.299 96 30.462c0-8.73-3.496-16.643-9.164-22.416A4 4 0 0 1 89.368.952Zm-39.282 11.14a4 4 0 0 1 2.59 7.048l.01.009A15.95 15.95 0 0 0 48 30.462a15.95 15.95 0 0 0 4.687 11.315l-.01.01a4 4 0 1 1-5.82 5.47l.173.177A23.925 23.925 0 0 1 40 30.462a23.925 23.925 0 0 1 7.03-16.97l.01.01a3.991 3.991 0 0 1 3.047-1.41Zm27.895.07a3.99 3.99 0 0 1 2.984 1.336l.006-.005A23.925 23.925 0 0 1 88 30.463a23.92 23.92 0 0 1-6.707 16.642l-.3.305a4 4 0 1 1-5.679-5.632v-.002A15.95 15.95 0 0 0 80 30.462a15.95 15.95 0 0 0-4.685-11.312 4.012 4.012 0 0 1-1.333-2.987 4 4 0 0 1 4-4ZM64 22.463a8 8 0 1 1 0 16 8 8 0 0 1 0-16Z\"/>\n</$list>\n</g></svg>"},"$:/core/images/new-button":{"title":"$:/core/images/new-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-new-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M56 72H8.007C3.591 72 0 68.418 0 64c0-4.41 3.585-8 8.007-8H56V8.007C56 3.591 59.582 0 64 0c4.41 0 8 3.585 8 8.007V56h47.993c4.416 0 8.007 3.582 8.007 8 0 4.41-3.585 8-8.007 8H72v47.993c0 4.416-3.582 8.007-8 8.007-4.41 0-8-3.585-8-8.007V72z\"/></svg>"},"$:/core/images/new-here-button":{"title":"$:/core/images/new-here-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-new-here-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M55.838 20.935l-3.572.938c-3.688.968-8.23 4.43-10.136 7.731L3.37 96.738c-1.905 3.3-.771 7.524 2.534 9.432l33.717 19.466c3.297 1.904 7.53.78 9.435-2.521l38.76-67.134c1.905-3.3 2.632-8.963 1.623-12.646L83.285 20.88c-1.009-3.68-4.821-5.884-8.513-4.915l-7.603 1.995.043.287c.524 3.394 2.053 7.498 4.18 11.55.418.163.829.36 1.23.59a8.864 8.864 0 014.438 8.169c.104.132.21.264.316.395l-.386.318a8.663 8.663 0 01-1.082 3.137c-2.42 4.192-7.816 5.608-12.051 3.163-4.12-2.379-5.624-7.534-3.476-11.671-2.177-4.394-3.788-8.874-4.543-12.964z\"/><path d=\"M69.554 44.76c-5.944-7.476-10.74-17.196-11.955-25.059-1.68-10.875 3.503-18.216 15.082-18.04 10.407.158 19.975 5.851 24.728 13.785 5.208 8.695 2.95 17.868-6.855 20.496l-2.037-7.601c4.232-1.134 4.999-4.248 2.24-8.853-3.37-5.626-10.465-9.848-18.146-9.965-6.392-.097-8.31 2.62-7.323 9.01.999 6.465 5.318 15.138 10.582 21.65l-.072.06c.559 1.553-4.17 6.44-5.938 4.888l-.005.004-.028-.034a1.323 1.323 0 01-.124-.135 2.618 2.618 0 01-.149-.205z\"/><rect width=\"16\" height=\"48\" x=\"96\" y=\"80\" rx=\"8\"/><rect width=\"48\" height=\"16\" x=\"80\" y=\"96\" rx=\"8\"/></g></svg>"},"$:/core/images/new-image-button":{"title":"$:/core/images/new-image-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-new-image-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M81.362 73.627l15.826-27.41a2.626 2.626 0 00-.962-3.59l-50.01-28.872a2.626 2.626 0 00-3.588.961L30.058 36.49l10.04-5.261c3.042-1.595 6.771.114 7.55 3.46l3.607 17.702 9.88.85a5.25 5.25 0 014.571 3.77c.034.115.1.344.199.671.165.553.353 1.172.562 1.843.595 1.914 1.23 3.85 1.872 5.678.207.588.412 1.156.614 1.701.625 1.685 1.209 3.114 1.725 4.207.255.54.485.977.726 1.427.214.212.547.425 1.011.622 1.141.482 2.784.74 4.657.758.864.008 1.71-.034 2.492-.11.448-.043.753-.085.871-.104.315-.053.625-.077.927-.076zM37.47 2.649A5.257 5.257 0 0144.649.725l63.645 36.746a5.257 5.257 0 011.923 7.178L73.47 108.294a5.257 5.257 0 01-7.177 1.923L2.649 73.47a5.257 5.257 0 01-1.924-7.177L37.471 2.649zm42.837 50.49a5.25 5.25 0 105.25-9.092 5.25 5.25 0 00-5.25 9.093zM96 112h-7.993c-4.419 0-8.007-3.582-8.007-8 0-4.41 3.585-8 8.007-8H96v-7.993C96 83.588 99.582 80 104 80c4.41 0 8 3.585 8 8.007V96h7.993c4.419 0 8.007 3.582 8.007 8 0 4.41-3.585 8-8.007 8H112v7.993c0 4.419-3.582 8.007-8 8.007-4.41 0-8-3.585-8-8.007V112zM33.347 51.791c7.428 7.948 9.01 10.69 7.449 13.394-1.56 2.703-13.838-2.328-16.094 1.58-2.256 3.908-.907 3.258-2.437 5.908l19.73 11.39s-5.605-8.255-4.235-10.628c2.515-4.356 8.77-1.256 10.365-4.019 2.414-4.181-5.103-9.639-14.778-17.625z\"/></svg>"},"$:/core/images/new-journal-button":{"title":"$:/core/images/new-journal-button","tags":"$:/tags/Image","text":"<$parameters size=\"22pt\" day=<<now \"DD\">>><svg width=<<size>> height=<<size>> class=\"tc-image-new-journal-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z\"/><text class=\"tc-fill-background\" font-family=\"Helvetica\" font-size=\"47.172\" font-weight=\"bold\" transform=\"rotate(30 25.742 95.82)\"><tspan x=\"42\" y=\"77.485\" text-anchor=\"middle\"><$text text=<<day>>/></tspan></text></g></svg></$parameters>"},"$:/core/images/opacity":{"title":"$:/core/images/opacity","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-opacity tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M102.362 65a51.595 51.595 0 01-1.942 6H82.584a35.867 35.867 0 002.997-6h16.78zm.472-2c.423-1.961.734-3.963.929-6H87.656a35.78 35.78 0 01-1.368 6h16.546zm-3.249 10a51.847 51.847 0 01-3.135 6H75.812a36.205 36.205 0 005.432-6h18.341zm-4.416 8c-1.424 2.116-3 4.12-4.71 6H60.46a35.843 35.843 0 0012.874-6h21.834zm-7.513-34h16.107C101.247 20.627 79.033 0 52 0 23.281 0 0 23.281 0 52c0 25.228 17.965 46.26 41.8 51h20.4a51.66 51.66 0 0015.875-6H39v-2h42.25a52.257 52.257 0 007.288-6H39v-2h4.539C27.739 83.194 16 68.968 16 52c0-19.882 16.118-36 36-36 18.186 0 33.222 13.484 35.656 31zm.22 2h16.039a52.823 52.823 0 010 6H87.877a36.483 36.483 0 000-6z\"/><path d=\"M76 128c28.719 0 52-23.281 52-52s-23.281-52-52-52-52 23.281-52 52 23.281 52 52 52zm0-16c19.882 0 36-16.118 36-36S95.882 40 76 40 40 56.118 40 76s16.118 36 36 36z\"/><path d=\"M37 58h53v4H37v-4zm3-8h53v4H40v-4zm0-8h53v4H40v-4zm-8 24h53v4H32v-4zm-2 8h53v4H30v-4zm-3 8h53v4H27v-4z\"/></g></svg>"},"$:/core/images/open-window":{"title":"$:/core/images/open-window","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-open-window tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M16 112h88.994c3.87 0 7.006 3.59 7.006 8 0 4.418-3.142 8-7.006 8H7.006C3.136 128 0 124.41 0 120a9.321 9.321 0 010-.01V24.01C0 19.586 3.59 16 8 16c4.418 0 8 3.584 8 8.01V112z\"/><path d=\"M96 43.196V56a8 8 0 1016 0V24c0-4.41-3.585-8-8.007-8H72.007C67.588 16 64 19.582 64 24c0 4.41 3.585 8 8.007 8H84.57l-36.3 36.299a8 8 0 00-.001 11.316c3.117 3.117 8.19 3.123 11.316-.003L96 43.196zM32 7.999C32 3.581 35.588 0 40 0h80c4.419 0 8 3.588 8 8v80c0 4.419-3.588 8-8 8H40c-4.419 0-8-3.588-8-8V8z\"/></g></svg>"},"$:/core/images/options-button":{"title":"$:/core/images/options-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-options-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M110.488 76a47.712 47.712 0 01-5.134 12.384l6.724 6.724c3.123 3.123 3.132 8.192.011 11.313l-5.668 5.668c-3.12 3.12-8.186 3.117-11.313-.01l-6.724-6.725c-3.82 2.258-7.98 4-12.384 5.134v9.505c0 4.417-3.578 8.007-7.992 8.007h-8.016C55.58 128 52 124.415 52 119.993v-9.505a47.712 47.712 0 01-12.384-5.134l-6.724 6.725c-3.123 3.122-8.192 3.131-11.313.01l-5.668-5.668c-3.12-3.12-3.116-8.186.01-11.313l6.725-6.724c-2.257-3.82-4-7.98-5.134-12.384H8.007C3.591 76 0 72.422 0 68.01v-8.017C0 55.58 3.585 52 8.007 52h9.505a47.712 47.712 0 015.134-12.383l-6.724-6.725c-3.123-3.122-3.132-8.191-.011-11.312l5.668-5.669c3.12-3.12 8.186-3.116 11.313.01l6.724 6.725c3.82-2.257 7.98-4 12.384-5.134V8.007C52 3.591 55.578 0 59.992 0h8.016C72.42 0 76 3.585 76 8.007v9.505a47.712 47.712 0 0112.384 5.134l6.724-6.724c3.123-3.123 8.192-3.132 11.313-.01l5.668 5.668c3.12 3.12 3.116 8.186-.01 11.312l-6.725 6.725c2.257 3.82 4 7.979 5.134 12.383h9.505c4.416 0 8.007 3.578 8.007 7.992v8.017c0 4.411-3.585 7.991-8.007 7.991h-9.505zM64 96c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32z\"/></svg>"},"$:/core/images/paint":{"title":"$:/core/images/paint","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-paint tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M83.527 76.19C90.43 69.287 91.892 59 87.91 50.665l37.903-37.902c2.919-2.92 2.913-7.659 0-10.572a7.474 7.474 0 00-10.572 0L77.338 40.093c-8.335-3.982-18.622-2.521-25.526 4.383l31.715 31.715zm-2.643 2.644L49.169 47.119S8.506 81.243 0 80.282c0 0 3.782 5.592 6.827 8.039 14.024-5.69 37.326-24.6 37.326-24.6l.661.66S19.45 90.222 9.18 92.047c1.222 1.44 4.354 4.053 6.247 5.776 5.417-1.488 34.733-28.57 34.733-28.57l.661.66-32.407 31.022 5.285 5.286L56.106 75.2l.662.66s-27.864 30.536-28.684 32.432c0 0 6.032 6.853 7.569 7.824.702-2.836 27.884-33.485 27.884-33.485l.661.66s-20.597 23.755-24.964 36.732c3.21 3.549 7.5 5.137 10.926 6.298-2.19-11.817 30.724-47.487 30.724-47.487z\"/></svg>"},"$:/core/images/palette":{"title":"$:/core/images/palette","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-palette tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M80.247 39.182a93.52 93.52 0 00-16.228-1.4C28.662 37.781 0 57.131 0 81.002c0 9.642 4.676 18.546 12.58 25.735C23.504 91.19 26.34 72.395 36.89 63.562c15.183-12.713 26.538-7.828 26.538-7.828l16.82-16.552zm26.535 9.655c13.049 7.913 21.257 19.392 21.257 32.166 0 9.35.519 17.411-11.874 25.08-10.797 6.681-3.824-6.536-11.844-10.898s-19.946 1.308-18.213 7.906c3.2 12.181 19.422 11.455 6.314 16.658-13.107 5.202-18.202 4.476-28.403 4.476-7.821 0-15.315-.947-22.243-2.68 9.844-4.197 27.88-12.539 33.354-19.456C82.788 92.409 87.37 80 83.324 72.484c-.194-.359 11.215-11.668 23.458-23.647zM1.134 123.867l-.66.002c33.479-14.94 22.161-64.226 58.818-64.226.317 1.418.644 2.944 1.062 4.494-25.907-4.166-23.567 48.031-59.22 59.73zm.713-.007c38.872-.506 78.152-22.347 78.152-44.813-9.27 0-14.073-3.48-16.816-7.942-16.597-7.003-30.365 45.715-61.336 52.755zm65.351-64.008c-4.45 4.115 4.886 16.433 11.318 11.318l45.27-45.27c11.317-11.318 0-22.635-11.318-11.318-11.317 11.318-33.518 34.405-45.27 45.27z\"/></svg>"},"$:/core/images/permalink-button":{"title":"$:/core/images/permalink-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-permalink-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M80.483 48l-7.387 32h-25.58l7.388-32h25.58zm3.694-16l5.624-24.358c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L100.598 32h3.403c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8h-7.096l-7.387 32H104c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8H85.824l-5.624 24.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L69.402 96h-25.58L38.2 120.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L27.402 96h-3.403C19.59 96 16 92.418 16 88c0-4.41 3.581-8 8-8h7.096l7.387-32H24C19.59 48 16 44.418 16 40c0-4.41 3.581-8 8-8h18.177l5.624-24.358c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L58.598 32h25.58z\"/></svg>"},"$:/core/images/permaview-button":{"title":"$:/core/images/permaview-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-permaview-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M81.483 48l-1.846 8h-5.58l1.847-8h5.58zm3.694-16l5.624-24.358c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L101.598 32h2.403c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8h-6.096l-1.847 8h7.944c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8H92.364l-1.846 8H104c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8H86.824l-5.624 24.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L70.402 96h-5.58L59.2 120.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L48.402 96h-5.58L37.2 120.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L26.402 96h-2.403C19.59 96 16 92.418 16 88c0-4.41 3.581-8 8-8h6.096l1.847-8h-7.944C19.59 72 16 68.418 16 64c0-4.41 3.581-8 8-8h11.637l1.846-8H24C19.59 48 16 44.418 16 40c0-4.41 3.581-8 8-8h17.177l5.624-24.358c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L57.598 32h5.58L68.8 7.642c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L79.598 32h5.58zM53.904 48l-1.847 8h5.58l1.846-8h-5.579zm22.039 24l-1.847 8h-5.58l1.847-8h5.58zm-27.58 0l-1.846 8h5.579l1.847-8h-5.58z\"/></svg>"},"$:/core/images/picture":{"title":"$:/core/images/picture","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-picture tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M112 68.233v-48.23A4.001 4.001 0 00107.997 16H20.003A4.001 4.001 0 0016 20.003v38.31l9.241-14.593c2.8-4.422 9.023-5.008 12.6-1.186l18.247 20.613 13.687-6.407a8 8 0 018.903 1.492 264.97 264.97 0 002.92 2.739 249.44 249.44 0 006.798 6.066 166.5 166.5 0 002.106 1.778c2.108 1.747 3.967 3.188 5.482 4.237.748.518 1.383.92 2.044 1.33.444.117 1.046.144 1.809.05 1.873-.233 4.238-1.144 6.723-2.547a36.016 36.016 0 003.205-2.044c.558-.4.93-.686 1.07-.802.376-.31.765-.577 1.165-.806zM0 8.007A8.01 8.01 0 018.007 0h111.986A8.01 8.01 0 01128 8.007v111.986a8.01 8.01 0 01-8.007 8.007H8.007A8.01 8.01 0 010 119.993V8.007zM95 42a8 8 0 100-16 8 8 0 000 16zM32 76c15.859 4.83 20.035 7.244 20.035 12S32 95.471 32 102.347c0 6.876 1.285 4.99 1.285 9.653H68s-13.685-6.625-13.685-10.8c0-7.665 10.615-8.34 10.615-13.2 0-7.357-14.078-8.833-32.93-12z\"/></svg>"},"$:/core/images/plugin-generic-language":{"title":"$:/core/images/plugin-generic-language","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> viewBox=\"0 0 128 128\" class=\"tc-image-plugin-generic-language tc-image-button\"><path fill-rule=\"evenodd\" d=\"M61.207 68.137c-4.324 2.795-6.999 6.656-6.999 10.921 0 7.906 9.19 14.424 21.042 15.336 2.162 3.902 8.598 6.785 16.318 7.01-5.126-1.125-9.117-3.742-10.62-7.01C92.805 93.487 102 86.967 102 79.059c0-8.53-10.699-15.445-23.896-15.445-6.599 0-12.572 1.729-16.897 4.524zm12.794-14.158c-4.324 2.795-10.298 4.524-16.897 4.524-2.619 0-5.14-.272-7.497-.775-3.312 2.25-8.383 3.69-14.067 3.69l-.255-.002c4.119-.892 7.511-2.747 9.478-5.13-6.925-2.704-11.555-7.617-11.555-13.228 0-8.53 10.699-15.445 23.896-15.445C70.301 27.613 81 34.528 81 43.058c0 4.265-2.675 8.126-6.999 10.921zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z\"/></svg>"},"$:/core/images/plugin-generic-plugin":{"title":"$:/core/images/plugin-generic-plugin","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> viewBox=\"0 0 128 128\" class=\"tc-image-plugin-generic-plugin tc-image-button\"><path fill-rule=\"evenodd\" d=\"M40.397 76.446V95.34h14.12l-.001-.005a6.912 6.912 0 005.364-11.593l.046-.023a6.912 6.912 0 119.979.526l.086.055a6.914 6.914 0 004.408 10.948l-.023.092h21.32V75.568l-.15.038a6.912 6.912 0 00-11.593-5.364l-.022-.046a6.912 6.912 0 11.526-9.979l.055-.086a6.914 6.914 0 0010.948-4.408c.079.018.158.038.236.059v-15.74h-21.32l.023-.094a6.914 6.914 0 01-4.408-10.947 10.23 10.23 0 00-.086-.055 6.912 6.912 0 10-9.979-.526l-.046.023a6.912 6.912 0 01-5.364 11.593l.001.005h-14.12v12.847A6.912 6.912 0 0129.5 59.843l-.054.086a6.912 6.912 0 10-.526 9.979l.023.046a6.912 6.912 0 0111.455 6.492zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z\"/></svg>"},"$:/core/images/plugin-generic-theme":{"title":"$:/core/images/plugin-generic-theme","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> viewBox=\"0 0 128 128\" class=\"tc-image-plugin-generic-theme tc-image-button\"><path fill-rule=\"evenodd\" d=\"M29.408 91.472L51.469 69.41l-.004-.005a2.22 2.22 0 01.004-3.146c.87-.87 2.281-.872 3.147-.005l9.465 9.464a2.22 2.22 0 01-.005 3.147c-.87.87-2.28.871-3.147.005l-.005-.005-22.061 22.062a6.686 6.686 0 11-9.455-9.455zM60.802 66.38c-2.436-2.704-4.465-5.091-5.817-6.869-6.855-9.014-10.313-4.268-14.226 0-3.913 4.268 1.03 7.726-2.683 10.741-3.713 3.015-3.484 4.06-9.752-1.455-6.267-5.516-6.7-7.034-3.823-10.181 2.877-3.147 5.281 1.808 11.159-3.785 5.877-5.593.94-10.55.94-10.55s12.237-25.014 28.588-23.167c16.351 1.848-6.186-2.392-11.792 17.226-2.4 8.4.447 6.42 4.998 9.968 1.394 1.086 6.03 4.401 11.794 8.685l20.677-20.676 1.615-4.766 7.84-4.689 3.151 3.152-4.688 7.84-4.766 1.615-20.224 20.223c12.663 9.547 28.312 22.146 28.312 26.709 0 7.217-3.071 11.526-9.535 9.164-4.693-1.715-18.768-15.192-28.753-25.897l-2.893 2.893-3.151-3.152 3.029-3.029zM63.953 0l54.56 32v64l-54.56 32-54.56-32V32l54.56-32z\"/></svg>"},"$:/core/images/plus-button":{"title":"$:/core/images/plus-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-plus-button tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M64-.333c35.346 0 64 28.654 64 64 0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64zM64 16c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z\"/><rect width=\"80\" height=\"16\" x=\"24\" y=\"56\" rx=\"8\"/><rect width=\"16\" height=\"80\" x=\"56\" y=\"24\" rx=\"8\"/></svg>"},"$:/core/images/preview-closed":{"title":"$:/core/images/preview-closed","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-preview-closed tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M.088 64a7.144 7.144 0 001.378 5.458C16.246 88.818 39.17 100.414 64 100.414c24.83 0 47.753-11.596 62.534-30.956A7.144 7.144 0 00127.912 64C110.582 78.416 88.304 87.086 64 87.086 39.696 87.086 17.418 78.416.088 64z\"/><rect width=\"4\" height=\"16\" x=\"62\" y=\"96\" rx=\"4\"/><rect width=\"4\" height=\"16\" x=\"78\" y=\"93\" rx=\"4\" transform=\"rotate(-5 80 101)\"/><rect width=\"4\" height=\"16\" x=\"46\" y=\"93\" rx=\"4\" transform=\"rotate(5 48 101)\"/><rect width=\"4\" height=\"16\" x=\"30\" y=\"88\" rx=\"4\" transform=\"rotate(10 32 96)\"/><rect width=\"4\" height=\"16\" x=\"94\" y=\"88\" rx=\"4\" transform=\"rotate(-10 96 96)\"/><rect width=\"4\" height=\"16\" x=\"110\" y=\"80\" rx=\"4\" transform=\"rotate(-20 112 88)\"/><rect width=\"4\" height=\"16\" x=\"14\" y=\"80\" rx=\"4\" transform=\"rotate(20 16 88)\"/></g></svg>"},"$:/core/images/preview-open":{"title":"$:/core/images/preview-open","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-preview-open tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M64.11 99.588c-24.83 0-47.754-11.596-62.534-30.957a7.148 7.148 0 010-8.675C16.356 40.596 39.28 29 64.11 29c24.83 0 47.753 11.596 62.534 30.956a7.148 7.148 0 010 8.675c-14.78 19.36-37.703 30.957-62.534 30.957zm46.104-32.007c1.44-1.524 1.44-3.638 0-5.162C99.326 50.9 82.439 44 64.147 44S28.968 50.9 18.08 62.42c-1.44 1.523-1.44 3.637 0 5.16C28.968 79.1 45.855 86 64.147 86s35.179-6.9 46.067-18.42z\"/><path d=\"M63.5 88C76.479 88 87 77.479 87 64.5S76.479 41 63.5 41 40 51.521 40 64.5 50.521 88 63.5 88z\"/></g></svg>"},"$:/core/images/print-button":{"title":"$:/core/images/print-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-print-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M112 71V30.5h-.032c-.035-2-.816-3.99-2.343-5.516L86.998 2.357A7.978 7.978 0 0081 .02V0H24a8 8 0 00-8 8v63h8V8h57v14.5c0 4.422 3.582 8 8 8h15V71h8z\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"36\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"52\" rx=\"4\"/><rect width=\"40\" height=\"8\" x=\"32\" y=\"20\" rx=\"4\"/><path d=\"M0 80.005C0 71.165 7.156 64 16 64h96c8.836 0 16 7.155 16 16.005v31.99c0 8.84-7.156 16.005-16 16.005H16c-8.836 0-16-7.155-16-16.005v-31.99zM104 96a8 8 0 100-16 8 8 0 000 16z\"/></g></svg>"},"$:/core/images/quote":{"title":"$:/core/images/quote","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-quote tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M51.219 117.713V62.199H27.427c0-8.891 1.683-16.401 5.047-22.53 3.365-6.127 9.613-10.754 18.745-13.878V2c-7.45.961-14.36 3.184-20.728 6.669-6.368 3.484-11.835 7.87-16.401 13.157C9.524 27.113 5.98 33.241 3.456 40.21.933 47.18-.21 54.63.03 62.56v55.153H51.22zm76.781 0V62.199h-23.791c0-8.891 1.682-16.401 5.046-22.53 3.365-6.127 9.613-10.754 18.745-13.878V2c-7.45.961-14.359 3.184-20.727 6.669-6.369 3.484-11.836 7.87-16.402 13.157-4.566 5.287-8.11 11.415-10.634 18.384-2.523 6.97-3.665 14.42-3.424 22.35v55.153H128z\"/></svg>"},"$:/core/images/refresh-button":{"title":"$:/core/images/refresh-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-refresh-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M106.369 39.433c10.16 20.879 6.57 46.764-10.771 64.106-21.87 21.87-57.327 21.87-79.196 0-21.87-21.87-21.87-57.326 0-79.196a8 8 0 1111.314 11.314c-15.621 15.62-15.621 40.947 0 56.568 15.62 15.621 40.947 15.621 56.568 0C97.72 78.79 99.6 58.175 89.924 42.73l-6.44 12.264a8 8 0 11-14.166-7.437L84.435 18.76a8 8 0 0110.838-3.345l28.873 15.345a8 8 0 11-7.51 14.129l-10.267-5.457zm-8.222-12.368c-.167-.19-.336-.38-.506-.57l.96-.296-.454.866z\"/></svg>"},"$:/core/images/right-arrow":{"title":"$:/core/images/right-arrow","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-right-arrow tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M99.069 64.173c0 2.027-.77 4.054-2.316 5.6l-55.98 55.98a7.92 7.92 0 01-11.196 0c-3.085-3.086-3.092-8.105 0-11.196l50.382-50.382-50.382-50.382a7.92 7.92 0 010-11.195c3.086-3.085 8.104-3.092 11.196 0l55.98 55.98a7.892 7.892 0 012.316 5.595z\"/></svg>"},"$:/core/images/rotate-left":{"title":"$:/core/images/rotate-left","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-rotate-left tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"32\" height=\"80\" rx=\"8\"/><rect width=\"80\" height=\"32\" x=\"48\" y=\"96\" rx=\"8\"/><path d=\"M61.32 36.65c19.743 2.45 35.023 19.287 35.023 39.693a4 4 0 01-8 0c0-15.663-11.254-28.698-26.117-31.46l3.916 3.916a4 4 0 11-5.657 5.657L49.172 43.142a4 4 0 010-5.657l11.313-11.313a4 4 0 115.657 5.656l-4.821 4.822z\"/></g></svg>"},"$:/core/images/save-button-dynamic":{"title":"$:/core/images/save-button-dynamic","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-save-button-dynamic tc-image-button\" viewBox=\"0 0 128 128\">\n<g class=\"tc-image-save-button-dynamic-clean\">\n<path fill-rule=\"evenodd\" d=\"M120.783 34.33c4.641 8.862 7.266 18.948 7.266 29.646 0 35.347-28.653 64-64 64-35.346 0-64-28.653-64-64 0-35.346 28.654-64 64-64 18.808 0 35.72 8.113 47.43 21.03l2.68-2.68c3.13-3.13 8.197-3.132 11.321-.008 3.118 3.118 3.121 8.193-.007 11.32l-4.69 4.691zm-12.058 12.058a47.876 47.876 0 013.324 17.588c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48c14.39 0 27.3 6.332 36.098 16.362L58.941 73.544 41.976 56.578c-3.127-3.127-8.201-3.123-11.32-.005-3.123 3.124-3.119 8.194.006 11.319l22.617 22.617a7.992 7.992 0 005.659 2.347c2.05 0 4.101-.783 5.667-2.349l44.12-44.12z\"/>\n</g>\n<g class=\"tc-image-save-button-dynamic-dirty\">\n<path d=\"M64.856912,0 C100.203136,0 128.856912,28.653776 128.856912,64 C128.856912,99.346224 100.203136,128 64.856912,128 C29.510688,128 0.856911958,99.346224 0.856911958,64 C0.856911958,28.653776 29.510688,0 64.856912,0 Z M64.856912,16 C38.347244,16 16.856912,37.490332 16.856912,64 C16.856912,90.509668 38.347244,112 64.856912,112 C91.3665799,112 112.856912,90.509668 112.856912,64 C112.856912,37.490332 91.3665799,16 64.856912,16 Z\"></path>\n<circle cx=\"65\" cy=\"64\" r=\"32\"></circle>\n</g>\n</svg>"},"$:/core/images/save-button":{"title":"$:/core/images/save-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-save-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M120.783 34.33c4.641 8.862 7.266 18.948 7.266 29.646 0 35.347-28.653 64-64 64-35.346 0-64-28.653-64-64 0-35.346 28.654-64 64-64 18.808 0 35.72 8.113 47.43 21.03l2.68-2.68c3.13-3.13 8.197-3.132 11.321-.008 3.118 3.118 3.121 8.193-.007 11.32l-4.69 4.691zm-12.058 12.058a47.876 47.876 0 013.324 17.588c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48c14.39 0 27.3 6.332 36.098 16.362L58.941 73.544 41.976 56.578c-3.127-3.127-8.201-3.123-11.32-.005-3.123 3.124-3.119 8.194.006 11.319l22.617 22.617a7.992 7.992 0 005.659 2.347c2.05 0 4.101-.783 5.667-2.349l44.12-44.12z\"/></svg>"},"$:/core/images/size":{"title":"$:/core/images/size","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-size tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M92.343 26l-9.171 9.172a4 4 0 105.656 5.656l16-16a4 4 0 000-5.656l-16-16a4 4 0 10-5.656 5.656L92.343 18H22a4 4 0 00-4 4v70.343l-9.172-9.171a4 4 0 10-5.656 5.656l16 16a4 4 0 005.656 0l16-16a4 4 0 10-5.656-5.656L26 92.343V22l-4 4h70.343zM112 52v64l4-4H52a4 4 0 100 8h64a4 4 0 004-4V52a4 4 0 10-8 0z\"/></svg>"},"$:/core/images/spiral":{"title":"$:/core/images/spiral","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-spiral tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M64.534 68.348c3.39 0 6.097-2.62 6.476-5.968l-4.755-.538 4.75.583c.377-3.07-1.194-6.054-3.89-7.78-2.757-1.773-6.34-2.01-9.566-.7-3.46 1.403-6.14 4.392-7.35 8.148l-.01.026c-1.3 4.08-.72 8.64 1.58 12.52 2.5 4.2 6.77 7.2 11.76 8.27 5.37 1.15 11.11-.05 15.83-3.31 5.04-3.51 8.46-9.02 9.45-15.3 1.05-6.7-.72-13.63-4.92-19.19l.02.02c-4.42-5.93-11.2-9.82-18.78-10.78-7.96-1.01-16.13 1.31-22.59 6.43-6.81 5.39-11.18 13.41-12.11 22.26-.98 9.27 1.87 18.65 7.93 26.02 6.32 7.69 15.6 12.56 25.74 13.48 10.54.96 21.15-2.42 29.45-9.4l.01-.01c8.58-7.25 13.94-17.78 14.86-29.21.94-11.84-2.96-23.69-10.86-32.9-8.19-9.5-19.95-15.36-32.69-16.27-13.16-.94-26.24 3.49-36.34 12.34l.01-.01c-10.41 9.08-16.78 22.1-17.68 36.15-.93 14.44 4.03 28.77 13.79 39.78 10.03 11.32 24.28 18.2 39.6 19.09 15.73.92 31.31-4.56 43.24-15.234 12.23-10.954 19.61-26.44 20.5-43.074a4.785 4.785 0 00-4.52-5.03 4.778 4.778 0 00-5.03 4.52c-.75 14.1-7 27.2-17.33 36.45-10.03 8.98-23.11 13.58-36.3 12.81-12.79-.75-24.67-6.48-33-15.89-8.07-9.11-12.17-20.94-11.41-32.827.74-11.52 5.942-22.15 14.43-29.54l.01-.01c8.18-7.17 18.74-10.75 29.35-9.998 10.21.726 19.6 5.41 26.11 12.96 6.24 7.273 9.32 16.61 8.573 25.894-.718 8.9-4.88 17.064-11.504 22.66l.01-.007c-6.36 5.342-14.44 7.92-22.425 7.19-7.604-.68-14.52-4.314-19.21-10.027-4.44-5.4-6.517-12.23-5.806-18.94.67-6.3 3.76-11.977 8.54-15.766 4.46-3.54 10.05-5.128 15.44-4.44 5.03.63 9.46 3.18 12.32 7.01l.02.024c2.65 3.5 3.75 7.814 3.1 11.92-.59 3.71-2.58 6.925-5.45 8.924-2.56 1.767-5.61 2.403-8.38 1.81-2.42-.516-4.42-1.92-5.53-3.79-.93-1.56-1.15-3.3-.69-4.75l-4.56-1.446L59.325 65c.36-1.12 1.068-1.905 1.84-2.22.25-.103.48-.14.668-.13.06.006.11.015.14.025.01 0 .01 0-.01-.01a1.047 1.047 0 01-.264-.332c-.15-.29-.23-.678-.18-1.11l-.005.04c.15-1.332 1.38-2.523 3.035-2.523-2.65 0-4.79 2.144-4.79 4.787s2.14 4.785 4.78 4.785z\"/></svg>"},"$:/core/images/stamp":{"title":"$:/core/images/stamp","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-stamp tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M49.733 64H16.01C11.584 64 8 67.583 8 72.003V97h112V72.003A8 8 0 00111.99 64H78.267A22.813 22.813 0 0175.5 53.077c0-6.475 2.687-12.324 7.009-16.497A22.818 22.818 0 0087 22.952C87 10.276 76.703 0 64 0S41 10.276 41 22.952c0 5.103 1.669 9.817 4.491 13.628 4.322 4.173 7.009 10.022 7.009 16.497 0 3.954-1.002 7.675-2.767 10.923zM8 104h112v8H8v-8z\"/></svg>"},"$:/core/images/standard-layout":{"title":"$:/core/images/standard-layout","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-standard-layout tc-image-button\" viewBox=\"0 0 128 128\">\n <path d=\"M71.93 72A8.07 8.07 0 0 1 80 80.07v7.86A8.071 8.071 0 0 1 71.93 96H8.07A8.067 8.067 0 0 1 0 87.93v-7.86A8.072 8.072 0 0 1 8.07 72h63.86Zm0 32a8.07 8.07 0 0 1 8.07 8.07v7.86a8.071 8.071 0 0 1-8.07 8.07H8.07A8.067 8.067 0 0 1 0 119.93v-7.86A8.072 8.072 0 0 1 8.07 104h63.86Zm0-104A8.068 8.068 0 0 1 80 8.07v47.86A8.073 8.073 0 0 1 71.93 64H8.07A8.07 8.07 0 0 1 0 55.93V8.07A8.072 8.072 0 0 1 8.07 0h63.86Zm48 0c2.14 0 4.193.85 5.706 2.364A8.067 8.067 0 0 1 128 8.07v111.86c0 2.14-.85 4.193-2.364 5.706A8.067 8.067 0 0 1 119.93 128H96.07c-2.14 0-4.193-.85-5.706-2.364A8.067 8.067 0 0 1 88 119.93V8.07c0-2.14.85-4.193 2.364-5.706A8.067 8.067 0 0 1 96.07 0h23.86ZM116 24h-16a3.995 3.995 0 0 0-2.828 1.172 3.995 3.995 0 0 0 0 5.656A3.995 3.995 0 0 0 100 32h16a3.995 3.995 0 0 0 2.828-1.172 3.995 3.995 0 0 0 0-5.656A3.995 3.995 0 0 0 116 24Z\"/>\n</svg>"},"$:/core/images/star-filled":{"title":"$:/core/images/star-filled","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-star-filled tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M61.836 96.823l37.327 27.287c2.72 1.99 6.379-.69 5.343-3.912L90.29 75.988l-1.26 3.91 37.285-27.345c2.718-1.993 1.32-6.327-2.041-6.33l-46.113-.036 3.3 2.416L67.176 4.416c-1.04-3.221-5.563-3.221-6.604 0L46.29 48.603l3.3-2.416-46.113.036c-3.362.003-4.759 4.337-2.04 6.33L38.72 79.898l-1.26-3.91-14.216 44.21c-1.036 3.223 2.622 5.901 5.343 3.912l37.326-27.287h-4.078z\"/></svg>"},"$:/core/images/storyview-classic":{"title":"$:/core/images/storyview-classic","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-storyview-classic tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8.007 0A8.01 8.01 0 000 8.007v111.986A8.01 8.01 0 008.007 128h111.986a8.01 8.01 0 008.007-8.007V8.007A8.01 8.01 0 00119.993 0H8.007zm15.992 16C19.581 16 16 19.578 16 23.992v16.016C16 44.422 19.588 48 24 48h80c4.419 0 8-3.578 8-7.992V23.992c0-4.414-3.588-7.992-8-7.992H24zm0 48C19.581 64 16 67.59 16 72c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8 0-4.418-3.588-8-8-8H24zm0 32C19.581 96 16 99.59 16 104c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8 0-4.418-3.588-8-8-8H24z\"/></svg>"},"$:/core/images/storyview-pop":{"title":"$:/core/images/storyview-pop","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-storyview-pop tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8.007 0A8.01 8.01 0 000 8.007v111.986A8.01 8.01 0 008.007 128h111.986a8.01 8.01 0 008.007-8.007V8.007A8.01 8.01 0 00119.993 0H8.007zm15.992 16C19.581 16 16 19.578 16 23.992v16.016C16 44.422 19.588 48 24 48h80c4.419 0 8-3.578 8-7.992V23.992c0-4.414-3.588-7.992-8-7.992H24zm-7.99 40C11.587 56 8 59.578 8 63.992v16.016C8 84.422 11.584 88 16.01 88h95.98c4.424 0 8.01-3.578 8.01-7.992V63.992c0-4.414-3.584-7.992-8.01-7.992H16.01zM24 96C19.581 96 16 99.59 16 104c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8 0-4.418-3.588-8-8-8H24zm0-32C19.581 64 16 67.59 16 72c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8 0-4.418-3.588-8-8-8H24z\"/></svg>"},"$:/core/images/storyview-zoomin":{"title":"$:/core/images/storyview-zoomin","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-storyview-zoomin tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8.007 0A8.01 8.01 0 000 8.007v111.986A8.01 8.01 0 008.007 128h111.986a8.01 8.01 0 008.007-8.007V8.007A8.01 8.01 0 00119.993 0H8.007zm15.992 16A8 8 0 0016 24.009V71.99C16 76.414 19.588 80 24 80h80a8 8 0 008-8.009V24.01c0-4.423-3.588-8.009-8-8.009H24z\"/></svg>"},"$:/core/images/strikethrough":{"title":"$:/core/images/strikethrough","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-strikethrough tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M92.794 38.726h15.422c-.229-6.74-1.514-12.538-3.856-17.393-2.342-4.855-5.54-8.881-9.596-12.08-4.055-3.199-8.767-5.54-14.136-7.025C75.258.743 69.433 0 63.15 0a62.76 62.76 0 00-16.364 2.142C41.474 3.57 36.733 5.74 32.564 8.653c-4.17 2.913-7.511 6.626-10.025 11.138-2.513 4.512-3.77 9.853-3.77 16.022 0 5.597 1.115 10.252 3.342 13.965 2.228 3.712 5.198 6.74 8.91 9.081 3.713 2.342 7.911 4.227 12.595 5.655a194.641 194.641 0 0014.308 3.77c4.855 1.085 9.624 2.142 14.308 3.17 4.683 1.028 8.881 2.37 12.594 4.027 3.713 1.656 6.683 3.798 8.91 6.425 2.228 2.628 3.342 6.055 3.342 10.281 0 4.456-.914 8.111-2.742 10.967a19.953 19.953 0 01-7.197 6.768c-2.97 1.657-6.311 2.828-10.024 3.513a60.771 60.771 0 01-11.052 1.028c-4.57 0-9.025-.571-13.366-1.713-4.34-1.143-8.139-2.913-11.394-5.312-3.256-2.4-5.884-5.455-7.883-9.168-1.999-3.712-2.998-8.139-2.998-13.28H15c0 7.426 1.342 13.852 4.027 19.278 2.684 5.426 6.34 9.881 10.966 13.365 4.627 3.484 9.996 6.083 16.107 7.797 6.112 1.713 12.595 2.57 19.449 2.57 5.597 0 11.223-.657 16.878-1.97 5.655-1.314 10.767-3.428 15.336-6.34 4.57-2.914 8.31-6.683 11.224-11.31 2.913-4.626 4.37-10.195 4.37-16.707 0-6.054-1.115-11.08-3.342-15.079-2.228-3.998-5.198-7.31-8.91-9.938-3.713-2.627-7.911-4.712-12.595-6.254a170.83 170.83 0 00-14.308-4.027 549.669 549.669 0 00-14.308-3.17c-4.683-.971-8.881-2.2-12.594-3.684-3.713-1.485-6.683-3.399-8.91-5.74-2.228-2.342-3.342-5.398-3.342-9.168 0-3.998.771-7.34 2.313-10.024 1.543-2.685 3.599-4.826 6.17-6.426 2.57-1.599 5.51-2.741 8.824-3.427a49.767 49.767 0 0110.11-1.028c8.453 0 15.393 1.97 20.819 5.912 5.426 3.94 8.596 10.31 9.51 19.106z\"/><path d=\"M5 54h118v16H5z\"/></g></svg>"},"$:/core/images/subscript":{"title":"$:/core/images/subscript","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-subscript tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M2.272 16h19.91l21.649 33.675L66.414 16h18.708L53.585 61.969l33.809 49.443H67.082L43.296 74.93l-24.187 36.48H0L33.808 61.97 2.272 16zM127.91 128.412H85.328c.059-5.168 1.306-9.681 3.741-13.542 2.435-3.86 5.761-7.216 9.978-10.066a112.388 112.388 0 016.325-4.321 50.09 50.09 0 006.058-4.499c1.841-1.603 3.356-3.34 4.543-5.211 1.188-1.871 1.812-4.024 1.871-6.46 0-1.128-.133-2.33-.4-3.607a9.545 9.545 0 00-1.56-3.564c-.772-1.098-1.84-2.019-3.207-2.761-1.366-.743-3.148-1.114-5.345-1.114-2.02 0-3.697.4-5.033 1.203-1.337.801-2.406 1.9-3.208 3.296-.801 1.396-1.395 3.044-1.781 4.944-.386 1.9-.609 3.95-.668 6.147H86.486c0-3.445.46-6.637 1.38-9.577.921-2.94 2.302-5.478 4.143-7.617 1.841-2.138 4.083-3.815 6.726-5.033 2.643-1.217 5.716-1.826 9.22-1.826 3.802 0 6.979.623 9.533 1.87 2.554 1.248 4.617 2.822 6.191 4.722 1.574 1.9 2.688 3.965 3.341 6.192.653 2.227.98 4.35.98 6.37 0 2.494-.386 4.75-1.158 6.77a21.803 21.803 0 01-3.118 5.568 31.516 31.516 0 01-4.454 4.677 66.788 66.788 0 01-5.167 4.009 139.198 139.198 0 01-5.346 3.563 79.237 79.237 0 00-4.944 3.386c-1.514 1.128-2.836 2.3-3.964 3.518-1.129 1.218-1.9 2.51-2.317 3.876h30.379v9.087z\"/></svg>"},"$:/core/images/superscript":{"title":"$:/core/images/superscript","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-superscript tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M2.272 16h19.91l21.649 33.675L66.414 16h18.708L53.585 61.969l33.809 49.443H67.082L43.296 74.93l-24.187 36.48H0L33.808 61.97 2.272 16zM127.91 63.412H85.328c.059-5.168 1.306-9.681 3.741-13.542 2.435-3.86 5.761-7.216 9.978-10.066a112.388 112.388 0 016.325-4.321 50.09 50.09 0 006.058-4.499c1.841-1.603 3.356-3.34 4.543-5.211 1.188-1.871 1.812-4.024 1.871-6.46 0-1.128-.133-2.33-.4-3.607a9.545 9.545 0 00-1.56-3.564c-.772-1.098-1.84-2.019-3.207-2.761-1.366-.743-3.148-1.114-5.345-1.114-2.02 0-3.697.4-5.033 1.203-1.337.801-2.406 1.9-3.208 3.296-.801 1.396-1.395 3.044-1.781 4.944-.386 1.9-.609 3.95-.668 6.147H86.486c0-3.445.46-6.637 1.38-9.577.921-2.94 2.302-5.478 4.143-7.617 1.841-2.138 4.083-3.815 6.726-5.033 2.643-1.217 5.716-1.826 9.22-1.826 3.802 0 6.979.623 9.533 1.87 2.554 1.248 4.617 2.822 6.191 4.722 1.574 1.9 2.688 3.965 3.341 6.192.653 2.227.98 4.35.98 6.37 0 2.494-.386 4.75-1.158 6.77a21.803 21.803 0 01-3.118 5.568 31.516 31.516 0 01-4.454 4.677 66.788 66.788 0 01-5.167 4.009 139.198 139.198 0 01-5.346 3.563 79.237 79.237 0 00-4.944 3.386c-1.514 1.128-2.836 2.3-3.964 3.518-1.129 1.218-1.9 2.51-2.317 3.876h30.379v9.087z\"/></svg>"},"$:/core/images/tag-button":{"title":"$:/core/images/tag-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-tag-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M18.164 47.66l.004 4.105c.003 3.823 2.19 9.097 4.885 11.792l61.85 61.85c2.697 2.697 7.068 2.69 9.769-.01L125.767 94.3a6.903 6.903 0 00.01-9.77L63.928 22.683c-2.697-2.697-7.976-4.88-11.796-4.881l-27.076-.007a6.902 6.902 0 00-6.91 6.91l.008 9.96.287.033c3.73.411 8.489-.044 13.365-1.153a9.702 9.702 0 0111.14-3.662l.291-.13.128.285a9.7 9.7 0 013.3 2.17c3.796 3.796 3.801 9.945.012 13.734-3.618 3.618-9.386 3.777-13.204.482-5.365 1.122-10.674 1.596-15.309 1.237z\"/><path d=\"M47.633 39.532l.023.051c-9.689 4.356-21.584 6.799-30.396 5.828C5.273 44.089-1.028 36.43 2.443 24.078 5.562 12.976 14.3 4.361 24.047 1.548c10.68-3.083 19.749 1.968 19.749 13.225h-8.623c0-4.859-3.078-6.573-8.735-4.94-6.91 1.995-13.392 8.383-15.694 16.577-1.915 6.818.417 9.653 7.46 10.43 7.126.785 17.531-1.352 25.917-5.121l.027.06.036-.017c1.76-.758 6.266 6.549 3.524 7.74a2.8 2.8 0 01-.075.03z\"/></g></svg>"},"$:/core/images/theme-button":{"title":"$:/core/images/theme-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-theme-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M55.854 66.945a122.626 122.626 0 01-3.9-4.819c-11.064-14.548-16.645-6.888-22.96 0-6.315 6.888 1.664 12.47-4.33 17.335-5.993 4.866-5.623 6.552-15.737-2.35-10.115-8.9-10.815-11.351-6.172-16.43 4.644-5.08 8.524 2.918 18.01-6.108 9.485-9.026 1.517-17.026 1.517-17.026S42.03-2.824 68.42.157c26.39 2.982-9.984-3.86-19.031 27.801-3.874 13.556.72 10.362 8.066 16.087 1.707 1.33 6.428 4.732 12.671 9.318-6.129 5.879-11.157 10.669-14.273 13.582zm11.641 12.947c16.013 17.036 37.742 37.726 45.117 40.42 10.432 3.813 15.388-3.141 15.388-14.79 0-7.151-23.83-26.542-43.924-41.769-7.408 7.156-13.376 12.953-16.58 16.139z\"/><path d=\"M11.069 109.828L46.31 74.587a3.56 3.56 0 115.037-5.032l15.098 15.098a3.56 3.56 0 11-5.032 5.037l-35.24 35.241c-4.171 4.17-10.933 4.17-15.104 0-4.17-4.17-4.17-10.933 0-15.103zM124.344 6.622l5.034 5.034-7.49 12.524-7.613 2.58L61.413 79.62l-5.034-5.034 52.861-52.862 2.58-7.614 12.524-7.49z\"/></g></svg>"},"$:/core/images/timestamp-off":{"title":"$:/core/images/timestamp-off","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-timestamp-off tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M58.25 11C26.08 11 0 37.082 0 69.25s26.08 58.25 58.25 58.25c32.175 0 58.25-26.082 58.25-58.25S90.425 11 58.25 11zm0 100.5C34.914 111.5 16 92.586 16 69.25 16 45.92 34.914 27 58.25 27s42.25 18.92 42.25 42.25c0 23.336-18.914 42.25-42.25 42.25zM49.704 10a5 5 0 010-10H66.69a5 5 0 015 5c.006 2.757-2.238 5-5 5H49.705z\"/><path d=\"M58.25 35.88c-18.777 0-33.998 15.224-33.998 33.998 0 18.773 15.22 34.002 33.998 34.002 18.784 0 34.002-15.23 34.002-34.002 0-18.774-15.218-33.998-34.002-33.998zm-3.03 50.123H44.196v-34H55.22v34zm16.976 0H61.17v-34h11.025v34z\"/></g></svg>"},"$:/core/images/timestamp-on":{"title":"$:/core/images/timestamp-on","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-timestamp-on tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M58.25 11C26.08 11 0 37.082 0 69.25s26.08 58.25 58.25 58.25c32.175 0 58.25-26.082 58.25-58.25S90.425 11 58.25 11zm0 100.5C34.914 111.5 16 92.586 16 69.25 16 45.92 34.914 27 58.25 27s42.25 18.92 42.25 42.25c0 23.336-18.914 42.25-42.25 42.25zM49.704 10a5 5 0 010-10H66.69a5 5 0 015 5c.006 2.757-2.238 5-5 5H49.705z\"/><path d=\"M13.41 27.178a5.005 5.005 0 01-7.045-.613 5.008 5.008 0 01.616-7.047l9.95-8.348a5 5 0 016.429 7.661l-9.95 8.348zm89.573 0a5.005 5.005 0 007.045-.613 5.008 5.008 0 00-.616-7.047l-9.95-8.348a5 5 0 00-6.428 7.661l9.95 8.348zM65.097 71.072c0 3.826-3.09 6.928-6.897 6.928-3.804.006-6.9-3.102-6.903-6.928 0 0 4.76-39.072 6.903-39.072s6.897 39.072 6.897 39.072z\"/></g></svg>"},"$:/core/images/tip":{"title":"$:/core/images/tip","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-tip tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M64 128.242c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64 0 35.346 28.654 64 64 64zm11.936-36.789c-.624 4.129-5.73 7.349-11.936 7.349-6.206 0-11.312-3.22-11.936-7.349C54.33 94.05 58.824 95.82 64 95.82c5.175 0 9.67-1.769 11.936-4.366zm0 4.492c-.624 4.13-5.73 7.349-11.936 7.349-6.206 0-11.312-3.22-11.936-7.349 2.266 2.597 6.76 4.366 11.936 4.366 5.175 0 9.67-1.769 11.936-4.366zm0 4.456c-.624 4.129-5.73 7.349-11.936 7.349-6.206 0-11.312-3.22-11.936-7.349 2.266 2.597 6.76 4.366 11.936 4.366 5.175 0 9.67-1.769 11.936-4.366zm0 4.492c-.624 4.13-5.73 7.349-11.936 7.349-6.206 0-11.312-3.22-11.936-7.349 2.266 2.597 6.76 4.366 11.936 4.366 5.175 0 9.67-1.769 11.936-4.366zM64.3 24.242c11.618 0 23.699 7.82 23.699 24.2S75.92 71.754 75.92 83.576c0 5.873-5.868 9.26-11.92 9.26s-12.027-3.006-12.027-9.26C51.973 71.147 40 65.47 40 48.442s12.683-24.2 24.301-24.2z\"/></svg>"},"$:/core/images/transcludify":{"title":"$:/core/images/transcludify","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-transcludify-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M0 59.482c.591 0 1.36-.089 2.306-.266a10.417 10.417 0 002.75-.932 6.762 6.762 0 002.306-1.907c.651-.828.976-1.863.976-3.104V35.709c0-2.01.414-3.74 1.242-5.19.828-1.448 1.833-2.66 3.016-3.636s2.425-1.7 3.726-2.173c1.3-.473 2.424-.71 3.37-.71h8.073v7.451h-4.88c-1.241 0-2.232.207-2.97.621-.74.414-1.302.932-1.686 1.552a4.909 4.909 0 00-.71 1.996c-.089.71-.133 1.39-.133 2.04v16.677c0 1.715-.325 3.134-.976 4.258-.65 1.123-1.434 2.025-2.35 2.705-.917.68-1.863 1.168-2.839 1.464-.976.296-1.818.473-2.528.532v.178c.71.059 1.552.207 2.528.443.976.237 1.922.68 2.839 1.33.916.651 1.7 1.583 2.35 2.795.65 1.212.976 2.853.976 4.923v16.144c0 .65.044 1.33.133 2.04.089.71.325 1.375.71 1.996.384.621.946 1.139 1.685 1.553.74.414 1.73.62 2.972.62h4.879v7.452h-8.073c-.946 0-2.07-.237-3.37-.71-1.301-.473-2.543-1.197-3.726-2.173-1.183-.976-2.188-2.188-3.016-3.637-.828-1.449-1.242-3.179-1.242-5.19V74.119c0-1.42-.325-2.572-.976-3.46-.65-.886-1.419-1.581-2.306-2.084a8.868 8.868 0 00-2.75-1.02C1.36 67.377.591 67.288 0 67.288v-7.806zm24.66 0c.591 0 1.36-.089 2.306-.266a10.417 10.417 0 002.75-.932 6.762 6.762 0 002.306-1.907c.65-.828.976-1.863.976-3.104V35.709c0-2.01.414-3.74 1.242-5.19.828-1.448 1.833-2.66 3.016-3.636s2.425-1.7 3.726-2.173c1.3-.473 2.424-.71 3.37-.71h8.073v7.451h-4.88c-1.241 0-2.232.207-2.97.621-.74.414-1.302.932-1.686 1.552a4.909 4.909 0 00-.71 1.996c-.089.71-.133 1.39-.133 2.04v16.677c0 1.715-.325 3.134-.976 4.258-.65 1.123-1.434 2.025-2.35 2.705-.917.68-1.863 1.168-2.839 1.464-.976.296-1.818.473-2.528.532v.178c.71.059 1.552.207 2.528.443.976.237 1.922.68 2.839 1.33.916.651 1.7 1.583 2.35 2.795.65 1.212.976 2.853.976 4.923v16.144c0 .65.044 1.33.133 2.04.089.71.325 1.375.71 1.996.384.621.946 1.139 1.685 1.553.74.414 1.73.62 2.972.62h4.879v7.452h-8.073c-.946 0-2.07-.237-3.37-.71-1.301-.473-2.543-1.197-3.726-2.173-1.183-.976-2.188-2.188-3.016-3.637-.828-1.449-1.242-3.179-1.242-5.19V74.119c0-1.42-.325-2.572-.976-3.46-.65-.886-1.419-1.581-2.306-2.084a8.868 8.868 0 00-2.75-1.02c-.946-.177-1.715-.266-2.306-.266v-7.806zm43.965-3.538L80.6 52.041l2.306 7.097-12.063 3.903 7.628 10.378-6.12 4.435-7.63-10.467-7.45 10.201-5.943-4.524 7.628-10.023-12.152-4.17 2.306-7.096 12.064 4.17V43.347h7.451v12.596zm34.425 11.344c-.65 0-1.449.089-2.395.266-.946.177-1.863.488-2.75.931a6.356 6.356 0 00-2.262 1.908c-.62.828-.931 1.862-.931 3.104v17.564c0 2.01-.414 3.74-1.242 5.189-.828 1.449-1.833 2.661-3.016 3.637s-2.425 1.7-3.726 2.173c-1.3.473-2.424.71-3.37.71h-8.073v-7.451h4.88c1.241 0 2.232-.207 2.97-.621.74-.414 1.302-.932 1.686-1.553a4.9 4.9 0 00.71-1.995c.089-.71.133-1.39.133-2.04V72.432c0-1.715.325-3.134.976-4.258.65-1.124 1.434-2.01 2.35-2.661.917-.65 1.863-1.124 2.839-1.42.976-.295 1.818-.502 2.528-.62v-.178c-.71-.059-1.552-.207-2.528-.443-.976-.237-1.922-.68-2.839-1.33-.916-.651-1.7-1.583-2.35-2.795-.65-1.212-.976-2.853-.976-4.923V37.66c0-.651-.044-1.331-.133-2.04a4.909 4.909 0 00-.71-1.997c-.384-.62-.946-1.138-1.685-1.552-.74-.414-1.73-.62-2.972-.62h-4.879V24h8.073c.946 0 2.07.237 3.37.71 1.301.473 2.543 1.197 3.726 2.173 1.183.976 2.188 2.188 3.016 3.637.828 1.449 1.242 3.178 1.242 5.189v16.943c0 1.419.31 2.572.931 3.46a6.897 6.897 0 002.262 2.084 8.868 8.868 0 002.75 1.02c.946.177 1.745.266 2.395.266v7.806zm24.66 0c-.65 0-1.449.089-2.395.266-.946.177-1.863.488-2.75.931a6.356 6.356 0 00-2.262 1.908c-.62.828-.931 1.862-.931 3.104v17.564c0 2.01-.414 3.74-1.242 5.189-.828 1.449-1.833 2.661-3.016 3.637s-2.425 1.7-3.726 2.173c-1.3.473-2.424.71-3.37.71h-8.073v-7.451h4.88c1.241 0 2.232-.207 2.97-.621.74-.414 1.302-.932 1.686-1.553a4.9 4.9 0 00.71-1.995c.089-.71.133-1.39.133-2.04V72.432c0-1.715.325-3.134.976-4.258.65-1.124 1.434-2.01 2.35-2.661.917-.65 1.863-1.124 2.839-1.42.976-.295 1.818-.502 2.528-.62v-.178c-.71-.059-1.552-.207-2.528-.443-.976-.237-1.922-.68-2.839-1.33-.916-.651-1.7-1.583-2.35-2.795-.65-1.212-.976-2.853-.976-4.923V37.66c0-.651-.044-1.331-.133-2.04a4.909 4.909 0 00-.71-1.997c-.384-.62-.946-1.138-1.685-1.552-.74-.414-1.73-.62-2.972-.62h-4.879V24h8.073c.946 0 2.07.237 3.37.71 1.301.473 2.543 1.197 3.726 2.173 1.183.976 2.188 2.188 3.016 3.637.828 1.449 1.242 3.178 1.242 5.189v16.943c0 1.419.31 2.572.931 3.46a6.897 6.897 0 002.262 2.084 8.868 8.868 0 002.75 1.02c.946.177 1.745.266 2.395.266v7.806z\"/></svg>"},"$:/core/images/twitter":{"title":"$:/core/images/twitter","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-twitter tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M41.626 115.803A73.376 73.376 0 012 104.235c2.022.238 4.08.36 6.166.36 12.111 0 23.258-4.117 32.105-11.023-11.312-.208-20.859-7.653-24.148-17.883a25.98 25.98 0 0011.674-.441C15.971 72.881 7.061 62.474 7.061 49.997c0-.108 0-.216.002-.323a25.824 25.824 0 0011.709 3.22c-6.936-4.617-11.5-12.5-11.5-21.433 0-4.719 1.274-9.142 3.5-12.945 12.75 15.579 31.797 25.83 53.281 26.904-.44-1.884-.67-3.85-.67-5.868 0-14.22 11.575-25.75 25.852-25.75a25.865 25.865 0 0118.869 8.132 51.892 51.892 0 0016.415-6.248c-1.93 6.012-6.029 11.059-11.366 14.246A51.844 51.844 0 00128 25.878a52.428 52.428 0 01-12.9 13.33c.05 1.104.075 2.214.075 3.33 0 34.028-26 73.265-73.549 73.265\"/></svg>"},"$:/core/images/underline":{"title":"$:/core/images/underline","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-underline tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M7 117.421h114.248V128H7v-10.579zm97.871-18.525V0h-16.26v55.856c0 4.463-.605 8.576-1.816 12.338-1.212 3.762-3.03 7.046-5.452 9.851-2.423 2.806-5.452 4.974-9.086 6.504-3.635 1.53-7.939 2.296-12.912 2.296-6.25 0-11.159-1.786-14.73-5.356-3.57-3.571-5.356-8.417-5.356-14.538V0H23v65.038c0 5.356.542 10.234 1.626 14.633 1.084 4.4 2.965 8.194 5.643 11.382 2.678 3.188 6.185 5.643 10.52 7.365 4.337 1.721 9.756 2.582 16.26 2.582 7.27 0 13.582-1.435 18.938-4.304 5.356-2.87 9.755-7.365 13.199-13.486h.382v15.686h15.303z\"/></svg>"},"$:/core/images/unfold-all-button":{"title":"$:/core/images/unfold-all-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-unfold-all tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" rx=\"8\"/><rect width=\"128\" height=\"16\" y=\"64\" rx=\"8\"/><path d=\"M63.945 60.624c-2.05 0-4.101-.78-5.666-2.345L35.662 35.662c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.192-3.122 11.319.005L63.94 41.314l16.966-16.966c3.124-3.124 8.194-3.129 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319L69.603 58.279a7.986 7.986 0 01-5.663 2.346zM64.004 124.565c-2.05 0-4.102-.78-5.666-2.345L35.721 99.603c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.191-3.122 11.318.005L64 105.255l16.966-16.966c3.124-3.124 8.194-3.129 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319L69.662 122.22a7.986 7.986 0 01-5.663 2.346z\"/></g></svg>"},"$:/core/images/unfold-button":{"title":"$:/core/images/unfold-button","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-unfold tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" rx=\"8\"/><path d=\"M63.945 63.624c-2.05 0-4.101-.78-5.666-2.345L35.662 38.662c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.192-3.122 11.319.005L63.94 44.314l16.966-16.966c3.124-3.124 8.194-3.129 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319L69.603 61.279a7.986 7.986 0 01-5.663 2.346zM64.004 105.682c-2.05.001-4.102-.78-5.666-2.344L35.721 80.721c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.191-3.122 11.318.005L64 86.373l16.966-16.966c3.124-3.125 8.194-3.13 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319l-22.617 22.617a7.986 7.986 0 01-5.663 2.346z\"/></g></svg>"},"$:/core/images/unlocked-padlock":{"title":"$:/core/images/unlocked-padlock","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-unlocked-padlock tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M48.627 64H105v32.01C105 113.674 90.674 128 73.001 128H56C38.318 128 24 113.677 24 96.01V64h6.136c-10.455-12.651-27.364-35.788-4.3-55.142 24.636-20.672 45.835 4.353 55.777 16.201 9.943 11.85-2.676 22.437-12.457 9.892-9.78-12.545-21.167-24.146-33.207-14.043-12.041 10.104-1.757 22.36 8.813 34.958 2.467 2.94 3.641 5.732 3.865 8.134zm19.105 28.364A8.503 8.503 0 0064.5 76a8.5 8.5 0 00-3.498 16.25l-5.095 22.77H72.8l-5.07-22.656z\"/></svg>"},"$:/core/images/up-arrow":{"title":"$:/core/images/up-arrow","created":"20150316000544368","modified":"20150316000831867","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-up-arrow tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M63.892.281c2.027 0 4.054.77 5.6 2.316l55.98 55.98a7.92 7.92 0 010 11.196c-3.086 3.085-8.104 3.092-11.196 0L63.894 19.393 13.513 69.774a7.92 7.92 0 01-11.196 0c-3.085-3.086-3.092-8.105 0-11.196l55.98-55.98A7.892 7.892 0 0163.893.28z\"/></svg>"},"$:/core/images/video":{"title":"$:/core/images/video","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-video tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M64 12c-34.91 0-55.273 2.917-58.182 5.833C2.91 20.75 0 41.167 0 64.5c0 23.333 2.91 43.75 5.818 46.667C8.728 114.083 29.091 117 64 117c34.91 0 55.273-2.917 58.182-5.833C125.09 108.25 128 87.833 128 64.5c0-23.333-2.91-43.75-5.818-46.667C119.272 14.917 98.909 12 64 12zm-9.084 32.618c-3.813-2.542-6.905-.879-6.905 3.698v31.368c0 4.585 3.099 6.235 6.905 3.698l22.168-14.779c3.813-2.542 3.806-6.669 0-9.206L54.916 44.618z\"/></svg>"},"$:/core/images/warning":{"title":"$:/core/images/warning","tags":"$:/tags/Image","text":"\\parameters (size:\"22pt\")\n<svg width=<<size>> height=<<size>> class=\"tc-image-warning tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M57.072 11c3.079-5.333 10.777-5.333 13.856 0l55.426 96c3.079 5.333-.77 12-6.928 12H8.574c-6.158 0-10.007-6.667-6.928-12l55.426-96zM64 37c-4.418 0-8 3.582-8 7.994v28.012C56 77.421 59.59 81 64 81c4.418 0 8-3.582 8-7.994V44.994C72 40.579 68.41 37 64 37zm0 67a8 8 0 100-16 8 8 0 000 16z\"/></svg>"},"$:/language/Buttons/AdvancedSearch/Caption":{"title":"$:/language/Buttons/AdvancedSearch/Caption","text":"advanced search"},"$:/language/Buttons/AdvancedSearch/Hint":{"title":"$:/language/Buttons/AdvancedSearch/Hint","text":"Advanced search"},"$:/language/Buttons/Cancel/Caption":{"title":"$:/language/Buttons/Cancel/Caption","text":"cancel"},"$:/language/Buttons/Cancel/Hint":{"title":"$:/language/Buttons/Cancel/Hint","text":"Discard changes to this tiddler"},"$:/language/Buttons/Clone/Caption":{"title":"$:/language/Buttons/Clone/Caption","text":"clone"},"$:/language/Buttons/Clone/Hint":{"title":"$:/language/Buttons/Clone/Hint","text":"Clone this tiddler"},"$:/language/Buttons/Close/Caption":{"title":"$:/language/Buttons/Close/Caption","text":"close"},"$:/language/Buttons/Close/Hint":{"title":"$:/language/Buttons/Close/Hint","text":"Close this tiddler"},"$:/language/Buttons/CloseAll/Caption":{"title":"$:/language/Buttons/CloseAll/Caption","text":"close all"},"$:/language/Buttons/CloseAll/Hint":{"title":"$:/language/Buttons/CloseAll/Hint","text":"Close all tiddlers"},"$:/language/Buttons/CloseOthers/Caption":{"title":"$:/language/Buttons/CloseOthers/Caption","text":"close others"},"$:/language/Buttons/CloseOthers/Hint":{"title":"$:/language/Buttons/CloseOthers/Hint","text":"Close other tiddlers"},"$:/language/Buttons/ControlPanel/Caption":{"title":"$:/language/Buttons/ControlPanel/Caption","text":"control panel"},"$:/language/Buttons/ControlPanel/Hint":{"title":"$:/language/Buttons/ControlPanel/Hint","text":"Open control panel"},"$:/language/Buttons/CopyToClipboard/Caption":{"title":"$:/language/Buttons/CopyToClipboard/Caption","text":"copy to clipboard"},"$:/language/Buttons/CopyToClipboard/Hint":{"title":"$:/language/Buttons/CopyToClipboard/Hint","text":"Copy this text to the clipboard"},"$:/language/Buttons/Delete/Caption":{"title":"$:/language/Buttons/Delete/Caption","text":"delete"},"$:/language/Buttons/Delete/Hint":{"title":"$:/language/Buttons/Delete/Hint","text":"Delete this tiddler"},"$:/language/Buttons/DeleteTiddlers/Caption":{"title":"$:/language/Buttons/DeleteTiddlers/Caption","text":"delete tiddlers"},"$:/language/Buttons/DeleteTiddlers/Hint":{"title":"$:/language/Buttons/DeleteTiddlers/Hint","text":"Delete tiddlers"},"$:/language/Buttons/Edit/Caption":{"title":"$:/language/Buttons/Edit/Caption","text":"edit"},"$:/language/Buttons/Edit/Hint":{"title":"$:/language/Buttons/Edit/Hint","text":"Edit this tiddler"},"$:/language/Buttons/Encryption/Caption":{"title":"$:/language/Buttons/Encryption/Caption","text":"encryption"},"$:/language/Buttons/Encryption/Hint":{"title":"$:/language/Buttons/Encryption/Hint","text":"Set or clear a password for saving this wiki"},"$:/language/Buttons/Encryption/ClearPassword/Caption":{"title":"$:/language/Buttons/Encryption/ClearPassword/Caption","text":"clear password"},"$:/language/Buttons/Encryption/ClearPassword/Hint":{"title":"$:/language/Buttons/Encryption/ClearPassword/Hint","text":"Clear the password and save this wiki without encryption"},"$:/language/Buttons/Encryption/SetPassword/Caption":{"title":"$:/language/Buttons/Encryption/SetPassword/Caption","text":"set password"},"$:/language/Buttons/Encryption/SetPassword/Hint":{"title":"$:/language/Buttons/Encryption/SetPassword/Hint","text":"Set a password for saving this wiki with encryption"},"$:/language/Buttons/EmergencyDownload/Caption":{"title":"$:/language/Buttons/EmergencyDownload/Caption","text":"download tiddlers as json"},"$:/language/Buttons/ExportPage/Caption":{"title":"$:/language/Buttons/ExportPage/Caption","text":"export all"},"$:/language/Buttons/ExportPage/Hint":{"title":"$:/language/Buttons/ExportPage/Hint","text":"Export all tiddlers"},"$:/language/Buttons/ExportTiddler/Caption":{"title":"$:/language/Buttons/ExportTiddler/Caption","text":"export tiddler"},"$:/language/Buttons/ExportTiddler/Hint":{"title":"$:/language/Buttons/ExportTiddler/Hint","text":"Export tiddler"},"$:/language/Buttons/ExportTiddlers/Caption":{"title":"$:/language/Buttons/ExportTiddlers/Caption","text":"export tiddlers"},"$:/language/Buttons/ExportTiddlers/Hint":{"title":"$:/language/Buttons/ExportTiddlers/Hint","text":"Export tiddlers"},"$:/language/Buttons/SidebarSearch/Hint":{"title":"$:/language/Buttons/SidebarSearch/Hint","text":"Select the sidebar search field"},"$:/language/Buttons/Fold/Caption":{"title":"$:/language/Buttons/Fold/Caption","text":"fold tiddler"},"$:/language/Buttons/Fold/Hint":{"title":"$:/language/Buttons/Fold/Hint","text":"Fold the body of this tiddler"},"$:/language/Buttons/Fold/FoldBar/Caption":{"title":"$:/language/Buttons/Fold/FoldBar/Caption","text":"fold-bar"},"$:/language/Buttons/Fold/FoldBar/Hint":{"title":"$:/language/Buttons/Fold/FoldBar/Hint","text":"Optional bars to fold and unfold tiddlers"},"$:/language/Buttons/Unfold/Caption":{"title":"$:/language/Buttons/Unfold/Caption","text":"unfold tiddler"},"$:/language/Buttons/Unfold/Hint":{"title":"$:/language/Buttons/Unfold/Hint","text":"Unfold the body of this tiddler"},"$:/language/Buttons/FoldOthers/Caption":{"title":"$:/language/Buttons/FoldOthers/Caption","text":"fold other tiddlers"},"$:/language/Buttons/FoldOthers/Hint":{"title":"$:/language/Buttons/FoldOthers/Hint","text":"Fold the bodies of other opened tiddlers"},"$:/language/Buttons/FoldAll/Caption":{"title":"$:/language/Buttons/FoldAll/Caption","text":"fold all tiddlers"},"$:/language/Buttons/FoldAll/Hint":{"title":"$:/language/Buttons/FoldAll/Hint","text":"Fold the bodies of all opened tiddlers"},"$:/language/Buttons/UnfoldAll/Caption":{"title":"$:/language/Buttons/UnfoldAll/Caption","text":"unfold all tiddlers"},"$:/language/Buttons/UnfoldAll/Hint":{"title":"$:/language/Buttons/UnfoldAll/Hint","text":"Unfold the bodies of all opened tiddlers"},"$:/language/Buttons/FullScreen/Caption":{"title":"$:/language/Buttons/FullScreen/Caption","text":"full-screen"},"$:/language/Buttons/FullScreen/Hint":{"title":"$:/language/Buttons/FullScreen/Hint","text":"Enter or leave full-screen mode"},"$:/language/Buttons/Help/Caption":{"title":"$:/language/Buttons/Help/Caption","text":"help"},"$:/language/Buttons/Help/Hint":{"title":"$:/language/Buttons/Help/Hint","text":"Show help panel"},"$:/language/Buttons/Import/Caption":{"title":"$:/language/Buttons/Import/Caption","text":"import"},"$:/language/Buttons/Import/Hint":{"title":"$:/language/Buttons/Import/Hint","text":"Import many types of file including text, image, TiddlyWiki or JSON"},"$:/language/Buttons/Info/Caption":{"title":"$:/language/Buttons/Info/Caption","text":"info"},"$:/language/Buttons/Info/Hint":{"title":"$:/language/Buttons/Info/Hint","text":"Show information for this tiddler"},"$:/language/Buttons/Home/Caption":{"title":"$:/language/Buttons/Home/Caption","text":"home"},"$:/language/Buttons/Home/Hint":{"title":"$:/language/Buttons/Home/Hint","text":"Open the default tiddlers"},"$:/language/Buttons/Language/Caption":{"title":"$:/language/Buttons/Language/Caption","text":"language"},"$:/language/Buttons/Language/Hint":{"title":"$:/language/Buttons/Language/Hint","text":"Choose the user interface language"},"$:/language/Buttons/LayoutSwitcher/Hint":{"title":"$:/language/Buttons/LayoutSwitcher/Hint","text":"Open layout switcher"},"$:/language/Buttons/LayoutSwitcher/Caption":{"title":"$:/language/Buttons/LayoutSwitcher/Caption","text":"layout"},"$:/language/Buttons/Manager/Caption":{"title":"$:/language/Buttons/Manager/Caption","text":"tiddler manager"},"$:/language/Buttons/Manager/Hint":{"title":"$:/language/Buttons/Manager/Hint","text":"Open tiddler manager"},"$:/language/Buttons/More/Caption":{"title":"$:/language/Buttons/More/Caption","text":"more"},"$:/language/Buttons/More/Hint":{"title":"$:/language/Buttons/More/Hint","text":"More actions"},"$:/language/Buttons/NewHere/Caption":{"title":"$:/language/Buttons/NewHere/Caption","text":"new here"},"$:/language/Buttons/NewHere/Hint":{"title":"$:/language/Buttons/NewHere/Hint","text":"Create a new tiddler tagged with this one"},"$:/language/Buttons/NetworkActivity/Caption":{"title":"$:/language/Buttons/NetworkActivity/Caption","text":"network activity"},"$:/language/Buttons/NetworkActivity/Hint":{"title":"$:/language/Buttons/NetworkActivity/Hint","text":"Cancel all network activity"},"$:/language/Buttons/NewJournal/Caption":{"title":"$:/language/Buttons/NewJournal/Caption","text":"new journal"},"$:/language/Buttons/NewJournal/Hint":{"title":"$:/language/Buttons/NewJournal/Hint","text":"Create a new journal tiddler"},"$:/language/Buttons/NewJournalHere/Caption":{"title":"$:/language/Buttons/NewJournalHere/Caption","text":"new journal here"},"$:/language/Buttons/NewJournalHere/Hint":{"title":"$:/language/Buttons/NewJournalHere/Hint","text":"Create a new journal tiddler tagged with this one"},"$:/language/Buttons/NewImage/Caption":{"title":"$:/language/Buttons/NewImage/Caption","text":"new image"},"$:/language/Buttons/NewImage/Hint":{"title":"$:/language/Buttons/NewImage/Hint","text":"Create a new image tiddler"},"$:/language/Buttons/NewMarkdown/Caption":{"title":"$:/language/Buttons/NewMarkdown/Caption","text":"new Markdown tiddler"},"$:/language/Buttons/NewMarkdown/Hint":{"title":"$:/language/Buttons/NewMarkdown/Hint","text":"Create a new Markdown tiddler"},"$:/language/Buttons/NewTiddler/Caption":{"title":"$:/language/Buttons/NewTiddler/Caption","text":"new tiddler"},"$:/language/Buttons/NewTiddler/Hint":{"title":"$:/language/Buttons/NewTiddler/Hint","text":"Create a new tiddler"},"$:/language/Buttons/OpenControlPanel/Hint":{"title":"$:/language/Buttons/OpenControlPanel/Hint","text":"Open control panel"},"$:/language/Buttons/OpenWindow/Caption":{"title":"$:/language/Buttons/OpenWindow/Caption","text":"open in new window"},"$:/language/Buttons/OpenWindow/Hint":{"title":"$:/language/Buttons/OpenWindow/Hint","text":"Open tiddler in new window"},"$:/language/Buttons/Palette/Caption":{"title":"$:/language/Buttons/Palette/Caption","text":"palette"},"$:/language/Buttons/Palette/Hint":{"title":"$:/language/Buttons/Palette/Hint","text":"Choose the colour palette"},"$:/language/Buttons/Permalink/Caption":{"title":"$:/language/Buttons/Permalink/Caption","text":"permalink"},"$:/language/Buttons/Permalink/Hint":{"title":"$:/language/Buttons/Permalink/Hint","text":"Set browser address bar to a direct link to this tiddler"},"$:/language/Buttons/Permaview/Caption":{"title":"$:/language/Buttons/Permaview/Caption","text":"permaview"},"$:/language/Buttons/Permaview/Hint":{"title":"$:/language/Buttons/Permaview/Hint","text":"Set browser address bar to a direct link to all the tiddlers in this story"},"$:/language/Buttons/Print/Caption":{"title":"$:/language/Buttons/Print/Caption","text":"print page"},"$:/language/Buttons/Print/Hint":{"title":"$:/language/Buttons/Print/Hint","text":"Print the current page"},"$:/language/Buttons/Refresh/Caption":{"title":"$:/language/Buttons/Refresh/Caption","text":"refresh"},"$:/language/Buttons/Refresh/Hint":{"title":"$:/language/Buttons/Refresh/Hint","text":"Perform a full refresh of the wiki"},"$:/language/Buttons/Save/Caption":{"title":"$:/language/Buttons/Save/Caption","text":"ok"},"$:/language/Buttons/Save/Hint":{"title":"$:/language/Buttons/Save/Hint","text":"Confirm changes to this tiddler"},"$:/language/Buttons/SaveWiki/Caption":{"title":"$:/language/Buttons/SaveWiki/Caption","text":"save changes"},"$:/language/Buttons/SaveWiki/Hint":{"title":"$:/language/Buttons/SaveWiki/Hint","text":"Save changes"},"$:/language/Buttons/StoryView/Caption":{"title":"$:/language/Buttons/StoryView/Caption","text":"storyview"},"$:/language/Buttons/StoryView/Hint":{"title":"$:/language/Buttons/StoryView/Hint","text":"Choose the story visualisation"},"$:/language/Buttons/HideSideBar/Caption":{"title":"$:/language/Buttons/HideSideBar/Caption","text":"hide sidebar"},"$:/language/Buttons/HideSideBar/Hint":{"title":"$:/language/Buttons/HideSideBar/Hint","text":"Hide sidebar"},"$:/language/Buttons/ShowSideBar/Caption":{"title":"$:/language/Buttons/ShowSideBar/Caption","text":"show sidebar"},"$:/language/Buttons/ShowSideBar/Hint":{"title":"$:/language/Buttons/ShowSideBar/Hint","text":"Show sidebar"},"$:/language/Buttons/TagManager/Caption":{"title":"$:/language/Buttons/TagManager/Caption","text":"tag manager"},"$:/language/Buttons/TagManager/Hint":{"title":"$:/language/Buttons/TagManager/Hint","text":"Open tag manager"},"$:/language/Buttons/TestCaseImport/Caption":{"title":"$:/language/Buttons/TestCaseImport/Caption","text":"import tiddlers"},"$:/language/Buttons/TestCaseImport/Hint":{"title":"$:/language/Buttons/TestCaseImport/Hint","text":"Import tiddlers"},"$:/language/Buttons/Timestamp/Caption":{"title":"$:/language/Buttons/Timestamp/Caption","text":"timestamps"},"$:/language/Buttons/Timestamp/Hint":{"title":"$:/language/Buttons/Timestamp/Hint","text":"Choose whether modifications update timestamps"},"$:/language/Buttons/Timestamp/On/Caption":{"title":"$:/language/Buttons/Timestamp/On/Caption","text":"timestamps are on"},"$:/language/Buttons/Timestamp/On/Hint":{"title":"$:/language/Buttons/Timestamp/On/Hint","text":"Update timestamps when tiddlers are modified"},"$:/language/Buttons/Timestamp/Off/Caption":{"title":"$:/language/Buttons/Timestamp/Off/Caption","text":"timestamps are off"},"$:/language/Buttons/Timestamp/Off/Hint":{"title":"$:/language/Buttons/Timestamp/Off/Hint","text":"Don't update timestamps when tiddlers are modified"},"$:/language/Buttons/Theme/Caption":{"title":"$:/language/Buttons/Theme/Caption","text":"theme"},"$:/language/Buttons/Theme/Hint":{"title":"$:/language/Buttons/Theme/Hint","text":"Choose the display theme"},"$:/language/Buttons/Bold/Caption":{"title":"$:/language/Buttons/Bold/Caption","text":"bold"},"$:/language/Buttons/Bold/Hint":{"title":"$:/language/Buttons/Bold/Hint","text":"Apply bold formatting to selection"},"$:/language/Buttons/Clear/Caption":{"title":"$:/language/Buttons/Clear/Caption","text":"clear"},"$:/language/Buttons/Clear/Hint":{"title":"$:/language/Buttons/Clear/Hint","text":"Clear image to solid colour"},"$:/language/Buttons/EditorHeight/Caption":{"title":"$:/language/Buttons/EditorHeight/Caption","text":"editor height"},"$:/language/Buttons/EditorHeight/Caption/Auto":{"title":"$:/language/Buttons/EditorHeight/Caption/Auto","text":"Automatically adjust height to fit content"},"$:/language/Buttons/EditorHeight/Caption/Fixed":{"title":"$:/language/Buttons/EditorHeight/Caption/Fixed","text":"Fixed height:"},"$:/language/Buttons/EditorHeight/Hint":{"title":"$:/language/Buttons/EditorHeight/Hint","text":"Choose the height of the text editor"},"$:/language/Buttons/Excise/Caption":{"title":"$:/language/Buttons/Excise/Caption","text":"excise"},"$:/language/Buttons/Excise/Caption/Excise":{"title":"$:/language/Buttons/Excise/Caption/Excise","text":"Perform excision"},"$:/language/Buttons/Excise/Caption/MacroName":{"title":"$:/language/Buttons/Excise/Caption/MacroName","text":"Macro name:"},"$:/language/Buttons/Excise/Caption/NewTitle":{"title":"$:/language/Buttons/Excise/Caption/NewTitle","text":"Title of new tiddler:"},"$:/language/Buttons/Excise/Caption/Replace":{"title":"$:/language/Buttons/Excise/Caption/Replace","text":"Replace excised text with:"},"$:/language/Buttons/Excise/Caption/Replace/Macro":{"title":"$:/language/Buttons/Excise/Caption/Replace/Macro","text":"macro"},"$:/language/Buttons/Excise/Caption/Replace/Link":{"title":"$:/language/Buttons/Excise/Caption/Replace/Link","text":"link"},"$:/language/Buttons/Excise/Caption/Replace/Transclusion":{"title":"$:/language/Buttons/Excise/Caption/Replace/Transclusion","text":"transclusion"},"$:/language/Buttons/Excise/Caption/Tag":{"title":"$:/language/Buttons/Excise/Caption/Tag","text":"Tag new tiddler with the title of this tiddler"},"$:/language/Buttons/Excise/Caption/TiddlerExists":{"title":"$:/language/Buttons/Excise/Caption/TiddlerExists","text":"Warning: tiddler already exists"},"$:/language/Buttons/Excise/DefaultTitle":{"title":"$:/language/Buttons/Excise/DefaultTitle","text":"New Excision"},"$:/language/Buttons/Excise/Hint":{"title":"$:/language/Buttons/Excise/Hint","text":"Excise the selected text into a new tiddler"},"$:/language/Buttons/Heading1/Caption":{"title":"$:/language/Buttons/Heading1/Caption","text":"heading 1"},"$:/language/Buttons/Heading1/Hint":{"title":"$:/language/Buttons/Heading1/Hint","text":"Apply heading level 1 formatting to lines containing selection"},"$:/language/Buttons/Heading2/Caption":{"title":"$:/language/Buttons/Heading2/Caption","text":"heading 2"},"$:/language/Buttons/Heading2/Hint":{"title":"$:/language/Buttons/Heading2/Hint","text":"Apply heading level 2 formatting to lines containing selection"},"$:/language/Buttons/Heading3/Caption":{"title":"$:/language/Buttons/Heading3/Caption","text":"heading 3"},"$:/language/Buttons/Heading3/Hint":{"title":"$:/language/Buttons/Heading3/Hint","text":"Apply heading level 3 formatting to lines containing selection"},"$:/language/Buttons/Heading4/Caption":{"title":"$:/language/Buttons/Heading4/Caption","text":"heading 4"},"$:/language/Buttons/Heading4/Hint":{"title":"$:/language/Buttons/Heading4/Hint","text":"Apply heading level 4 formatting to lines containing selection"},"$:/language/Buttons/Heading5/Caption":{"title":"$:/language/Buttons/Heading5/Caption","text":"heading 5"},"$:/language/Buttons/Heading5/Hint":{"title":"$:/language/Buttons/Heading5/Hint","text":"Apply heading level 5 formatting to lines containing selection"},"$:/language/Buttons/Heading6/Caption":{"title":"$:/language/Buttons/Heading6/Caption","text":"heading 6"},"$:/language/Buttons/Heading6/Hint":{"title":"$:/language/Buttons/Heading6/Hint","text":"Apply heading level 6 formatting to lines containing selection"},"$:/language/Buttons/Italic/Caption":{"title":"$:/language/Buttons/Italic/Caption","text":"italic"},"$:/language/Buttons/Italic/Hint":{"title":"$:/language/Buttons/Italic/Hint","text":"Apply italic formatting to selection"},"$:/language/Buttons/LineWidth/Caption":{"title":"$:/language/Buttons/LineWidth/Caption","text":"line width"},"$:/language/Buttons/LineWidth/Hint":{"title":"$:/language/Buttons/LineWidth/Hint","text":"Set line width for painting"},"$:/language/Buttons/Link/Caption":{"title":"$:/language/Buttons/Link/Caption","text":"link"},"$:/language/Buttons/Link/Hint":{"title":"$:/language/Buttons/Link/Hint","text":"Create wikitext link"},"$:/language/Buttons/Linkify/Caption":{"title":"$:/language/Buttons/Linkify/Caption","text":"wikilink"},"$:/language/Buttons/Linkify/Hint":{"title":"$:/language/Buttons/Linkify/Hint","text":"Wrap selection in square brackets"},"$:/language/Buttons/ListBullet/Caption":{"title":"$:/language/Buttons/ListBullet/Caption","text":"bulleted list"},"$:/language/Buttons/ListBullet/Hint":{"title":"$:/language/Buttons/ListBullet/Hint","text":"Apply bulleted list formatting to lines containing selection"},"$:/language/Buttons/ListNumber/Caption":{"title":"$:/language/Buttons/ListNumber/Caption","text":"numbered list"},"$:/language/Buttons/ListNumber/Hint":{"title":"$:/language/Buttons/ListNumber/Hint","text":"Apply numbered list formatting to lines containing selection"},"$:/language/Buttons/MonoBlock/Caption":{"title":"$:/language/Buttons/MonoBlock/Caption","text":"monospaced block"},"$:/language/Buttons/MonoBlock/Hint":{"title":"$:/language/Buttons/MonoBlock/Hint","text":"Apply monospaced block formatting to lines containing selection"},"$:/language/Buttons/MonoLine/Caption":{"title":"$:/language/Buttons/MonoLine/Caption","text":"monospaced"},"$:/language/Buttons/MonoLine/Hint":{"title":"$:/language/Buttons/MonoLine/Hint","text":"Apply monospaced character formatting to selection"},"$:/language/Buttons/Opacity/Caption":{"title":"$:/language/Buttons/Opacity/Caption","text":"opacity"},"$:/language/Buttons/Opacity/Hint":{"title":"$:/language/Buttons/Opacity/Hint","text":"Set painting opacity"},"$:/language/Buttons/Paint/Caption":{"title":"$:/language/Buttons/Paint/Caption","text":"paint colour"},"$:/language/Buttons/Paint/Hint":{"title":"$:/language/Buttons/Paint/Hint","text":"Set painting colour"},"$:/language/Buttons/Picture/Caption":{"title":"$:/language/Buttons/Picture/Caption","text":"picture"},"$:/language/Buttons/Picture/Hint":{"title":"$:/language/Buttons/Picture/Hint","text":"Insert picture"},"$:/language/Buttons/Preview/Caption":{"title":"$:/language/Buttons/Preview/Caption","text":"preview"},"$:/language/Buttons/Preview/Hint":{"title":"$:/language/Buttons/Preview/Hint","text":"Show preview pane"},"$:/language/Buttons/PreviewType/Caption":{"title":"$:/language/Buttons/PreviewType/Caption","text":"preview type"},"$:/language/Buttons/PreviewType/Hint":{"title":"$:/language/Buttons/PreviewType/Hint","text":"Choose preview type"},"$:/language/Buttons/Quote/Caption":{"title":"$:/language/Buttons/Quote/Caption","text":"quote"},"$:/language/Buttons/Quote/Hint":{"title":"$:/language/Buttons/Quote/Hint","text":"Apply quoted text formatting to lines containing selection"},"$:/language/Buttons/RotateLeft/Caption":{"title":"$:/language/Buttons/RotateLeft/Caption","text":"rotate left"},"$:/language/Buttons/RotateLeft/Hint":{"title":"$:/language/Buttons/RotateLeft/Hint","text":"Rotate image left by 90 degrees"},"$:/language/Buttons/Size/Caption":{"title":"$:/language/Buttons/Size/Caption","text":"image size"},"$:/language/Buttons/Size/Caption/Height":{"title":"$:/language/Buttons/Size/Caption/Height","text":"Height:"},"$:/language/Buttons/Size/Caption/Resize":{"title":"$:/language/Buttons/Size/Caption/Resize","text":"Resize image"},"$:/language/Buttons/Size/Caption/Width":{"title":"$:/language/Buttons/Size/Caption/Width","text":"Width:"},"$:/language/Buttons/Size/Hint":{"title":"$:/language/Buttons/Size/Hint","text":"Set image size"},"$:/language/Buttons/Stamp/Caption":{"title":"$:/language/Buttons/Stamp/Caption","text":"stamp"},"$:/language/Buttons/Stamp/Caption/New":{"title":"$:/language/Buttons/Stamp/Caption/New","text":"Add your own"},"$:/language/Buttons/Stamp/Hint":{"title":"$:/language/Buttons/Stamp/Hint","text":"Insert a preconfigured snippet of text"},"$:/language/Buttons/Stamp/New/Title":{"title":"$:/language/Buttons/Stamp/New/Title","text":"Name as shown in menu"},"$:/language/Buttons/Stamp/New/Text":{"title":"$:/language/Buttons/Stamp/New/Text","text":"Text of snippet. (Remember to add a descriptive title in the caption field)."},"$:/language/Buttons/Strikethrough/Caption":{"title":"$:/language/Buttons/Strikethrough/Caption","text":"strikethrough"},"$:/language/Buttons/Strikethrough/Hint":{"title":"$:/language/Buttons/Strikethrough/Hint","text":"Apply strikethrough formatting to selection"},"$:/language/Buttons/Subscript/Caption":{"title":"$:/language/Buttons/Subscript/Caption","text":"subscript"},"$:/language/Buttons/Subscript/Hint":{"title":"$:/language/Buttons/Subscript/Hint","text":"Apply subscript formatting to selection"},"$:/language/Buttons/Superscript/Caption":{"title":"$:/language/Buttons/Superscript/Caption","text":"superscript"},"$:/language/Buttons/Superscript/Hint":{"title":"$:/language/Buttons/Superscript/Hint","text":"Apply superscript formatting to selection"},"$:/language/Buttons/ToggleSidebar/Hint":{"title":"$:/language/Buttons/ToggleSidebar/Hint","text":"Toggle the sidebar visibility"},"$:/language/Buttons/Transcludify/Caption":{"title":"$:/language/Buttons/Transcludify/Caption","text":"transclusion"},"$:/language/Buttons/Transcludify/Hint":{"title":"$:/language/Buttons/Transcludify/Hint","text":"Wrap selection in curly brackets"},"$:/language/Buttons/Underline/Caption":{"title":"$:/language/Buttons/Underline/Caption","text":"underline"},"$:/language/Buttons/Underline/Hint":{"title":"$:/language/Buttons/Underline/Hint","text":"Apply underline formatting to selection"},"$:/language/ControlPanel/Advanced/Caption":{"title":"$:/language/ControlPanel/Advanced/Caption","text":"Advanced"},"$:/language/ControlPanel/Advanced/Hint":{"title":"$:/language/ControlPanel/Advanced/Hint","text":"Internal information about this TiddlyWiki"},"$:/language/ControlPanel/Appearance/Caption":{"title":"$:/language/ControlPanel/Appearance/Caption","text":"Appearance"},"$:/language/ControlPanel/Appearance/Hint":{"title":"$:/language/ControlPanel/Appearance/Hint","text":"Ways to customise the appearance of your TiddlyWiki."},"$:/language/ControlPanel/Basics/AnimDuration/Prompt":{"title":"$:/language/ControlPanel/Basics/AnimDuration/Prompt","text":"Animation duration"},"$:/language/ControlPanel/Basics/AutoFocus/Prompt":{"title":"$:/language/ControlPanel/Basics/AutoFocus/Prompt","text":"Default focus field for new tiddlers"},"$:/language/ControlPanel/Basics/Caption":{"title":"$:/language/ControlPanel/Basics/Caption","text":"Basics"},"$:/language/ControlPanel/Basics/DefaultTiddlers/BottomHint":{"title":"$:/language/ControlPanel/Basics/DefaultTiddlers/BottomHint","text":"Use [[double square brackets]] for titles with spaces. Or you can choose to {{retain story ordering||$:/snippets/retain-story-ordering-button}}"},"$:/language/ControlPanel/Basics/DefaultTiddlers/Prompt":{"title":"$:/language/ControlPanel/Basics/DefaultTiddlers/Prompt","text":"Default tiddlers"},"$:/language/ControlPanel/Basics/DefaultTiddlers/TopHint":{"title":"$:/language/ControlPanel/Basics/DefaultTiddlers/TopHint","text":"Choose which tiddlers are displayed at startup"},"$:/language/ControlPanel/Basics/Language/Prompt":{"title":"$:/language/ControlPanel/Basics/Language/Prompt","text":"Hello! Current language:"},"$:/language/ControlPanel/Basics/NewJournal/Title/Prompt":{"title":"$:/language/ControlPanel/Basics/NewJournal/Title/Prompt","text":"Title of new journal tiddlers"},"$:/language/ControlPanel/Basics/NewJournal/Text/Prompt":{"title":"$:/language/ControlPanel/Basics/NewJournal/Text/Prompt","text":"Text for new journal tiddlers"},"$:/language/ControlPanel/Basics/NewJournal/Tags/Prompt":{"title":"$:/language/ControlPanel/Basics/NewJournal/Tags/Prompt","text":"Tags for new journal tiddlers"},"$:/language/ControlPanel/Basics/NewTiddler/Title/Prompt":{"title":"$:/language/ControlPanel/Basics/NewTiddler/Title/Prompt","text":"Title of new tiddlers"},"$:/language/ControlPanel/Basics/NewTiddler/Tags/Prompt":{"title":"$:/language/ControlPanel/Basics/NewTiddler/Tags/Prompt","text":"Tags for new tiddlers"},"$:/language/ControlPanel/Basics/OverriddenShadowTiddlers/Prompt":{"title":"$:/language/ControlPanel/Basics/OverriddenShadowTiddlers/Prompt","text":"Number of overridden shadow tiddlers"},"$:/language/ControlPanel/Basics/RemoveTags":{"title":"$:/language/ControlPanel/Basics/RemoveTags","text":"Update to current format"},"$:/language/ControlPanel/Basics/RemoveTags/Hint":{"title":"$:/language/ControlPanel/Basics/RemoveTags/Hint","text":"Update the tags configuration to the latest format"},"$:/language/ControlPanel/Basics/ShadowTiddlers/Prompt":{"title":"$:/language/ControlPanel/Basics/ShadowTiddlers/Prompt","text":"Number of shadow tiddlers"},"$:/language/ControlPanel/Basics/Subtitle/Prompt":{"title":"$:/language/ControlPanel/Basics/Subtitle/Prompt","text":"Subtitle"},"$:/language/ControlPanel/Basics/SystemTiddlers/Prompt":{"title":"$:/language/ControlPanel/Basics/SystemTiddlers/Prompt","text":"Number of system tiddlers"},"$:/language/ControlPanel/Basics/Tags/Prompt":{"title":"$:/language/ControlPanel/Basics/Tags/Prompt","text":"Number of tags"},"$:/language/ControlPanel/Basics/Tiddlers/Prompt":{"title":"$:/language/ControlPanel/Basics/Tiddlers/Prompt","text":"Number of tiddlers"},"$:/language/ControlPanel/Basics/Title/Prompt":{"title":"$:/language/ControlPanel/Basics/Title/Prompt","text":"Title of this ~TiddlyWiki"},"$:/language/ControlPanel/Basics/Username/Prompt":{"title":"$:/language/ControlPanel/Basics/Username/Prompt","text":"Username for signing edits"},"$:/language/ControlPanel/Basics/Version/Prompt":{"title":"$:/language/ControlPanel/Basics/Version/Prompt","text":"~TiddlyWiki version"},"$:/language/ControlPanel/Cascades/Caption":{"title":"$:/language/ControlPanel/Cascades/Caption","text":"Cascades"},"$:/language/ControlPanel/Cascades/Hint":{"title":"$:/language/ControlPanel/Cascades/Hint","text":"These global rules are used to dynamically choose certain templates. The result of the cascade is the result of the first filter in the sequence that returns a result"},"$:/language/ControlPanel/Cascades/TagPrompt":{"title":"$:/language/ControlPanel/Cascades/TagPrompt","text":"Filters tagged <$macrocall $name=\"tag\" tag=<<currentTiddler>>/>"},"$:/language/ControlPanel/EditorTypes/Caption":{"title":"$:/language/ControlPanel/EditorTypes/Caption","text":"Editor Types"},"$:/language/ControlPanel/EditorTypes/Editor/Caption":{"title":"$:/language/ControlPanel/EditorTypes/Editor/Caption","text":"Editor"},"$:/language/ControlPanel/EditorTypes/Hint":{"title":"$:/language/ControlPanel/EditorTypes/Hint","text":"These tiddlers determine which editor is used to edit specific tiddler types."},"$:/language/ControlPanel/EditorTypes/Type/Caption":{"title":"$:/language/ControlPanel/EditorTypes/Type/Caption","text":"Type"},"$:/language/ControlPanel/EditTemplateBody/Caption":{"title":"$:/language/ControlPanel/EditTemplateBody/Caption","text":"Edit Template Body"},"$:/language/ControlPanel/EditTemplateBody/Hint":{"title":"$:/language/ControlPanel/EditTemplateBody/Hint","text":"This rule cascade is used by the default edit template to dynamically choose the template for editing the body of a tiddler."},"$:/language/ControlPanel/FieldEditor/Caption":{"title":"$:/language/ControlPanel/FieldEditor/Caption","text":"Field Editor"},"$:/language/ControlPanel/FieldEditor/Hint":{"title":"$:/language/ControlPanel/FieldEditor/Hint","text":"This rules cascade is used to dynamically choose the template for rendering a tiddler field based on its name. It is used within the Edit Template."},"$:/language/ControlPanel/Info/Caption":{"title":"$:/language/ControlPanel/Info/Caption","text":"Info"},"$:/language/ControlPanel/Info/Hint":{"title":"$:/language/ControlPanel/Info/Hint","text":"Information about this TiddlyWiki"},"$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt","text":"Type shortcut here"},"$:/language/ControlPanel/KeyboardShortcuts/Add/Caption":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Add/Caption","text":"add shortcut"},"$:/language/ControlPanel/KeyboardShortcuts/Caption":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Caption","text":"Keyboard Shortcuts"},"$:/language/ControlPanel/KeyboardShortcuts/Hint":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Hint","text":"Manage keyboard shortcut assignments"},"$:/language/ControlPanel/KeyboardShortcuts/NoShortcuts/Caption":{"title":"$:/language/ControlPanel/KeyboardShortcuts/NoShortcuts/Caption","text":"No keyboard shortcuts assigned"},"$:/language/ControlPanel/KeyboardShortcuts/Remove/Hint":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Remove/Hint","text":"remove keyboard shortcut"},"$:/language/ControlPanel/KeyboardShortcuts/Platform/All":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Platform/All","text":"All platforms"},"$:/language/ControlPanel/KeyboardShortcuts/Platform/Mac":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Platform/Mac","text":"Macintosh platform only"},"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonMac":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonMac","text":"Non-Macintosh platforms only"},"$:/language/ControlPanel/KeyboardShortcuts/Platform/Linux":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Platform/Linux","text":"Linux platform only"},"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonLinux":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonLinux","text":"Non-Linux platforms only"},"$:/language/ControlPanel/KeyboardShortcuts/Platform/Windows":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Platform/Windows","text":"Windows platform only"},"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonWindows":{"title":"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonWindows","text":"Non-Windows platforms only"},"$:/language/ControlPanel/LayoutSwitcher/Caption":{"title":"$:/language/ControlPanel/LayoutSwitcher/Caption","text":"Layout"},"$:/language/ControlPanel/LoadedModules/Caption":{"title":"$:/language/ControlPanel/LoadedModules/Caption","text":"Loaded Modules"},"$:/language/ControlPanel/LoadedModules/Hint":{"title":"$:/language/ControlPanel/LoadedModules/Hint","text":"These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process."},"$:/language/ControlPanel/Palette/Caption":{"title":"$:/language/ControlPanel/Palette/Caption","text":"Palette"},"$:/language/ControlPanel/Palette/Editor/Clone/Caption":{"title":"$:/language/ControlPanel/Palette/Editor/Clone/Caption","text":"clone"},"$:/language/ControlPanel/Palette/Editor/Clone/Prompt":{"title":"$:/language/ControlPanel/Palette/Editor/Clone/Prompt","text":"It is recommended that you clone this shadow palette before editing it"},"$:/language/ControlPanel/Palette/Editor/Delete/Hint":{"title":"$:/language/ControlPanel/Palette/Editor/Delete/Hint","text":"delete this entry from the current palette"},"$:/language/ControlPanel/Palette/Editor/Names/External/Show":{"title":"$:/language/ControlPanel/Palette/Editor/Names/External/Show","text":"Show color names that are not part of the current palette"},"$:/language/ControlPanel/Palette/Editor/Prompt/Modified":{"title":"$:/language/ControlPanel/Palette/Editor/Prompt/Modified","text":"This shadow palette has been modified"},"$:/language/ControlPanel/Palette/Editor/Prompt":{"title":"$:/language/ControlPanel/Palette/Editor/Prompt","text":"Editing"},"$:/language/ControlPanel/Palette/Editor/Reset/Caption":{"title":"$:/language/ControlPanel/Palette/Editor/Reset/Caption","text":"reset"},"$:/language/ControlPanel/Palette/HideEditor/Caption":{"title":"$:/language/ControlPanel/Palette/HideEditor/Caption","text":"hide editor"},"$:/language/ControlPanel/Palette/Prompt":{"title":"$:/language/ControlPanel/Palette/Prompt","text":"Current palette:"},"$:/language/ControlPanel/Palette/ShowEditor/Caption":{"title":"$:/language/ControlPanel/Palette/ShowEditor/Caption","text":"show editor"},"$:/language/ControlPanel/Parsing/Caption":{"title":"$:/language/ControlPanel/Parsing/Caption","text":"Parsing"},"$:/language/ControlPanel/Parsing/Hint":{"title":"$:/language/ControlPanel/Parsing/Hint","text":"Here you can globally disable/enable wiki parser rules. For changes to take effect, save and reload your wiki. Disabling certain parser rules can prevent <$text text=\"TiddlyWiki\"/> from functioning correctly. Use [[safe mode|https://tiddlywiki.com/#SafeMode]] to restore normal operation."},"$:/language/ControlPanel/Parsing/Block/Caption":{"title":"$:/language/ControlPanel/Parsing/Block/Caption","text":"Block Parse Rules"},"$:/language/ControlPanel/Parsing/Inline/Caption":{"title":"$:/language/ControlPanel/Parsing/Inline/Caption","text":"Inline Parse Rules"},"$:/language/ControlPanel/Parsing/Pragma/Caption":{"title":"$:/language/ControlPanel/Parsing/Pragma/Caption","text":"Pragma Parse Rules"},"$:/language/ControlPanel/Plugins/Add/Caption":{"title":"$:/language/ControlPanel/Plugins/Add/Caption","text":"Get more plugins"},"$:/language/ControlPanel/Plugins/Add/Hint":{"title":"$:/language/ControlPanel/Plugins/Add/Hint","text":"Install plugins from the official library"},"$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint":{"title":"$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint","text":"This plugin is already installed at version <$text text=<<installedVersion>>/>"},"$:/language/ControlPanel/Plugins/AlsoRequires":{"title":"$:/language/ControlPanel/Plugins/AlsoRequires","text":"Also requires:"},"$:/language/ControlPanel/Plugins/Caption":{"title":"$:/language/ControlPanel/Plugins/Caption","text":"Plugins"},"$:/language/ControlPanel/Plugins/Disable/Caption":{"title":"$:/language/ControlPanel/Plugins/Disable/Caption","text":"disable"},"$:/language/ControlPanel/Plugins/Disable/Hint":{"title":"$:/language/ControlPanel/Plugins/Disable/Hint","text":"Disable this plugin when reloading page"},"$:/language/ControlPanel/Plugins/Disabled/Status":{"title":"$:/language/ControlPanel/Plugins/Disabled/Status","text":"(disabled)"},"$:/language/ControlPanel/Plugins/Downgrade/Caption":{"title":"$:/language/ControlPanel/Plugins/Downgrade/Caption","text":"downgrade"},"$:/language/ControlPanel/Plugins/Empty/Hint":{"title":"$:/language/ControlPanel/Plugins/Empty/Hint","text":"None"},"$:/language/ControlPanel/Plugins/Enable/Caption":{"title":"$:/language/ControlPanel/Plugins/Enable/Caption","text":"enable"},"$:/language/ControlPanel/Plugins/Enable/Hint":{"title":"$:/language/ControlPanel/Plugins/Enable/Hint","text":"Enable this plugin when reloading page"},"$:/language/ControlPanel/Plugins/Install/Caption":{"title":"$:/language/ControlPanel/Plugins/Install/Caption","text":"install"},"$:/language/ControlPanel/Plugins/Installed/Hint":{"title":"$:/language/ControlPanel/Plugins/Installed/Hint","text":"Currently installed plugins:"},"$:/language/ControlPanel/Plugins/Languages/Caption":{"title":"$:/language/ControlPanel/Plugins/Languages/Caption","text":"Languages"},"$:/language/ControlPanel/Plugins/Languages/Hint":{"title":"$:/language/ControlPanel/Plugins/Languages/Hint","text":"Language pack plugins"},"$:/language/ControlPanel/Plugins/NoInfoFound/Hint":{"title":"$:/language/ControlPanel/Plugins/NoInfoFound/Hint","text":"No ''\"<$text text=<<currentTab>>/>\"'' found"},"$:/language/ControlPanel/Plugins/NotInstalled/Hint":{"title":"$:/language/ControlPanel/Plugins/NotInstalled/Hint","text":"This plugin is not currently installed"},"$:/language/ControlPanel/Plugins/OpenPluginLibrary":{"title":"$:/language/ControlPanel/Plugins/OpenPluginLibrary","text":"Open plugin library"},"$:/language/ControlPanel/Plugins/ClosePluginLibrary":{"title":"$:/language/ControlPanel/Plugins/ClosePluginLibrary","text":"Close plugin library"},"$:/language/ControlPanel/Plugins/PluginWillRequireReload":{"title":"$:/language/ControlPanel/Plugins/PluginWillRequireReload","text":"(requires reload)"},"$:/language/ControlPanel/Plugins/Plugins/Caption":{"title":"$:/language/ControlPanel/Plugins/Plugins/Caption","text":"Plugins"},"$:/language/ControlPanel/Plugins/Plugins/Hint":{"title":"$:/language/ControlPanel/Plugins/Plugins/Hint","text":"Plugins"},"$:/language/ControlPanel/Plugins/Reinstall/Caption":{"title":"$:/language/ControlPanel/Plugins/Reinstall/Caption","text":"reinstall"},"$:/language/ControlPanel/Plugins/Themes/Caption":{"title":"$:/language/ControlPanel/Plugins/Themes/Caption","text":"Themes"},"$:/language/ControlPanel/Plugins/Themes/Hint":{"title":"$:/language/ControlPanel/Plugins/Themes/Hint","text":"Theme plugins"},"$:/language/ControlPanel/Plugins/Update/Caption":{"title":"$:/language/ControlPanel/Plugins/Update/Caption","text":"update"},"$:/language/ControlPanel/Plugins/Updates/Caption":{"title":"$:/language/ControlPanel/Plugins/Updates/Caption","text":"Updates"},"$:/language/ControlPanel/Plugins/Updates/Hint":{"title":"$:/language/ControlPanel/Plugins/Updates/Hint","text":"Available updates to installed plugins"},"$:/language/ControlPanel/Plugins/Updates/UpdateAll/Caption":{"title":"$:/language/ControlPanel/Plugins/Updates/UpdateAll/Caption","text":"Update <<update-count>> plugins"},"$:/language/ControlPanel/Plugins/SubPluginPrompt":{"title":"$:/language/ControlPanel/Plugins/SubPluginPrompt","text":"With <<count>> sub-plugins available"},"$:/language/ControlPanel/Saving/Caption":{"title":"$:/language/ControlPanel/Saving/Caption","text":"Saving"},"$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Description":{"title":"$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Description","text":"Permit automatic saving for the download saver"},"$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Hint":{"title":"$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Hint","text":"Enable Autosave for Download Saver"},"$:/language/ControlPanel/Saving/DownloadSaver/Caption":{"title":"$:/language/ControlPanel/Saving/DownloadSaver/Caption","text":"Download Saver"},"$:/language/ControlPanel/Saving/DownloadSaver/Hint":{"title":"$:/language/ControlPanel/Saving/DownloadSaver/Hint","text":"These settings apply to the HTML5-compatible download saver"},"$:/language/ControlPanel/Saving/General/Caption":{"title":"$:/language/ControlPanel/Saving/General/Caption","text":"General"},"$:/language/ControlPanel/Saving/General/Hint":{"title":"$:/language/ControlPanel/Saving/General/Hint","text":"These settings apply to all the loaded savers"},"$:/language/ControlPanel/Saving/Hint":{"title":"$:/language/ControlPanel/Saving/Hint","text":"Settings used for saving the entire TiddlyWiki as a single file via a saver module"},"$:/language/ControlPanel/Saving/GitService/Branch":{"title":"$:/language/ControlPanel/Saving/GitService/Branch","text":"Target branch for saving"},"$:/language/ControlPanel/Saving/GitService/CommitMessage":{"title":"$:/language/ControlPanel/Saving/GitService/CommitMessage","text":"Saved by TiddlyWiki"},"$:/language/ControlPanel/Saving/GitService/Description":{"title":"$:/language/ControlPanel/Saving/GitService/Description","text":"These settings are only used when saving to <<service-name>>"},"$:/language/ControlPanel/Saving/GitService/Filename":{"title":"$:/language/ControlPanel/Saving/GitService/Filename","text":"Filename of target file (e.g. `index.html`)"},"$:/language/ControlPanel/Saving/GitService/Path":{"title":"$:/language/ControlPanel/Saving/GitService/Path","text":"Path to target file (e.g. `/wiki/`)"},"$:/language/ControlPanel/Saving/GitService/Repo":{"title":"$:/language/ControlPanel/Saving/GitService/Repo","text":"Target repository (e.g. `Jermolene/TiddlyWiki5`)"},"$:/language/ControlPanel/Saving/GitService/ServerURL":{"title":"$:/language/ControlPanel/Saving/GitService/ServerURL","text":"Server API URL"},"$:/language/ControlPanel/Saving/GitService/UserName":{"title":"$:/language/ControlPanel/Saving/GitService/UserName","text":"Username"},"$:/language/ControlPanel/Saving/GitService/GitHub/Caption":{"title":"$:/language/ControlPanel/Saving/GitService/GitHub/Caption","text":"~GitHub Saver"},"$:/language/ControlPanel/Saving/GitService/GitHub/Password":{"title":"$:/language/ControlPanel/Saving/GitService/GitHub/Password","text":"Password, OAUTH token, or personal access token (see [[GitHub help page|https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line]] for details)"},"$:/language/ControlPanel/Saving/GitService/GitLab/Caption":{"title":"$:/language/ControlPanel/Saving/GitService/GitLab/Caption","text":"~GitLab Saver"},"$:/language/ControlPanel/Saving/GitService/GitLab/Password":{"title":"$:/language/ControlPanel/Saving/GitService/GitLab/Password","text":"Personal access token for API (see [[GitLab help page|https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html]] for details)"},"$:/language/ControlPanel/Saving/GitService/Gitea/Caption":{"title":"$:/language/ControlPanel/Saving/GitService/Gitea/Caption","text":"Gitea Saver"},"$:/language/ControlPanel/Saving/GitService/Gitea/Password":{"title":"$:/language/ControlPanel/Saving/GitService/Gitea/Password","text":"Personal access token for API (via Gitea’s web interface: `Settings | Applications | Generate New Token`)"},"$:/language/ControlPanel/Saving/TiddlySpot/Advanced/Heading":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/Advanced/Heading","text":"Advanced Settings"},"$:/language/ControlPanel/Saving/TiddlySpot/BackupDir":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/BackupDir","text":"Backup Directory"},"$:/language/ControlPanel/Saving/TiddlySpot/ControlPanel":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/ControlPanel","text":"~TiddlySpot Control Panel"},"$:/language/ControlPanel/Saving/TiddlySpot/Backups":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/Backups","text":"Backups"},"$:/language/ControlPanel/Saving/TiddlySpot/Caption":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/Caption","text":"~TiddlySpot Saver"},"$:/language/ControlPanel/Saving/TiddlySpot/Description":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/Description","text":"These settings are only used when saving to [[TiddlySpot|http://tiddlyspot.com]], [[TiddlyHost|https://tiddlyhost.com]], or a compatible remote server. See [[here|https://github.com/simonbaird/tiddlyhost/wiki/TiddlySpot-Saver-configuration-for-Tiddlyhost-and-Tiddlyspot]] for information on ~TiddlySpot and ~TiddlyHost saving configuration."},"$:/language/ControlPanel/Saving/TiddlySpot/Filename":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/Filename","text":"Upload Filename"},"$:/language/ControlPanel/Saving/TiddlySpot/Heading":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/Heading","text":"~TiddlySpot"},"$:/language/ControlPanel/Saving/TiddlySpot/Hint":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/Hint","text":"//The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address, e.g. `http://example.com/store.php`.//"},"$:/language/ControlPanel/Saving/TiddlySpot/Password":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/Password","text":"Password"},"$:/language/ControlPanel/Saving/TiddlySpot/ReadOnly":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/ReadOnly","text":"Note that [[TiddlySpot|http://tiddlyspot.com]] no longer allows the creation of new sites. For new sites, you can use [[TiddlyHost|https://tiddlyhost.com]], a new hosting service that replaces ~TiddlySpot."},"$:/language/ControlPanel/Saving/TiddlySpot/ServerURL":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/ServerURL","text":"Server URL"},"$:/language/ControlPanel/Saving/TiddlySpot/UploadDir":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/UploadDir","text":"Upload Directory"},"$:/language/ControlPanel/Saving/TiddlySpot/UserName":{"title":"$:/language/ControlPanel/Saving/TiddlySpot/UserName","text":"Wiki Name"},"$:/language/ControlPanel/Settings/AutoSave/Caption":{"title":"$:/language/ControlPanel/Settings/AutoSave/Caption","text":"Autosave"},"$:/language/ControlPanel/Settings/AutoSave/Disabled/Description":{"title":"$:/language/ControlPanel/Settings/AutoSave/Disabled/Description","text":"Do not save changes automatically"},"$:/language/ControlPanel/Settings/AutoSave/Enabled/Description":{"title":"$:/language/ControlPanel/Settings/AutoSave/Enabled/Description","text":"Save changes automatically"},"$:/language/ControlPanel/Settings/AutoSave/Hint":{"title":"$:/language/ControlPanel/Settings/AutoSave/Hint","text":"Attempt to automatically save changes during editing when using a supporting saver"},"$:/language/ControlPanel/Settings/CamelCase/Caption":{"title":"$:/language/ControlPanel/Settings/CamelCase/Caption","text":"Camel Case Wiki Links"},"$:/language/ControlPanel/Settings/CamelCase/Hint":{"title":"$:/language/ControlPanel/Settings/CamelCase/Hint","text":"You can globally disable automatic linking of ~CamelCase phrases. Requires reload to take effect"},"$:/language/ControlPanel/Settings/CamelCase/Description":{"title":"$:/language/ControlPanel/Settings/CamelCase/Description","text":"Enable automatic ~CamelCase linking"},"$:/language/ControlPanel/Settings/Caption":{"title":"$:/language/ControlPanel/Settings/Caption","text":"Settings"},"$:/language/ControlPanel/Settings/EditorToolbar/Caption":{"title":"$:/language/ControlPanel/Settings/EditorToolbar/Caption","text":"Editor Toolbar"},"$:/language/ControlPanel/Settings/EditorToolbar/Hint":{"title":"$:/language/ControlPanel/Settings/EditorToolbar/Hint","text":"Enable or disable the editor toolbar:"},"$:/language/ControlPanel/Settings/EditorToolbar/Description":{"title":"$:/language/ControlPanel/Settings/EditorToolbar/Description","text":"Show editor toolbar"},"$:/language/ControlPanel/Settings/InfoPanelMode/Caption":{"title":"$:/language/ControlPanel/Settings/InfoPanelMode/Caption","text":"Tiddler Info Panel Mode"},"$:/language/ControlPanel/Settings/InfoPanelMode/Hint":{"title":"$:/language/ControlPanel/Settings/InfoPanelMode/Hint","text":"Control when the tiddler info panel closes:"},"$:/language/ControlPanel/Settings/InfoPanelMode/Popup/Description":{"title":"$:/language/ControlPanel/Settings/InfoPanelMode/Popup/Description","text":"Tiddler info panel closes automatically"},"$:/language/ControlPanel/Settings/InfoPanelMode/Sticky/Description":{"title":"$:/language/ControlPanel/Settings/InfoPanelMode/Sticky/Description","text":"Tiddler info panel stays open until explicitly closed"},"$:/language/ControlPanel/Settings/Hint":{"title":"$:/language/ControlPanel/Settings/Hint","text":"These settings let you customise the behaviour of TiddlyWiki."},"$:/language/ControlPanel/Settings/NavigationAddressBar/Caption":{"title":"$:/language/ControlPanel/Settings/NavigationAddressBar/Caption","text":"Navigation Address Bar"},"$:/language/ControlPanel/Settings/NavigationAddressBar/Hint":{"title":"$:/language/ControlPanel/Settings/NavigationAddressBar/Hint","text":"Behaviour of the browser address bar when navigating to a tiddler:"},"$:/language/ControlPanel/Settings/NavigationAddressBar/No/Description":{"title":"$:/language/ControlPanel/Settings/NavigationAddressBar/No/Description","text":"Do not update the address bar"},"$:/language/ControlPanel/Settings/NavigationAddressBar/Permalink/Description":{"title":"$:/language/ControlPanel/Settings/NavigationAddressBar/Permalink/Description","text":"Include the target tiddler"},"$:/language/ControlPanel/Settings/NavigationAddressBar/Permaview/Description":{"title":"$:/language/ControlPanel/Settings/NavigationAddressBar/Permaview/Description","text":"Include the target tiddler and the current story sequence"},"$:/language/ControlPanel/Settings/NavigationHistory/Caption":{"title":"$:/language/ControlPanel/Settings/NavigationHistory/Caption","text":"Navigation History"},"$:/language/ControlPanel/Settings/NavigationHistory/Hint":{"title":"$:/language/ControlPanel/Settings/NavigationHistory/Hint","text":"Update browser history when navigating to a tiddler:"},"$:/language/ControlPanel/Settings/NavigationHistory/No/Description":{"title":"$:/language/ControlPanel/Settings/NavigationHistory/No/Description","text":"Do not update history"},"$:/language/ControlPanel/Settings/NavigationHistory/Yes/Description":{"title":"$:/language/ControlPanel/Settings/NavigationHistory/Yes/Description","text":"Update history"},"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Caption":{"title":"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Caption","text":"Permalink/permaview Mode"},"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Hint":{"title":"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Hint","text":"Choose how permalink/permaview is handled:"},"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/CopyToClipboard/Description":{"title":"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/CopyToClipboard/Description","text":"Copy permalink/permaview URL to clipboard"},"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/UpdateAddressBar/Description":{"title":"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/UpdateAddressBar/Description","text":"Update address bar with permalink/permaview URL"},"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption":{"title":"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption","text":"Performance Instrumentation"},"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Hint":{"title":"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Hint","text":"Displays performance statistics in the browser developer console. Requires reload to take effect"},"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Description":{"title":"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Description","text":"Enable performance instrumentation"},"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption":{"title":"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption","text":"Toolbar Button Style"},"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Hint":{"title":"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Hint","text":"Choose the style for toolbar buttons:"},"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Borderless":{"title":"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Borderless","text":"Borderless"},"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Boxed":{"title":"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Boxed","text":"Boxed"},"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Rounded":{"title":"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Rounded","text":"Rounded"},"$:/language/ControlPanel/Settings/ToolbarButtons/Caption":{"title":"$:/language/ControlPanel/Settings/ToolbarButtons/Caption","text":"Toolbar Buttons"},"$:/language/ControlPanel/Settings/ToolbarButtons/Hint":{"title":"$:/language/ControlPanel/Settings/ToolbarButtons/Hint","text":"Default toolbar button appearance:"},"$:/language/ControlPanel/Settings/ToolbarButtons/Icons/Description":{"title":"$:/language/ControlPanel/Settings/ToolbarButtons/Icons/Description","text":"Include icon"},"$:/language/ControlPanel/Settings/ToolbarButtons/Text/Description":{"title":"$:/language/ControlPanel/Settings/ToolbarButtons/Text/Description","text":"Include text"},"$:/language/ControlPanel/Settings/DefaultSidebarTab/Caption":{"title":"$:/language/ControlPanel/Settings/DefaultSidebarTab/Caption","text":"Default Sidebar Tab"},"$:/language/ControlPanel/Settings/DefaultSidebarTab/Hint":{"title":"$:/language/ControlPanel/Settings/DefaultSidebarTab/Hint","text":"Specify which sidebar tab is displayed by default"},"$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Caption":{"title":"$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Caption","text":"Default More Sidebar Tab"},"$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Hint":{"title":"$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Hint","text":"Specify which More sidebar tab is displayed by default"},"$:/language/ControlPanel/Settings/LinkToBehaviour/Caption":{"title":"$:/language/ControlPanel/Settings/LinkToBehaviour/Caption","text":"Tiddler Opening Behaviour"},"$:/language/ControlPanel/Settings/LinkToBehaviour/InsideRiver/Hint":{"title":"$:/language/ControlPanel/Settings/LinkToBehaviour/InsideRiver/Hint","text":"Navigation from //within// the story river"},"$:/language/ControlPanel/Settings/LinkToBehaviour/OutsideRiver/Hint":{"title":"$:/language/ControlPanel/Settings/LinkToBehaviour/OutsideRiver/Hint","text":"Navigation from //outside// the story river"},"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAbove":{"title":"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAbove","text":"Open above the current tiddler"},"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenBelow":{"title":"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenBelow","text":"Open below the current tiddler"},"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtTop":{"title":"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtTop","text":"Open at the top of the story river"},"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtBottom":{"title":"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtBottom","text":"Open at the bottom of the story river"},"$:/language/ControlPanel/Settings/TitleLinks/Caption":{"title":"$:/language/ControlPanel/Settings/TitleLinks/Caption","text":"Tiddler Titles"},"$:/language/ControlPanel/Settings/TitleLinks/Hint":{"title":"$:/language/ControlPanel/Settings/TitleLinks/Hint","text":"Optionally display tiddler titles as links"},"$:/language/ControlPanel/Settings/TitleLinks/No/Description":{"title":"$:/language/ControlPanel/Settings/TitleLinks/No/Description","text":"Do not display tiddler titles as links"},"$:/language/ControlPanel/Settings/TitleLinks/Yes/Description":{"title":"$:/language/ControlPanel/Settings/TitleLinks/Yes/Description","text":"Display tiddler titles as links"},"$:/language/ControlPanel/Settings/MissingLinks/Caption":{"title":"$:/language/ControlPanel/Settings/MissingLinks/Caption","text":"Wiki Links"},"$:/language/ControlPanel/Settings/MissingLinks/Hint":{"title":"$:/language/ControlPanel/Settings/MissingLinks/Hint","text":"Choose whether to link to tiddlers that do not exist yet"},"$:/language/ControlPanel/Settings/MissingLinks/Description":{"title":"$:/language/ControlPanel/Settings/MissingLinks/Description","text":"Enable links to missing tiddlers"},"$:/language/ControlPanel/SocialCard/Caption":{"title":"$:/language/ControlPanel/SocialCard/Caption","text":"Social Media Card"},"$:/language/ControlPanel/SocialCard/Domain/Prompt":{"title":"$:/language/ControlPanel/SocialCard/Domain/Prompt","text":"Domain name to display for the link (for example, ''tiddlywiki.com'')"},"$:/language/ControlPanel/SocialCard/Hint":{"title":"$:/language/ControlPanel/SocialCard/Hint","text":"This information is used by social and messaging services to display a preview card for links to this TiddlyWiki when hosted online"},"$:/language/ControlPanel/SocialCard/PreviewUrl/Prompt":{"title":"$:/language/ControlPanel/SocialCard/PreviewUrl/Prompt","text":"Full URL to preview image for this TiddlyWiki"},"$:/language/ControlPanel/SocialCard/PreviewUrl/Preview":{"title":"$:/language/ControlPanel/SocialCard/PreviewUrl/Preview","text":"Preview image:"},"$:/language/ControlPanel/SocialCard/Url/Prompt":{"title":"$:/language/ControlPanel/SocialCard/Url/Prompt","text":"Full URL of this TiddlyWiki"},"$:/language/ControlPanel/StoryTiddler/Caption":{"title":"$:/language/ControlPanel/StoryTiddler/Caption","text":"Story Tiddler"},"$:/language/ControlPanel/StoryTiddler/Hint":{"title":"$:/language/ControlPanel/StoryTiddler/Hint","text":"This rule cascade is used to dynamically choose the template for displaying a tiddler in the story river."},"$:/language/ControlPanel/StoryView/Caption":{"title":"$:/language/ControlPanel/StoryView/Caption","text":"Story View"},"$:/language/ControlPanel/StoryView/Prompt":{"title":"$:/language/ControlPanel/StoryView/Prompt","text":"Current view:"},"$:/language/ControlPanel/Stylesheets/Caption":{"title":"$:/language/ControlPanel/Stylesheets/Caption","text":"Stylesheets"},"$:/language/ControlPanel/Stylesheets/Expand/Caption":{"title":"$:/language/ControlPanel/Stylesheets/Expand/Caption","text":"Expand All"},"$:/language/ControlPanel/Stylesheets/Hint":{"title":"$:/language/ControlPanel/Stylesheets/Hint","text":"This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag \"$:/tags/Stylesheet\">>"},"$:/language/ControlPanel/Stylesheets/Restore/Caption":{"title":"$:/language/ControlPanel/Stylesheets/Restore/Caption","text":"Restore"},"$:/language/ControlPanel/TestCases/Caption":{"title":"$:/language/ControlPanel/TestCases/Caption","text":"Test Cases"},"$:/language/ControlPanel/TestCases/Hint":{"title":"$:/language/ControlPanel/TestCases/Hint","text":"Test cases are self contained examples for testing and learning"},"$:/language/ControlPanel/TestCases/All/Caption":{"title":"$:/language/ControlPanel/TestCases/All/Caption","text":"All Test Cases"},"$:/language/ControlPanel/TestCases/All/Hint":{"title":"$:/language/ControlPanel/TestCases/All/Hint","text":"All Test Cases"},"$:/language/ControlPanel/TestCases/Failed/Caption":{"title":"$:/language/ControlPanel/TestCases/Failed/Caption","text":"Failed Test Cases"},"$:/language/ControlPanel/TestCases/Failed/Hint":{"title":"$:/language/ControlPanel/TestCases/Failed/Hint","text":"Only Failed Test Cases"},"$:/language/ControlPanel/Theme/Caption":{"title":"$:/language/ControlPanel/Theme/Caption","text":"Theme"},"$:/language/ControlPanel/Theme/Prompt":{"title":"$:/language/ControlPanel/Theme/Prompt","text":"Current theme:"},"$:/language/ControlPanel/TiddlerFields/Caption":{"title":"$:/language/ControlPanel/TiddlerFields/Caption","text":"Tiddler Fields"},"$:/language/ControlPanel/TiddlerFields/Hint":{"title":"$:/language/ControlPanel/TiddlerFields/Hint","text":"This is the full set of TiddlerFields in use in this wiki (including system tiddlers but excluding shadow tiddlers)."},"$:/language/ControlPanel/TiddlerColour/Caption":{"title":"$:/language/ControlPanel/TiddlerC