Jump to content

Search the Community

Showing results for tags 'css3'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 1 result

  1. Never say I don't give this community some little gems once in a while. I came up with the concept of creating a directory structure using nothing but valid HTML5 and CSS3. It uses an unknown "checkbox hack" concept which some HTML5/CSS3 purists consider to be beyond the semantics of the language. But I say if it's supported by all major browsers and it works, then why not! Note: I used >KaFu's idea for the current level and next level, but the rest I came up with myself, albeit I have used this "checkbox hack" before in other projects I have created. #include <File.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> MsgBox($MB_SYSTEMMODAL, '', 'This example only uses HTML5 and CSS3, I know, no JavaScript!') ; Thanks to KaFu for the idea: http://www.autoitscript.com/forum/topic/156913-dir2html-create-html-site-with-links-from-a-dir-structure/?p=1136522 Example() Func Example() Local Const $sSaveFilePath = @ScriptDir Local $sHTML = '', $sTab = @TAB _HTML_Add($sHTML, '<!DOCTYPE html>') _HTML_Add($sHTML, '<html lang="en">') _HTML_Add($sHTML, '<head>') _HTML_Add($sHTML, '<meta charset="utf-8">', $sTab) _HTML_Add($sHTML, '<title>Directory To HTML5 Concept</title>', $sTab) _HTML_Add($sHTML, '<style type="text/css">', $sTab) _Tab_Add($sTab) _HTML_Add($sHTML, '@import url(http://weloveiconfonts.com/api/?family=fontawesome);.dirtohtml a{background:transparent;color:#08c;position:relative;text-decoration:none;-webkit-transition:all .3s ease-out;transition:all .3s ease-out}.dirtohtml a:hover{color:#0af}.dirtohtml input[type=checkbox],.dirtohtml input[type=checkbox]+ul{display:none}.dirtohtml input[type=checkbox]:checked+ul{display:block}.dirtohtml label{cursor:pointer}.dirtohtml ul li{list-style:none}[class*="fontawesome-"]:before{font-family:"FontAwesome",sans-serif;margin-right:5px}', $sTab) _Tab_Remove($sTab) _HTML_Add($sHTML, '</style>', $sTab) _Tab_Remove($sTab) _HTML_Add($sHTML, '</head>') _HTML_Add($sHTML, '<body>') _Tab_Add($sTab) Local Const $sDirectorySelection = FileSelectFolder('Select a folder to map to HTML', '') Local $aFileList = _FileListToArrayRec($sDirectorySelection, '*', 0, 1, 2, 2) If @error Then _HTML_Add($sHTML, '<p>No files were present in the selected directory.</p>', $sTab) Else _HTML_Add($sHTML, '<div class="dirtohtml">', $sTab) _Tab_Add($sTab) _HTML_Add($sHTML, '<ul>', $sTab) _Tab_Add($sTab) Local $bIsRelative = False, _ $iCheckboxCount = 1, $iCurrentLevel = 0, $iNestedDepth = 0, $iNextIndex = 0, $iNextLevel = 0, _ $sFileName = '', $sRelativeFilePath = '' For $i = 1 To $aFileList[0] $aFileList[$i] = StringRegExpReplace($aFileList[$i], '(?:\\|/)', '\\') $iCurrentLevel = @extended If $i < $aFileList[0] Then $iNextIndex = $i + 1 $aFileList[$iNextIndex] = StringRegExpReplace($aFileList[$iNextIndex], '(?:\\|/)', '\\') $iNextLevel = @extended EndIf $sFileName = StringRegExpReplace($aFileList[$i], '^.+\\', '') If _WinAPI_PathIsDirectory($aFileList[$i]) = $FILE_ATTRIBUTE_DIRECTORY Then If $iNextLevel > $iCurrentLevel Or $iNextLevel = $iCurrentLevel Then _HTML_Add($sHTML, '<li>', $sTab) _Tab_Add($sTab) _HTML_Add($sHTML, '<label for="dirtohtml_' & $iCheckboxCount & '"><i class="fontawesome-folder-close-alt"></i>' & $sFileName & '</label>', $sTab) _HTML_Add($sHTML, '<input id="dirtohtml_' & $iCheckboxCount & '" type="checkbox">', $sTab) _HTML_Add($sHTML, '<ul>', $sTab) $iCheckboxCount += 1 $iNestedDepth += 1 ElseIf $iNextLevel < $iCurrentLevel Then _HTML_Add($sHTML, '<li>' & $sFileName, $sTab) EndIf _Tab_Add($sTab) Else $sRelativeFilePath = _PathGetRelative($sSaveFilePath, $aFileList[$i]) $bIsRelative = Not @error _HTML_Add($sHTML, '<li><i class="fontawesome-file"></i><a href="' & ($bIsRelative ? '' : 'file://') & StringReplace($sRelativeFilePath, '\', '/') & '">' & $sFileName & '</a></li>', $sTab) If $iNextLevel < $iCurrentLevel Then For $j = 1 To ($iCurrentLevel - $iNextLevel) _Tab_Remove($sTab) _HTML_Add($sHTML, '</ul>', $sTab) _Tab_Remove($sTab) _HTML_Add($sHTML, '</li>', $sTab) $iNestedDepth -= 1 Next EndIf EndIf Next If $iNestedDepth Then For $j = 1 To $iNestedDepth _Tab_Remove($sTab) _HTML_Add($sHTML, '</ul>', $sTab) _Tab_Remove($sTab) _HTML_Add($sHTML, '</li>', $sTab) Next EndIf _Tab_Remove($sTab) _HTML_Add($sHTML, '</ul>', $sTab) _Tab_Remove($sTab) _HTML_Add($sHTML, '</div>', $sTab) EndIf _HTML_Add($sHTML, '</body>') _HTML_Add($sHTML, '</html>') Local Const $sHTMLFilePath = _WinAPI_PathRemoveBackslash($sSaveFilePath) & '\index.html' Local Const $hFileOpen = FileOpen($sHTMLFilePath, BitOR($FO_OVERWRITE, $FO_UTF8)) If $hFileOpen > -1 Then FileWrite($hFileOpen, $sHTML) FileClose($hFileOpen) MsgBox($MB_SYSTEMMODAL, '', 'HTML file created successfully.' & @CRLF & $sHTMLFilePath) Else MsgBox($MB_SYSTEMMODAL, '', 'An error occurred writing to the HTML file.') EndIf ConsoleWrite($sHTML & @CRLF) ; ShellExecute($sHTMLFilePath) Return True EndFunc ;==>Example Func _HTML_Add(ByRef $sHTML, $sData, $sTab = Default) $sHTML &= (($sTab = Default) ? '' : $sTab) & $sData & @CRLF EndFunc ;==>_HTML_Add Func _Tab_Add(ByRef $sTab) $sTab &= @TAB EndFunc ;==>_Tab_Add Func _Tab_Remove(ByRef $sTab) Local Static $TAB_LENGTH = StringLen(@TAB) $sTab = StringTrimRight($sTab, $TAB_LENGTH) EndFunc ;==>_Tab_Remove
×
×
  • Create New...