From: Chris Fulljames Date: Fri, 29 May 2026 18:30:34 +0000 (-0400) Subject: Add drag-and-drop X-Git-Url: https://littlesong.place/gitweb/?a=commitdiff_plain;h=01c7fd843c7d2ae60d23044d0a3879029868fe0f;p=poll.git Add drag-and-drop --- diff --git a/index.php b/index.php index 359c720..a2e94ba 100644 --- a/index.php +++ b/index.php @@ -100,7 +100,7 @@ function create_new_poll($title, $options, $enddate) $qid = $q['qid']; // Create options (splitting input into lines) - foreach(preg_split("/((\r?\n)|(\r\n?))/", $options) as $o) + foreach(preg_split("/((\r?\n)|(\r\n?))/", trim($options)) as $o) { query_db( "INSERT INTO options(qid, name) VALUES (?, ?)", @@ -153,10 +153,14 @@ if (isset($qid) && isset($_GET['count'])) { } $ended = false; -if (isset($qid)) { +if (isset($qid)) +{ $enddate = get_end_date($qid); - $nowdate = gmdate("Y-m-d\TH:i"); - $ended = $nowdate > $enddate; + if ($enddate) + { + $nowdate = gmdate("Y-m-d\TH:i"); + $ended = $nowdate > $enddate; + } } ?> @@ -178,6 +182,9 @@ if (isset($qid)) { input, textarea { font-family: sans-serif; font-size: 1em; + box-sizing: border-box; + width: 100%; + margin-bottom: 0.5em; } input[type=submit] { background: #fdf; @@ -194,6 +201,12 @@ if (isset($qid)) { border: none; color: #434; } + input[type=number] { + width: unset; + } + form { + line-height: 1.5em; + } ul { list-style-type: none; padding: 0px; @@ -202,6 +215,11 @@ if (isset($qid)) { margin: 10px 0px; line-height: 1.1em; } + li[draggable=true] { + cursor: grab; + padding: 0.8em; + border: 1px solid #cca; + } hr { border: none; border-top: 1px solid #cca; @@ -234,27 +252,72 @@ if (isset($qid)) { if (isset($qid) && $view == "vote" && !$ended): ?>

- +

Closes: (UTC)

+
+ +

">Show Results

New Poll