Permalink
Browse files

Basically everything new

  • Loading branch information...
1 parent 756d428 commit b10b0de795d3fa8165b2142428e95ef717dc6840 @Paratron committed Jun 29, 2012
Showing with 8,047 additions and 340 deletions.
  1. +0 −1 .gitignore
  2. +10 −0 .idea/SimpLESS14.iml
  3. +5 −0 .idea/encodings.xml
  4. +8 −0 .idea/jsLibraryMappings.xml
  5. +8 −0 .idea/misc.xml
  6. +9 −0 .idea/modules.xml
  7. +5 −0 .idea/scopes/scope_settings.xml
  8. +7 −0 .idea/vcs.xml
  9. +600 −0 .idea/workspace.xml
  10. +1 −28 CHANGELOG.txt
  11. +1 −25 LICENSE.txt
  12. +13 −10 README.md
  13. +129 −0 Resources/app/3p/cleancss.js
  14. +3,622 −0 Resources/app/3p/less.js
  15. +68 −0 Resources/app/main.js
  16. +114 −0 Resources/app/modules/compiler.js
  17. +86 −0 Resources/app/modules/context_menu.js
  18. +28 −0 Resources/app/modules/less_patcher.js
  19. +35 −0 Resources/app/modules/notification.js
  20. +259 −0 Resources/app/modules/storage.js
  21. +430 −0 Resources/app/modules/ui.js
  22. +5 −0 Resources/app/templates/less_error_replacement.js
  23. +43 −0 Resources/app/templates/less_xhr_replacement.js
  24. +5 −0 Resources/app/templates/list-item.html
  25. +1 −0 Resources/app/templates/list.html
  26. +11 −0 Resources/app/text.js
  27. +54 −0 Resources/context-menu.css
  28. BIN Resources/default_app_logo.png
  29. BIN Resources/img/browse.png
  30. BIN Resources/img/compilation-error.png
  31. BIN Resources/img/compiled.png
  32. BIN Resources/img/delete.png
  33. BIN Resources/img/details.png
  34. BIN Resources/img/error.png
  35. BIN Resources/img/in.png
  36. BIN Resources/img/options.png
  37. BIN Resources/img/out.png
  38. BIN Resources/img/recompile.png
  39. BIN Resources/img/spritemap.png
  40. BIN Resources/img/tick.png
  41. BIN Resources/img/warning.png
  42. +13 −10 Resources/index.html
  43. +1,158 −0 Resources/js/backbone.js
  44. +4 −0 Resources/js/jquery-1.7.min.js
  45. +33 −0 Resources/js/require.js
  46. +999 −0 Resources/js/underscore.js
  47. +80 −0 Resources/notification.css
  48. +173 −234 Resources/style.css
  49. +6 −6 manifest
  50. +24 −26 tiapp.xml
View
1 .gitignore
@@ -1,3 +1,2 @@
dist
tmp
-.idea
View
10 .idea/SimpLESS14.iml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+ <component name="NewModuleRootManager">
+ <content url="file://$MODULE_DIR$" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="Titanium" level="application" />
+ </component>
+</module>
+
View
5 .idea/encodings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+
View
8 .idea/jsLibraryMappings.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="JavaScriptLibraryMappings">
+ <file url="file://$PROJECT_DIR$" libraries="{Titanium}" />
+ <file url="PROJECT" libraries="{Titanium}" />
+ </component>
+</project>
+
View
8 .idea/misc.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectResources">
+ <default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
+ </component>
+ <component name="ProjectRootManager" version="2" />
+</project>
+
View
9 .idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/SimpLESS14.iml" filepath="$PROJECT_DIR$/.idea/SimpLESS14.iml" />
+ </modules>
+ </component>
+</project>
+
View
5 .idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+<component name="DependencyValidationManager">
+ <state>
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </state>
+</component>
View
7 .idea/vcs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+</project>
+
View
600 .idea/workspace.xml
@@ -0,0 +1,600 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ChangeListManager">
+ <list default="true" id="8faf01ec-4a3e-4f25-94b2-8cecd4dab885" name="Default" comment="" />
+ <ignored path="SimpLESS14.iws" />
+ <ignored path=".idea/workspace.xml" />
+ <option name="TRACKING_ENABLED" value="true" />
+ <option name="SHOW_DIALOG" value="false" />
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+ <option name="LAST_RESOLUTION" value="IGNORE" />
+ </component>
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
+ <component name="CreatePatchCommitExecutor">
+ <option name="PATCH_PATH" value="" />
+ </component>
+ <component name="DaemonCodeAnalyzer">
+ <disable_hints />
+ </component>
+ <component name="FavoritesManager">
+ <favorites_list name="SimpLESS14" />
+ </component>
+ <component name="FileEditorManager">
+ <leaf>
+ <file leaf-file-name="storage.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/Resources/app/modules/storage.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="20" column="27" selection-start="543" selection-end="543" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="main.js" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/Resources/app/main.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="61" column="41" selection-start="2520" selection-end="2520" vertical-scroll-proportion="0.82439023">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="tiapp.xml" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/tiapp.xml">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="5" column="12" selection-start="215" selection-end="215" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="ui.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/Resources/app/modules/ui.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="82" column="17" selection-start="2945" selection-end="2945" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ </leaf>
+ </component>
+ <component name="FindManager">
+ <FindUsagesManager>
+ <setting name="OPEN_NEW_TAB" value="false" />
+ </FindUsagesManager>
+ </component>
+ <component name="IdeDocumentHistory">
+ <option name="changedFiles">
+ <list>
+ <option value="$PROJECT_DIR$/Resources/style.css" />
+ <option value="$PROJECT_DIR$/Resources/app/modules/compiler.js" />
+ <option value="$PROJECT_DIR$/Resources/app/templates/notification.html" />
+ <option value="$PROJECT_DIR$/Resources/notification.css" />
+ <option value="$PROJECT_DIR$/Resources/app/modules/notification.js" />
+ <option value="$PROJECT_DIR$/Resources/app/templates/less_error_replacement.js" />
+ <option value="$PROJECT_DIR$/Resources/app/templates/less_xhr_replacement.js" />
+ <option value="$PROJECT_DIR$/Resources/app/modules/less_patcher.js" />
+ <option value="$PROJECT_DIR$/dist/win32/SimpLESS14/Resources/app/3p/less.js" />
+ <option value="$PROJECT_DIR$/Resources/app/3p/less.js" />
+ <option value="$PROJECT_DIR$/README.md" />
+ <option value="$PROJECT_DIR$/Resources/app/modules/ui.js" />
+ <option value="$PROJECT_DIR$/Resources/app/modules/storage.js" />
+ <option value="$PROJECT_DIR$/manifest" />
+ <option value="$PROJECT_DIR$/tiapp.xml" />
+ <option value="$PROJECT_DIR$/Resources/app/main.js" />
+ </list>
+ </option>
+ </component>
+ <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
+ <component name="ProjectFrameBounds">
+ <option name="x" value="-8" />
+ <option name="y" value="-8" />
+ <option name="width" value="1936" />
+ <option name="height" value="1186" />
+ </component>
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+ <OptionsSetting value="true" id="Add" />
+ <OptionsSetting value="true" id="Remove" />
+ <OptionsSetting value="true" id="Checkout" />
+ <OptionsSetting value="true" id="Update" />
+ <OptionsSetting value="true" id="Status" />
+ <OptionsSetting value="true" id="Edit" />
+ <ConfirmationsSetting value="0" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
+ </component>
+ <component name="ProjectReloadState">
+ <option name="STATE" value="0" />
+ </component>
+ <component name="ProjectView">
+ <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
+ <flattenPackages />
+ <showMembers />
+ <showModules />
+ <showLibraryContents ProjectPane="true" />
+ <hideEmptyPackages />
+ <abbreviatePackageNames />
+ <autoscrollToSource />
+ <autoscrollFromSource />
+ <sortByType />
+ </navigator>
+ <panes>
+ <pane id="ProjectPane">
+ <subPane>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="External Libraries" />
+ <option name="myItemType" value="com.jetbrains.php.config.PhpExternalLibrariesNodePatcher$PatchedExternalLibrariesNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Resources" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Resources" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="app" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Resources" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="app" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="templates" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SimpLESS14" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Resources" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="app" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="modules" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ </subPane>
+ </pane>
+ <pane id="Scope">
+ <subPane subId="Project Files">
+ <PATH>
+ <PATH_ELEMENT USER_OBJECT="Root">
+ <option name="myItemId" value="" />
+ <option name="myItemType" value="" />
+ </PATH_ELEMENT>
+ </PATH>
+ </subPane>
+ </pane>
+ </panes>
+ </component>
+ <component name="PropertiesComponent">
+ <property name="options.splitter.main.proportions" value="0.3" />
+ <property name="WebServerToolWindowFactoryState" value="true" />
+ <property name="options.lastSelected" value="preferences.keymap" />
+ <property name="options.searchVisible" value="true" />
+ <property name="options.splitter.details.proportions" value="0.2" />
+ </component>
+ <component name="PublishConfig">
+ <servers>
+ <server id="0580e5ba-6bb3-460e-8e19-9b5916812a52">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="25aae845-58c0-4792-9003-7391d8e2e22c">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="337ba67c-5b34-4809-b449-33b72978e6dc">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="3bade9c9-6f81-426c-8aaa-3265411df5b0">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="518d9b7d-6480-4979-bb8f-2883301bdbfc">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="6d9fd1b0-28ea-4c48-b344-efe76b704eb4">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="7045d10f-a1cc-4a04-bad3-dfaefa3e1f2d">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="75db77a8-319d-4fc7-8412-eda986d476ba">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="7c898b35-f7f3-467c-b3f7-575f20fa754b">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="7d31bc17-dd32-4f63-bb9d-247d1af2bae4">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="8fb3b2a4-3a76-4ef0-845c-7c49f5eeef6c">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="c154a5ec-19fd-40db-a0f9-598a0ddd897a">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="df7489eb-8478-4733-8996-22a38fb5cfaf">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="e71da40d-007c-4add-94f0-a4a578825eac">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="e9944081-709a-41ec-ba9b-88c485cbe514">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="eda69518-f5f0-46f3-ab05-5b795af266f3">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="f08df362-437f-4c94-a89d-deb172696a8f">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ <server id="f6bc75c9-bd06-41be-9ef6-a3c8e7be8d17">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ </servers>
+ </component>
+ <component name="RecentsManager">
+ <key name="CopyFile.RECENT_KEYS">
+ <recent name="C:\titanium\SimpLESS14" />
+ <recent name="C:\titanium\SimpLESS14\Resources\js" />
+ <recent name="C:\titanium\SimpLESS14\Resources\app" />
+ <recent name="C:\titanium\SimpLESS14\Resources" />
+ </key>
+ <key name="MoveFile.RECENT_KEYS">
+ <recent name="C:\titanium\SimpLESS14\Resources\app\3p" />
+ </key>
+ </component>
+ <component name="RunManager">
+ <configuration default="true" type="NodeJSConfigurationType" factoryName="Node JS" working-dir="$PROJECT_DIR$" coffeescript-run="false">
+ <method>
+ <option name="PhingTarget" enabled="false" />
+ </method>
+ </configuration>
+ <configuration default="true" type="JavascriptDebugSession" factoryName="Local">
+ <JSDebuggerConfigurationSettings>
+ <option name="engineId" value="embedded" />
+ <option name="fileUrl" />
+ </JSDebuggerConfigurationSettings>
+ <method />
+ </configuration>
+ <list size="0" />
+ </component>
+ <component name="ShelveChangesManager" show_recycled="false" />
+ <component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="mySSHConnectionTimeout" value="30000" />
+ <option name="mySSHReadTimeout" value="30000" />
+ <option name="LAST_MERGED_REVISION" />
+ <option name="MERGE_DRY_RUN" value="false" />
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
+ <option name="DETECT_NESTED_COPIES" value="true" />
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
+ <option name="FORCE_UPDATE" value="false" />
+ <configuration useDefault="false">C:\Users\Christian\AppData\Roaming\Subversion</configuration>
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
+ </component>
+ <component name="TaskManager">
+ <task active="true" id="Default" summary="Default task">
+ <changelist id="8faf01ec-4a3e-4f25-94b2-8cecd4dab885" name="Default" comment="" />
+ <created>1339577384670</created>
+ <updated>1339577384670</updated>
+ </task>
+ <servers />
+ </component>
+ <component name="ToolWindowManager">
+ <frame x="-8" y="-8" width="1936" height="1186" extended-state="6" />
+ <editor active="true" />
+ <layout>
+ <window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
+ <window_info id="Code Outline" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.065635" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
+ <window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.20384204" sideWeight="0.67021275" order="1" side_tool="false" content_ui="combo" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2497332" sideWeight="0.49714285" order="0" side_tool="true" content_ui="tabs" />
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32978722" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="combo" />
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
+ </layout>
+ </component>
+ <component name="VcsContentAnnotationSettings">
+ <option name="myLimit" value="2678400000" />
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
+ <option name="CHECK_NEW_TODO" value="true" />
+ <option name="myTodoPanelSettings">
+ <value>
+ <are-packages-shown value="false" />
+ <are-modules-shown value="false" />
+ <flatten-packages value="false" />
+ <is-autoscroll-to-source value="false" />
+ </value>
+ </option>
+ <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
+ <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
+ <option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
+ <option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
+ <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
+ <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
+ <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
+ <option name="SHORT_DIFF_HORISONTALLY" value="true" />
+ <option name="SHORT_DIFF_EXTRA_LINES" value="2" />
+ <option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
+ <option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
+ <option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
+ <option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
+ <option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
+ <option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="false" />
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
+ <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
+ <option name="LAST_COMMIT_MESSAGE" />
+ <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
+ <option name="ACTIVE_VCS_NAME" />
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
+ <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
+ </component>
+ <component name="XDebuggerManager">
+ <breakpoint-manager />
+ </component>
+ <component name="editorHistoryManager">
+ <entry file="file://$PROJECT_DIR$/Resources/notification.css">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="31" column="22" selection-start="613" selection-end="613" vertical-scroll-proportion="0.46085232" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/app/templates/less_error_replacement.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="4" column="5" selection-start="178" selection-end="178" vertical-scroll-proportion="0.059464816" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/app/templates/less_xhr_replacement.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="44" selection-start="44" selection-end="44" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/app/modules/notification.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="3" column="32" selection-start="67" selection-end="67" vertical-scroll-proportion="0.044598613" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/app/modules/less_patcher.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="20" column="81" selection-start="791" selection-end="791" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/dist/win32/SimpLESS14/Resources/app/3p/less.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="3566" column="17" selection-start="133116" selection-end="133116" vertical-scroll-proportion="0.16749257" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/default_app_logo.png">
+ <provider selected="true" editor-type-id="images">
+ <state />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/img/icon.png">
+ <provider selected="true" editor-type-id="images">
+ <state />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/app/3p/less.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="3611" column="14" selection-start="134714" selection-end="134714" vertical-scroll-proportion="0.7472745" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/app/modules/compiler.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="105" column="31" selection-start="3719" selection-end="3719" vertical-scroll-proportion="0.79187316" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/README.md">
+ <provider editor-type-id="MarkdownPreviewEditor">
+ <state />
+ </provider>
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="28" column="14" selection-start="1271" selection-end="1271" vertical-scroll-proportion="0.42467138" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/app/modules/ui.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="82" column="17" selection-start="2945" selection-end="2945" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/manifest">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="2" column="15" selection-start="65" selection-end="65" vertical-scroll-proportion="0.029268293">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/tiapp.xml">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="5" column="12" selection-start="215" selection-end="215" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/app/modules/storage.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="20" column="27" selection-start="543" selection-end="543" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Resources/app/main.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="61" column="41" selection-start="2520" selection-end="2520" vertical-scroll-proportion="0.82439023">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </component>
+</project>
+
View
29 CHANGELOG.txt
@@ -1,28 +1 @@
-v 1.3
-
-- implemented CSS minification (thanks to: https://github.com/GoalSmashers/clean-css )
- If you don't want a css file to be minified, place the following comment in your less file: //simpless:!minify
-- added a button for manual recompilation of files
-- added a button for removing files from the list
-- fixed a bug where compiling an empty less file crashes the program
-- fixed a bug in the quit-restore system
-- removed the restore button. Restoring now happens by default.
-- fixed a bug where urls in stylesheets got messed up with random "app://com.wearekiss.simpless.open/" insertions.
-- included LESS parser 1.1.6
-- addded support for backwards @import. Compilation is triggered, if imported files are changed.
-- capturing compiling errors in imported files now.
-- fixed weird file path problems in appcelerator titanium
-
-
-v 1.2
-
-- implemented a new drag&drop system. Should work much more reliable now.
-- fixed a bug where a space in the filepath prevented simpless from recognizing it.
-- fixed a bug where the "show love" message was displayed when it shouldnt
-- improved compilation error checking
-- improved contrast in the colors of error messages in the UI
-- included LESS parser 1.1.4
-- added @import functionality
-- when minimizing the app, it goes to the tray
-- added a "restore last session" button
-- implemented an automatic update checker
+Place your change log text here. This file will be incorporated with your app at package time.
View
26 LICENSE.txt
@@ -1,25 +1 @@
-Details under: http://creativecommons.org/licenses/by/3.0/
-
-You are free:
-
-to Share — to copy, distribute and transmit the work
-to Remix — to adapt the work
-to make commercial use of the work
-
-
-
-Under the following conditions:
-
-Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
-
-
-
-With the understanding that:
-
-Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
-Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.
-Other Rights — In no way are any of the following rights affected by the license:
-Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;
-The author's moral rights;
-Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
-Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.
+Place your license text here. This file will be incorporated with your app at package time.
View
23 README.md
@@ -1,4 +1,4 @@
-SimpLESS Compiler 1.3
+SimpLESS Compiler 1.4
=====================
Description
@@ -17,6 +17,18 @@ It utilizes the appcelerator titanium platform ( http://appcelerator.com/ ) to a
Changelog
---------
+v 1.4
+
+- tweaked UI
+- removed the compilation options from the lesscode and implemented it into the UI
+- the target CSS file to compile to can now be chosen from the UI
+- implemented usage of http://prefixr.com for automatic CSS3 vendor prefixing
+- embedded the most recent version of less - v 1.3.0
+- implemented a automatic updater for the less compiler
+- if a LESS file starts with a CSS block comment, SimpLESS will keep that comment after minification (i.e. for Wordpress)
+- metric tonne of bugfixes
+
+
v 1.3
- implemented CSS minification (thanks to: https://github.com/GoalSmashers/clean-css )
@@ -53,12 +65,3 @@ Download Builds
Download builds for every platform under http://wearekiss.com/simpless/
-Planned Features
-----------------
-
-Currently I'm thinking about implementing the following features in near future:
-
-- Adding vendor prefixes automatically like prefixer ( http://cssprefixer.appspot.com/ ) does.
-- adding SASS support
-
-
View
129 Resources/app/3p/cleancss.js
@@ -0,0 +1,129 @@
+define([], function () {
+ var CleanCSS = {
+ colors:{
+ white:'#fff',
+ black:'#000',
+ fuchsia:'#f0f',
+ yellow:'#ff0'
+ },
+
+ process:function (data) {
+ var specialComments = [],
+ contentBlocks = [];
+
+ // replace function
+ var replace = function (pattern, replacement) {
+ if (true) {
+ data = data.replace(pattern, replacement);
+ } else { // for debugging purposes only
+ var start = new Date().getTime();
+ data = data.replace(pattern, replacement);
+ var end = new Date().getTime();
+ }
+ };
+
+ // strip comments one by one
+ for (var end = 0; end < data.length;) {
+ var start = data.indexOf('/*', end);
+ end = data.indexOf('*/', start);
+ if (start == -1 || end == -1) break;
+
+ if (data[start + 2] == '!') {
+ // in case of special comments, replace them with a placeholder
+ specialComments.push(data.substring(start, end + 2));
+ data = data.substring(0, start) + '__CSSCOMMENT__' + data.substring(end + 2);
+ } else {
+ data = data.substring(0, start) + data.substring(end + 2);
+ }
+ end = start;
+ }
+
+ // replace content: with a placeholder
+ for (var end = 0; end < data.length;) {
+ var start = data.indexOf('content', end);
+ if (start == -1) break;
+
+ var wrapper = /[^ :]/.exec(data.substring(start + 7))[0];
+ if (/['"]/.test(wrapper) == false) {
+ end = start + 7;
+ continue;
+ }
+
+ var firstIndex = data.indexOf(wrapper, start);
+ var lastIndex = data.indexOf(wrapper, firstIndex + 1);
+
+ contentBlocks.push(data.substring(firstIndex, lastIndex + 1));
+ data = data.substring(0, firstIndex) + '__CSSCONTENT__' + data.substring(lastIndex + 1);
+ end = lastIndex + 1;
+ }
+
+ replace(/;\s*;+/g, ';') // whitespace between semicolons & multiple semicolons
+ replace(/\n/g, '') // line breaks
+ replace(/\s+/g, ' ') // multiple whitespace
+ replace(/ !important/g, '!important') // whitespace before !important
+ replace(/[ ]?,[ ]?/g, ',') // space with a comma
+ replace(/progid:[^(]+\(([^\)]+)/g, function (match, contents) { // restore spaces inside IE filters (IE 7 issue)
+ return match.replace(/,/g, ', ');
+ })
+ replace(/ ([+~>]) /g, '$1') // replace spaces around selectors
+ replace(/\{([^}]+)\}/g, function (match, contents) { // whitespace inside content
+ return '{' + contents.trim().replace(/(\s*)([;:=\s])(\s*)/g, '$2') + '}';
+ })
+ replace(/;}/g, '}') // trailing semicolons
+ replace(/rgb\s*\(([^\)]+)\)/g, function (match, color) { // rgb to hex colors
+ var parts = color.split(',');
+ var encoded = '#';
+ for (var i = 0; i < 3; i++) {
+ var asHex = parseInt(parts[i], 10).toString(16);
+ encoded += asHex.length == 1 ? '0' + asHex : asHex;
+ }
+ return encoded;
+ })
+ replace(/([^"'=\s])\s*#([0-9a-f]{6})/gi, function (match, prefix, color) { // long hex to short hex
+ if (color[0] == color[1] && color[2] == color[3] && color[4] == color[5])
+ return (prefix + (/:$/.test(prefix) ? '' : ' ')) + '#' + color[0] + color[2] + color[4];
+ else
+ return (prefix + (/:$/.test(prefix) ? '' : ' ')) + '#' + color;
+ })
+ replace(/(color|background):(\w+)/g, function (match, property, colorName) { // replace standard colors with hex values (only if color name is longer then hex value)
+ if (CleanCSS.colors[colorName]) return property + ':' + CleanCSS.colors[colorName];
+ else return match;
+ })
+ replace(/([: ,\(])#f00/g, '$1red') // replace #f00 with red as it's shorter
+ replace(/font\-weight:(\w+)/g, function (match, weight) { // replace font weight with numerical value
+ if (weight == 'normal') return 'font-weight:400';
+ else if (weight == 'bold') return 'font-weight:700';
+ else return match;
+ })
+ replace(/progid:DXImageTransform\.Microsoft\.(Alpha|Chroma)(\([^\)]+\))([;}'"])/g, function (match, filter, args, suffix) { // IE shorter filters but only if single (IE 7 issue)
+ return filter.toLowerCase() + args + suffix;
+ })
+ replace(/(\s|:)0(px|em|ex|cm|mm|in|pt|pc|%)/g, '$1' + '0') // zero + unit to zero
+ replace(/(border|border-top|border-right|border-bottom|border-left|outline):none/g, '$1:0') // none to 0
+ replace(/(background):none([;}])/g, '$1:0$2') // background:none to 0
+ replace(/0 0 0 0/g, '0') // multiple zeros into one
+ replace(/([: ,=\-])0\.(\d)/g, '$1.$2')
+ replace(/[^\}]+{(;)*}/g, '') // empty elements
+ if (data.indexOf('charset') > 0) replace(/(.+)(@charset [^;]+;)/, '$2$1') // move first charset to the beginning
+ replace(/(.)(@charset [^;]+;)/g, '$1') // remove all extra charsets that are not at the beginning
+ replace(/\*([\.#:\[])/g, '$1') // remove universal selector when not needed (*#id, *.class etc)
+ replace(/ {/g, '{') // whitespace before definition
+ replace(/\} /g, '}') // whitespace after definition
+
+ // Get the special comments, content content, and spaces inside calc back
+ replace(/calc\([^\}]+\}/g, function (match) {
+ return match.replace(/\+/g, ' + ');
+ });
+ replace(/__CSSCOMMENT__/g, function () {
+ return specialComments.shift();
+ });
+ replace(/__CSSCONTENT__/g, function () {
+ return contentBlocks.shift();
+ });
+
+ return data.trim() // trim spaces at beginning and end
+ }
+ };
+
+ return CleanCSS;
+});
View
3,622 Resources/app/3p/less.js
3,622 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
68 Resources/app/main.js
@@ -0,0 +1,68 @@
+/**
+ * SimpLESS 1.4
+ * ===========
+ * SimpLESS has been completely re-created and is now following the AMD pattern for development.
+ *
+ * @author: Christian Engel <hello@wearekiss.com>
+ */
+settings = {
+ debug:true,
+ version:'1.4'
+}
+
+require.config({
+ paths:{
+ 'less':'3p/less'
+ }
+});
+
+define(['modules/ui'], function (ui) {
+ if (settings.debug) {
+ Titanium.UI.getCurrentWindow().showInspector();
+ }
+
+ //Check which LESS version is currently in our 3p folder.;
+ var lessfile = Titanium.Filesystem.getFile(Titanium.Filesystem.getResourcesDirectory().nativePath() + Titanium.Filesystem.getSeparator() + ['app', '3p', 'less.js'].join(Titanium.Filesystem.getSeparator()));
+ var current_less = lessfile.open().read().toString();
+ var version_regex = /LESS - Leaner CSS v([\d\.]+)/;
+ var result = version_regex.exec(current_less);
+ current_less = result[1];
+
+ $.get('http://lesscss.org', function (response) {
+ var download_regex = /http:\/\/lesscss.googlecode.com\/files\/less-[\d\.]+\.min\.js/;
+ var version_regex = /-([\d\.]+)\.min/;
+
+ var result = download_regex.exec(response);
+ var download_link = result[0];
+ if (result !== null) {
+ var result2 = version_regex.exec(result[0]);
+ var actual_version = result2[1];
+
+ if (current_less != actual_version) {
+ if (confirm('There is a new less version available (v' + actual_version + ').\nDownload it now into SimpLESS?')) {
+ $.get('https://raw.github.com/cloudhead/less.js/master/dist/less-' + actual_version + '.js', function (response) {
+ require(['modules/less_patcher'], function (patcher) {
+ var patched_code = patcher.patch(response);
+ if (!patched_code) {
+ alert('There was a problem patching the less.js file. =(');
+ return;
+ }
+ lessfile.write(patched_code);
+ alert('Updating to less v' + actual_version + ' was successful. Restart SimpLESS to apply the update.');
+ });
+ });
+ }
+ }
+ }
+ });
+
+ Titanium.UI.getCurrentWindow().setTitle('SimpLESS ' + settings.version + ' - less v' + current_less);
+
+ $.get('http://wearekiss.com/simpless-version.txt', function (response) {
+ if (response != settings.version) {
+ if (confirm('There is an update available under http://wearekiss.com/simpless\n\nClick OK to open the website to download it.')) {
+ Titanium.Platform.openURL('http://wearekiss.com/simpless');
+ }
+ }
+ });
+});
View
114 Resources/app/modules/compiler.js
@@ -0,0 +1,114 @@
+/**
+ * compiler
+ * ===========
+ * The compiler module compiles a .less file to CSS and performs a couple of optimizations on it, if necessary.
+ */
+define(['less', '3p/cleancss'], function (less, cleancss) {
+
+ less.env = 'development';
+
+ var love_insertion = '/* This beautiful CSS-File has been crafted with LESS (lesscss.org) and compiled by simpLESS (wearekiss.com/simpless) */\n';
+ var beginning_comment = '';
+
+ function save_css_file(model, csscode) {
+ var dta = model.toJSON();
+ if (beginning_comment) {
+ csscode = beginning_comment + '\n' + csscode;
+ }
+ if (dta.settings.love) {
+ csscode += '\n' + love_insertion
+ }
+ dta.output_file.touch();
+ dta.output_file.setWritable();
+ var stream = dta.output_file.open();
+
+ csscode = csscode.replace(/app:\/\/com.wearekiss.simpless\//g, '');
+
+ stream.open(stream.MODE_WRITE);
+ stream.write(csscode);
+ stream.close();
+ model.trigger('compilation:success');
+ model.collection.trigger('compilation:success');
+ }
+
+ var obj = {
+ current_model:null,
+ compile:function (model) {
+ var model_dta = model.toJSON();
+ var parser = new less.Parser();
+
+ model.set({
+ last_compilation:(new Date()).getTime() * 1000,
+ error:null
+ });
+
+ obj.current_model = model;
+
+ var lesscode = model_dta.input_file.open().read().toString();
+
+ try {
+ parser.parse(lesscode, function (err, tree) {
+ if (err) {
+ model.set({
+ error:err
+ });
+ model.trigger('compilation:error', err);
+ model.collection.trigger('compilation:error', err);
+ return;
+ }
+
+ var csscode = tree.toCSS();
+
+ var comment_regex = /^\/\*([^\*\/]+?)\*\//gm;
+ var result = comment_regex.exec(csscode);
+ if (result) {
+ beginning_comment = result[0];
+ } else {
+ beginning_comment = '';
+ }
+
+ if (model_dta.settings.minify) {
+ csscode = cleancss.process(csscode);
+ }
+
+ if (model_dta.settings.prefix) {
+ model.set({
+ uploading:true
+ });
+ var ajax_data = {
+ css:csscode,
+ simpless:settings.version
+ }
+ if (model_dta.settings.minify) {
+ ajax_data.compress_option = 'on';
+ }
+ $.ajax({
+ async:true,
+ cache:false,
+ data:ajax_data,
+ type:'POST',
+ url:'http://prefixr.com/api/index.php?' + Math.random(),
+ success:function (response) {
+ model.set({
+ uploading:false
+ });
+ save_css_file(model, response);
+ }
+ });
+
+ } else {
+ //Do not prefix.
+ save_css_file(model, csscode);
+ }
+ });
+ }
+ catch (e) {
+ console.log(e);
+ }
+ }
+ }
+
+ _.extend(obj, Backbone.Events);
+
+ return obj;
+});
View
86 Resources/app/modules/context_menu.js
@@ -0,0 +1,86 @@
+/**
+ * context_menu
+ * ===========
+ * This module creates and handles a context menu which can be used in different places.
+ *
+ * Pass an array with menu-item elements to the constructor:
+ *
+ * [
+ * {
+ * label: 'This is the menu title',
+ * callback: function()
+ * },
+ * ...
+ * ]
+ */
+define(['text!templates/context-item.html'], function (template_src) {
+ var item_template = _.template(template_src);
+
+ return function (elements) {
+ var html = '<ul class="context-menu">';
+
+ for (var i = 0; i < elements.length; i++) {
+ elements[i]['index'] = i;
+ if (typeof elements[i].disabled == 'undefined') elements[i]['disabled'] = false;
+ html += item_template(elements[i]);
+ }
+
+ html += '</ul>';
+
+ var dom_obj = $(html);
+
+ dom_obj.delegate('li', 'click', function (e) {
+ $target = $(e.target);
+ var element_id = $target.attr('data-index');
+ elements[element_id].callback();
+ dom_obj.slideUp(100, function () {
+ dom_obj.remove();
+ });
+ });
+
+ var obj = {
+ /**
+ * Will show the context menu at a specific element.
+ * @param element
+ */
+ show_at_element:function (element) {
+ $('body').append(dom_obj);
+
+ var pos = $(element).position();
+ dom_obj.css({
+ top:(parseInt(pos.top) + 15) + 'px',
+ left:(parseInt(pos.left) - 3) + 'px'
+ }).slideDown(100, function () {
+ $('body').one('click', function () {
+ dom_obj.slideUp(100, function () {
+ dom_obj.remove();
+ });
+ });
+ });
+
+
+ },
+ /**
+ * Will show the context menu at a specific position.
+ * @param x
+ * @param y
+ */
+ show_at:function (x, y) {
+ $('body').append(dom_obj);
+
+ dom_obj.css({
+ top:(y + 12) + 'px',
+ left:(x + 12) + 'px'
+ }).slideDown(100, function () {
+ $('body').one('click', function () {
+ dom_obj.slideUp(100, function () {
+ dom_obj.remove();
+ });
+ });
+ });
+ }
+ };
+
+ return obj;
+ }
+});
View
28 Resources/app/modules/less_patcher.js
@@ -0,0 +1,28 @@
+/**
+ * less_patcher
+ * ===========
+ * description
+ */
+define(['text!templates/less_xhr_replacement.js', 'text!templates/less_error_replacement.js'], function(xhr_replacement, error_replacement){
+ var obj = {
+ patch: function(code){
+ var xhr_start = code.indexOf('function xhr(');
+ var xhr_end = code.indexOf('function getXMLHttpRequest(');
+
+ if(xhr_start === -1 || xhr_end === -1) return false;
+
+ var new_code = code.substr(0, xhr_start) + xhr_replacement + code.substr(xhr_end, code.length - xhr_end);
+
+
+
+ var error_start = new_code.indexOf('function error(e, href)');
+ var error_end = new_code.indexOf('})(window);', error_start);
+
+ new_code = new_code.substr(0, error_start) + error_replacement + new_code.substr(error_end, new_code.length - (error_end-1));
+
+ return new_code;
+ }
+ }
+
+ return obj;
+});
View
35 Resources/app/modules/notification.js
@@ -0,0 +1,35 @@
+/**
+ * notification
+ * ===========
+ * A wrapper for the ti-notifications because the setup of that thing sucks -.-
+ */
+define(function(){
+
+ var settings = {
+ duration: 10000,
+ icon: 'file:///'+Titanium.App.getIcon().replace(/\\/g, '/')
+ }
+
+ var obj = {
+ config: function(params){
+ _.extend(settings, params);
+ },
+ show: function(params){
+ var n = Titanium.Notification.createNotification();
+
+ if(params.icon){
+ params.icon = 'file:///' + Titanium.Filesystem.getResourcesDirectory().resolve('Resources/'+params.icon).nativePath().replace(/\\/g, '/');
+ }
+
+ var params = _.extend(settings, params);
+
+ n.setMessage(params.message);
+ n.setIcon(params.icon);
+ n.setTimeout(params.duration);
+ n.setTitle('SimpLESS - ' + params.title);
+ n.show();
+ }
+ }
+
+ return obj;
+});
View
259 Resources/app/modules/storage.js
@@ -0,0 +1,259 @@
+/**
+ * Storage
+ * ===========
+ * This module handles the observed .less files and starts the compilation process, if needed.
+ */
+define(['modules/compiler'], function (compiler) {
+ var observed_files = new Backbone.Collection();
+
+ var setting_defaults = {
+ minify:true,
+ prefix:false,
+ love:true
+ };
+
+ var File_Model = Backbone.Model.extend({
+ defaults:{
+ input_file:null,
+ output_file:null,
+ last_compilation:0,
+ absolute_path:'',
+ constraints:[],
+ settings:{
+ minify:setting_defaults.minify,
+ prefix:setting_defaults.prefix,
+ love:setting_defaults.love,
+ output_path:''
+ },
+ error:null,
+ uploading:false
+ },
+ initialize:function () {
+ var abspath = this.get('input_file').nativePath();
+
+ this.set({
+ absolute_path:abspath,
+ last_compilation:(new Date()).getTime() * 1000
+ });
+
+ //Make sure to keep settings for files stored and re-load them if the file is dropped again.
+ var preserved_settings = localStorage.getItem('file_' + abspath);
+ if (preserved_settings) {
+ preserved_settings = JSON.parse(preserved_settings);
+ this.set({
+ settings:preserved_settings
+ });
+ if (typeof preserved_settings.output_file != 'undefined') {
+ this.set({
+ output_file:Titanium.Filesystem.getFile(preserved_settings.output_file)
+ });
+ }
+ }
+
+ this.bind('change:settings', function (dta) {
+ dta.output_file = this.get('output_file').nativePath();
+ localStorage.setItem('file_' + abspath, JSON.stringify(dta))
+ }, this);
+
+ if (this.get('output_file') == null) {
+ var newfile = Titanium.Filesystem.getFile(this.get('input_file').nativePath().replace('.less', '.css'));
+ this.set({
+ output_file:newfile
+ })
+ }
+ }
+ });
+
+ /**
+ * Will get a file by a relative path to another one.
+ * Originally this should work by calling [ti_file].resolve() but it doesnt. :/
+ * @param ti_file
+ * @param path
+ * @return Titanium.Filesystem.File
+ */
+ function grep(ti_file, path) {
+ if (!path) return this;
+ var mypath = ti_file.toString(),
+ s = Titanium.Filesystem.getSeparator(),
+ my_chain = mypath.split(s),
+ grep_chain = path.split(s),
+ i,
+ g;
+
+ //Get rid of the filename, if there is any.
+ if (ti_file.isFile()) {
+ my_chain.pop();
+ }
+
+ for (i in grep_chain) {
+ g = grep_chain[i];
+ if (g == '.') continue;
+ if (g == '..') {
+ my_chain.pop();
+ continue;
+ }
+ my_chain.push(g);
+ }
+
+ return Titanium.Filesystem.getFile(my_chain.join(s));
+ }
+
+ /**
+ * Saves the list of currently loaded LESS files into local storage.
+ */
+ function to_storage(){
+ var list = [];
+ observed_files.each(function(item){
+ list.push(item.get('input_file').nativePath());
+ });
+ localStorage.setItem('file_list', JSON.stringify(list));
+ }
+
+ function from_storage(){
+ var list = JSON.parse(localStorage.getItem('file_list'));
+ if(!list) return;
+ observed_files.reset();
+ _.each(list, function(item){
+ var file = Titanium.Filesystem.getFile(item);
+ if(file.exists){
+ read_file(file);
+ }
+ });
+ }
+
+ /**
+ * This will read a file from the harddrive and store it in the observed files array (if not already there).
+ * @param ti_file_obj
+ */
+ function read_file(ti_file_obj) {
+ //We read only .less files.
+ if (String(ti_file_obj.extension()).toLowerCase() != 'less') {
+ return 0;
+ }
+
+ var np = ti_file_obj.nativePath(),
+ found = false;
+ observed_files.each(function(file){
+ if(file.get('input_file').nativePath() == np){
+ alert(np+'\nIs already in the indexed file list.');
+ found = true;
+ }
+ });
+ if(found) return;
+
+ observed_files.add(new File_Model({
+ input_file:ti_file_obj,
+ constraints:find_constraints(ti_file_obj),
+ settings:{
+ minify:setting_defaults.minify,
+ prefix:setting_defaults.prefix,
+ love:setting_defaults.love
+ }
+ }));
+ to_storage();
+ }
+
+ /**
+ * Will cycle through a folder recursively and pass all .less files inside it to the read_file() method.
+ * @param ti_file_obj
+ */
+ function read_folder(ti_file_obj) {
+ _.each(ti_file_obj.getDirectoryListing(), function (file) {
+ if (file.isDirectory()) {
+ read_folder(file);
+ } else {
+ if (file.extension().toString().toLowerCase() == 'less') read_file(file);
+ }
+ });
+ }
+
+ /**
+ * Finds all @import statements and returns them.
+ * @param ti_file_obj
+ */
+ function find_constraints(ti_file_obj) {
+ if (ti_file_obj.exists() == false || ti_file_obj.size() == 0) return [];
+ var source = ti_file_obj.open().read().toString(), //Content of the .less file
+ reg_exp = /@import[ \(\"\']*([^\"\'\);\n]+)[;\)\"\']*/g; //The RegEx magic that detects our import statements =]
+
+ //Find @imports in this file.
+ var result,
+ filepath,
+ tempfile,
+ files = [];
+ while (result = reg_exp.exec(source)) {
+ filepath = result[1].replace('url(', '');
+ tempfile = ti_file_obj.resolve(filepath);
+ if(!tempfile.exists()) tempfile = ti_file_obj.resolve(filepath + '.less');
+ if (tempfile.exists()) {
+ if(tempfile.extension().toString().toLowerCase() == 'less'){
+ files.push(tempfile);
+ files.concat(find_constraints(tempfile));
+ }
+ } else {
+ console.log(tempfile.nativePath() + ' does not exist.');
+ }
+ }
+
+ return files;
+ }
+
+ var obj = {
+ /**
+ * The backbone collection of currently observerd files.
+ */
+ collection:observed_files,
+
+ /**
+ * This will add a new file or folder to the list of observed files, if its not already there.
+ * @param element
+ */
+ add:function (element) {
+ var filetest = Titanium.Filesystem.getFile(element.path);
+ if (filetest.isDirectory()) {
+ return read_folder(filetest);
+ } else {
+ return read_file(filetest);
+ }
+ },
+
+ remove:function (model) {
+ observed_files.remove(model);
+ to_storage();
+ },
+
+ flush:function () {
+ observed_files.reset();
+ },
+ restore_files: function(){
+ from_storage();
+ }
+ }
+
+ /**
+ * Constantly polling the files.
+ */
+ setInterval(function () {
+ observed_files.each(function (lessfile) {
+ var last_compilation = lessfile.get('last_compilation');
+
+ _.each(lessfile.get('constraints'), function (file) {
+ if (file.modificationTimestamp() > last_compilation) {
+ lessfile.set({
+ constraints:find_constraints(lessfile.get('input_file'))
+ });
+ compiler.compile(lessfile);
+ }
+ });
+
+ if (lessfile.get('input_file').modificationTimestamp() > last_compilation) {
+ lessfile.set({
+ constraints:find_constraints(lessfile.get('input_file'))
+ });
+ compiler.compile(lessfile);
+ }
+ });
+ }, 1000);
+
+ return obj;
+});
View
430 Resources/app/modules/ui.js
@@ -0,0 +1,430 @@
+/**
+ * UI
+ * ===========
+ * The UI module handles everything UI related.
+ */
+define([
+ 'modules/storage',
+ 'modules/compiler',
+ 'text!templates/list-item.html'
+], function (storage, compiler, tmp_src_listitem) {
+ var tmp_listitem = _.template(tmp_src_listitem);
+
+ /**
+ * Makes sure that numbers are always of two digits. Will prefix a "0" to numbers < 10
+ * @param in_number
+ * @return {String}
+ */
+ function dbldigit(in_number) {
+ in_number = Number(in_number);
+ return (in_number < 10) ? '0' + in_number : '' + in_number;
+ }
+
+ /**
+ * Determines the difference in seconds between two date objects.
+ * @param date_a
+ * @param date_b
+ * @return {Number}
+ */
+ function date_diff(date_a, date_b) {
+ return Math.abs(date_a.getTime() - date_b.getTime()) / 1000;
+ }
+
+ /**
+ * Will prettify a date you pass into.
+ * @param in_date
+ * @return [pretty_date, pretty_time]
+ */
+ function pretty_date(in_date) {
+
+ //This is a list of all months, since we want to display the month' name instead of the number.
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+
+ var filedate_str = months[in_date.getMonth()] + ' ' + dbldigit(in_date.getDate()) + ', ' + in_date.getFullYear();
+ var time = dbldigit(in_date.getHours()) + ':' + dbldigit(in_date.getMinutes());
+ var diff = date_diff(in_date, new Date());
+
+ if (diff < 30) return 'A few seconds ago';
+ if (diff < 60) return 'About a minute ago';
+ if (diff < 300) return Math.floor(diff / 60) + ' minutes ago';
+ if (diff < 3600 * 5) return time;
+ return filedate_str;
+ }
+
+ var file_view = Backbone.View.extend({
+ tagName:'li',
+ events:{
+ "click .recompile":"recompile",
+ "click .remove":"remove",
+ "click .prefixr":"toggle_prefixr",
+ "click .minify":"toggle_minify",
+ "click .love":"toggle_love",
+ "click .browse":"browse_css"
+ },
+ is_appended:false,
+ initialize:function () {
+ $('body').removeClass('welcome');
+ if (!$('#add-more').size()) $('#list').append('<li id="add-more"></li>')
+ $('#add-more').before(this.render().el);
+ this.is_appended = true;
+ Cufon.replace(this.el);
+
+ this.model.bind('change:all', this.render, this);
+
+ var _this = this;
+ this.model.bind('compilation:success', function () {
+ _this.model.collection.trigger('compillation:success');
+ _this.render();
+ });
+
+ this.model.bind('compilation:error', function (err) {
+ if (err.filename == null) {
+ err.filename = _this.model.get('input_file').nativePath().toString().split(Titanium.Filesystem.getSeparator()).pop();
+ }
+
+ _this.model.collection.trigger('compillation:error', err);
+ _this.model.set({
+ error:err
+ });
+ _this.render();
+ require(['modules/notification'], function (n) {
+ n.show({
+ title: 'Compilation Error',
+ icon: 'img/compilation-error.png',
+ message: err.message,
+ position: 'bottom-right',
+ duration: 5000
+ });
+ });
+ });
+
+ setInterval(function () {
+ _this.render();
+ }, 15000);
+ },
+ render:function () {
+ var model_dta = this.model.toJSON(),
+ dta,
+ source_path = model_dta.input_file.nativePath().split(Titanium.Filesystem.getSeparator());
+
+ $(this.el).removeClass('success error');
+
+ var source = String(model_dta.input_file.nativePath()).split(Titanium.Filesystem.getSeparator());
+ var target = String(model_dta.output_file.nativePath()).split(Titanium.Filesystem.getSeparator());
+
+ dta = {
+ filename:source_path.pop(),
+ source_file_name:source.pop(),
+ target_file_name:target.pop(),
+ source_file_path:source.join(Titanium.Filesystem.getSeparator()) + Titanium.Filesystem.getSeparator(),
+ target_file_path:target.join(Titanium.Filesystem.getSeparator()) + Titanium.Filesystem.getSeparator(),
+ info_a:'',
+ info_b:'',
+ settings:model_dta.settings,
+ constraints:[]
+ }
+
+ _.each(model_dta.constraints, function (c) {
+ var filename = c.nativePath().split(Titanium.Filesystem.getSeparator()).pop();
+ dta.constraints.push(filename);
+ });
+
+ if (model_dta.error) {
+ $(this.el).addClass('error');
+ dta.info_a = model_dta.error.message.replace('on', 'in ' + model_dta.error.filename + ' <b>on') + '</b>';
+ } else {
+ var compile_time = new Date();
+ if (model_dta.output_file.exists()) {
+ compile_time.setTime(model_dta.output_file.modificationTimestamp() / 1000);
+ if (date_diff(compile_time, new Date()) < 10) {
+ dta.info_a = 'Compilation successful';
+ $(this.el).addClass('success');
+ var _this = this;
+ setTimeout(function () {
+ _this.render();
+ }, 10000);
+ } else {
+ var pretty_date_result = pretty_date(compile_time);
+ dta.info_a = pretty_date_result;
+ }
+ } else {
+ //Never compiled
+ dta.info_a = 'Never compiled';
+ }
+ }
+
+ if (model_dta.uploading) {
+ dta.info_a = 'Uploading to prefixr.com...';
+ }
+
+
+ this.el.innerHTML = tmp_listitem(dta);
+ $('.constraints', this.el).attr('title', 'Compilation will be triggered from these files: \n\n' + dta.constraints.join('\n'));
+ if (this.is_appended) Cufon.replace(this.el);
+ return this;
+ },
+ recompile:function () {
+ compiler.compile(this.model);
+ },
+ remove:function () {
+ storage.remove(this.model);
+ $(this.el).remove();
+ if ($('#list li').size() == 1) {
+ $('#add-more').remove();
+ $('body').addClass('welcome');
+ }
+ },
+ toggle_prefixr:function () {
+ var settings = this.model.get('settings');
+ settings.prefix = !settings.prefix;
+ this.model.set({
+ settings:settings
+ });
+ this.model.trigger('change:settings', settings);
+ this.model.trigger('change:all');
+ },
+ toggle_minify:function () {
+ var settings = this.model.get('settings');
+ settings.minify = !settings.minify;
+ this.model.set({
+ settings:settings
+ });
+ this.model.trigger('change:settings', settings);
+ this.model.trigger('change:all');
+ },
+ toggle_love:function () {
+ var settings = this.model.get('settings');
+ settings.love = !settings.love;
+ this.model.set({
+ settings:settings
+ });
+ this.model.trigger('change:settings', settings);
+ this.model.trigger('change:all');
+ },
+ browse_css:function () {
+ var abs,
+ filename,
+ model = this.model;
+
+ var sourcefile = this.model.get('output_file');
+ if (sourcefile == null) {
+ //Take path of the LESS file.
+ abs = this.model.get('absolute_path').split(Titanium.Filesystem.getSeparator());
+ filename = abs.pop();
+ } else {
+ //Take path of the CSS file.
+ abs = sourcefile.nativePath().split(Titanium.Filesystem.getSeparator());
+ filename = abs.pop();
+ }
+ abs = abs.join(Titanium.Filesystem.getSeparator());
+
+ var options = {
+ title:'Select target CSS file',
+ defaultName:filename.replace('less', 'css'),
+ types:['css'],
+ typesDescription:'CSS files',
+ path:abs
+ }
+
+ Titanium.UI.currentWindow.openSaveAsDialog(function (selected_path) {
+ var css_file = Titanium.Filesystem.getFile(selected_path);
+ model.set({
+ output_file:css_file
+ });
+ model.trigger('change:settings');
+ model.trigger('change:all');
+ }, options);
+ },
+ settings:function () {
+ var model = this.model;
+ var settings = model.get('settings');
+ require(['modules/context_menu'], function (ContextMenu) {
+ var menu = new ContextMenu([
+ {
+ label:'Mention SimpLESS in a CSS comment',
+ css_class:settings.love ? 'tick' : 'cross',
+ callback:function () {
+
+ settings.love = !settings.love;
+ model.set({
+ settings:settings
+ });
+ model.trigger('change:settings', settings);
+ }
+ },
+ {
+ label:'Minify CSS',
+ css_class:settings.minify ? 'tick' : 'cross',
+ callback:function () {
+ settings.minify = !settings.minify;
+ model.set({
+ settings:settings
+ });
+ model.trigger('change:settings', settings);
+ }
+ },
+ {
+ label:'CSS Prefixing with prefixr.com',
+ css_class:settings.prefix ? 'tick' : 'cross',
+ callback:function () {
+ settings.prefix = !settings.prefix;
+ model.set({
+ settings:settings
+ });
+ model.trigger('change:settings', settings);
+ }
+ },
+ {
+ label:'Set target CSS file...',
+ css_class:'browse',
+ callback:function () {
+ var abs,
+ filename;
+
+ var sourcefile = model.get('output_file');
+ if (sourcefile == null) {
+ //Take path of the LESS file.
+ abs = model.get('absolute_path').split(Titanium.Filesystem.getSeparator());
+ filename = abs.pop();
+ } else {
+ //Take path of the CSS file.
+ abs = sourcefile.nativePath().split(Titanium.Filesystem.getSeparator());
+ filename = abs.pop();
+ }
+ abs = abs.join(Titanium.Filesystem.getSeparator());
+
+ var options = {
+ title:'Select target CSS file',
+ defaultName:filename.replace('less', 'css'),
+ types:['css'],
+ typesDescription:'CSS files',
+ path:abs
+ }
+
+ Titanium.UI.currentWindow.openSaveAsDialog(function (selected_path) {
+ var css_file = Titanium.Filesystem.getFile(selected_path);
+ model.set({
+ output_file:css_file
+ });
+ model.trigger('change:settings', model.get('settings'));
+ }, options);
+ }
+ }
+ ]);
+
+ menu.show_at_element($('.settings', this.el));
+ });
+ }
+ });
+
+
+ //The infamous Titanium Dropfix
+ function dropfix() {
+ var bind_object = document,
+ files = [],
+ wait = 0;
+
+ bind_object.ondragenter = bind_object.ondragover = function (e) {
+ e.preventDefault();
+ e.stopPropagation();
+ e.dataTransfer.effectAllowed = 'all';
+ e.dataTransfer.dropEffect = 'all';
+ if (e.dataTransfer.files.length) {
+ files = e.dataTransfer.files;
+ wait = 0;
+ }
+ };
+
+ bind_object.onmousemove = function (e) {
+ if (files.length == 0) return;
+ wait++
+ if (wait > 5) {
+ var evt = document.createEvent('CustomEvent');
+ evt.initCustomEvent('drop');
+ evt.dataTransfer = {
+ files:files
+ };
+ files = [];
+ wait = 0;
+ bind_object.dispatchEvent(evt);
+ }
+ };
+ }
+
+ dropfix();
+
+ $(document).bind('drop', function (e) {
+ var my_files = e.originalEvent.dataTransfer.files;
+ for (var i = 0; i < my_files.length; i++) {
+ storage.add(my_files[i]);
+ }
+ });
+
+ storage.collection.bind('add', function (model) {
+ var view = new file_view({model:model});
+ });
+
+ storage.collection.bind('compillation:success', function () {
+ obj.tray.success('Compillation successful');
+ }, this);
+
+ storage.collection.bind('compillation:error', function (e) {
+ obj.tray.error('Compillation error: ' + e.message.replace('on', 'in ' + e.filename + ' on'));
+ }, this);
+
+
+ var list_dom = $('#list'),
+ love_button_dom = $('#love');
+
+ love_button_dom.click(function (e) {
+ if (confirm('Do you really want to remove all files from the watchlist?')) {
+ storage.flush();
+ $('#list li').remove();
+ $('body').addClass('welcome');
+ }
+ });
+
+ var obj = {
+ list:list_dom,
+ tray:{
+ normal:function () {
+ tray_icon.setIcon('img/icon-tray.png');
+ tray_icon.setHint('SimpLESS');
+ },
+ success:function (message) {
+ tray_icon.setIcon('img/icon-tray-green.png');
+ tray_icon.setHint('SimpLESS - ' + message);
+ setTimeout(function () {
+ obj.tray.normal();
+ }, 2000);
+ },
+ error:function (message) {
+ tray_icon.setIcon('img/icon-tray-red.png');
+ tray_icon.setHint('SimpLESS - ' + message);
+ setTimeout(function () {
+ obj.tray.normal();
+ }, 10000);
+ }
+ }
+ }
+
+
+ //Configuring the Tray Symbol.
+ var win = Titanium.UI.getMainWindow();
+ win.addEventListener(Titanium.MINIMIZED, function (e) {
+ e.preventDefault();
+ win.unminimize();
+ win.hide();
+ });
+ //When someone clicks on the tray, bring the main window back on screen.
+ var tray_icon = Titanium.UI.addTray('img/icon-tray.png', function (e) {
+ win.show();
+ win.unminimize();
+ });
+ obj.tray.normal();
+
+ storage.restore_files();
+
+
+ return obj;
+});
View
5 Resources/app/templates/less_error_replacement.js
@@ -0,0 +1,5 @@
+function error(e, href) {
+ window.require(['modules/compiler'], function (compiler) {
+ compiler.current_model.trigger('compilation:error', e);
+ });
+ }
View
43 Resources/app/templates/less_xhr_replacement.js
@@ -0,0 +1,43 @@
+function xhr(url, type, callback, errback) {
+ var a = 'b';
+ //Okay, callback awaits (data, lastModified);
+ //errback awaits (status, url) (both strings)
+
+ if (url.substr(0, 7) == 'http://' || url.substr(0, 8) == 'https://' || url.substr(0, 6) == 'ftp://') {
+ //AJAX load.
+ window.$.ajax({
+ url:url,
+ timeout:500,
+ error:function (jqXHR, textStatus, errorThrown) {
+ window.require(['modules/compiler'], function (compiler) {
+ compiler.current_model.trigger('compilation:error', {message:textStatus, filename:url});
+ });
+ errback(textStatus, url);
+ },
+ success:function (data) {
+ callback(data, 0);
+ }
+ });
+ } else {
+ //FILE load.
+ window.require(['modules/compiler'], function (compiler) {
+ var current_basefile = compiler.current_model.get('input_file'),
+ sep = Titanium.Filesystem.getSeparator();
+
+ var current_file = current_basefile.resolve(url);