Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev:
  update doc
  add logo
  delete invalid*, add checkConsRepeatsWithIgnoreCase
  update invalid*
  update doc, update invalidInfo
  update dist
  update doc, optimize splitContent*, rename checkRepast, fixed bug, change changelog to asciidoc
  fixed bug
  update doc, rename *Height
  update badges
  • Loading branch information
leonardwoo committed Jul 20, 2023
2 parents c5844d9 + 2a0dfc1 commit 450f452
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 235 deletions.
45 changes: 45 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
= Pika JS

== 0.1.6 2023-07-20
. Rename `Pikajs.getSelectorHeight` to `Pikajs.getFirstSelectorHeight` and `Pikajs.getFirstSelectorHeightWithParent`
. Rename `Pikajs.hasSelectionHeight` to `Pikajs.hasSelectorHeight` and `Pikajs.hasSelectorHeightWithParent`
. Rename `Pikajs.calcMinMain(parentNode)` to `Pikajs.calcMinMainWithParent(parentNode)`
. Rename `Pikajs.checkRepeat` to `Pikajs.checkConsRepeats`
. Add `Pikajs.base64Encode` and `Pikajs.base64Decode`
. Delete `Pikajs.invalidInfo`
. Update document
. Optimize code
. Add project logo

== 0.1.5 2023-06-21
. Update document
. Remove `CalcMinMain` to `Pikajs.calcMinMain`
. Remove `InvalidInfo` to `Pikajs.invalidInfo`
. Remove `PassQCalc` to `Pikajs.passQCalc`
. Update `Pikajs.splitAnimationElement` to `Pikajs.splitContent`
. Add `Pikajs.splitContentWithParity`

== 0.1.4 2023-04-21
. Update document
. Optimize code
. Update `CalcMinMain` with parent node

== 0.1.3 2023-01-03
. Update `Pikajs`
. Add `DOCUMENT.md`
. Update copyright

== 0.1.2 2022-11-10
. Add `Pikajs` class
. Update document
. Fixed misspelling of method names
. Change `uglify-js` to `terser` for compress

== 0.1.1 2022-10-13
. Add password quality calculator
. Fixed bug
. Update document

== 0.1.0 2022-09-25
. Add `main` tag `min-height` calculator.
. Add invaild info util
40 changes: 0 additions & 40 deletions CHANGELOG.md

This file was deleted.

87 changes: 53 additions & 34 deletions DOCUMENT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Pika JS document

## `Pikajs`
## Build

```shell
npm install
npm run compress
```

## `Pikajs` class

### `calcMinMain`

Expand All @@ -12,35 +19,35 @@ window.addEventListener('load', (event) => {
});
```

### `calcMinMain(parentNode)`
Result:

```html
<main style="min-height: calc(100vh - 26px)">
</main>
```

`26px` is `headerHeight + footerHeight`, if include `selection` tag, `footerHeight` is 0.

### `calcMinMainWithParent(parentNode)`

Calculate `min-height` and fill it in the style of the `main`, and ensure that main fills the entire page.

```js
window.addEventListener('load', (event) => {
let app = document.getElementById('app');
Pikajs.calcMinMain(app);
Pikajs.calcMinMainWithParent(app);
});
```

### `invalidInfo(inputId='',inputEId='', regex='', message='')`

Add or remove a `p` tag with `inputEId` below the tag to display validation information.

like this:
Result:

```html
<div>
<input type="text" id="{{inputId}}" />
</div>
<script>
document.getElementById('inputId').onchange = (event) => {
Pikajs.invalidInfo('{{inputId}}','{{inputEId}}', '{{regex}}', '{{message}}');
// when inputId is invalid with regex, add <p id="{{inputEId}}">{{message}}</p> under input.
}
</script>
<main style="min-height: calc(100vh - 26px)">
</main>
```

`26px` is `headerHeight + footerHeight`, if include `selection` tag, `footerHeight` is 0.

### `passQCalc(pass='')`

Password Quality Calculator, if the value is greater than 80, it is a strong password.
Expand All @@ -57,29 +64,33 @@ pqcalc('P422w0Rd').then((result) => {
});
```

### `getSelectorHeight(selector='')`
### `getFirstSelectorHeight(selector)`

Get element selector height
Get first selector height

### `getSelectorHeight(parentNode,selector='')`
### `getFirstSelectorHeightWithParent(parentNode,selector)`

Get element selector height under parent node
Get first selector height under parent node

### `hasSelectionHeight()`
### `hasSelectorHeight(selector)`

Has section tag
Has first selector

### `hasSelectionHeight(parentNode)`
### `hasSelectorHeightWithParent(parentNode, selector)`

Has section tag under parent node
Has first selector under parent node

### `isPassword(pass="")`

Is password (only ASCII printable characters without space)

### `checkRepeat(text="")`
### `checkConsRepeats(text="")`

Check for consecutive repeated characters

### `checkConsRepeatsWithIgnoreCase(text="")`

Check repeat character
Check for consecutive repeated characters with ignore case

### `checkChar(text="", regex="")`

Expand Down Expand Up @@ -113,6 +124,14 @@ Decode Base64 to byte buffer

Encode byte buffer to Base64

### `base64Encode(data="")`

Base64 Encoder

### `base64Decode(data="")`

Base64 Decoder

### `stringToArrayBuffer(str)`

Convert string to byte buffer
Expand All @@ -123,7 +142,7 @@ Convert byte buffer to string

### `getDarkMode()`

Get browser dark mode
Get browser dark mode status

Return undefined is unsupported, true is dark mode, false is light mode

Expand All @@ -140,16 +159,16 @@ to
const animaEles = document.body.querySelectorAll(".animEles");
animaEles.forEach((e) => {
Pikajs.splitContent(e.innerHTML, "", "em")
.then(function (event) {
.then((event) => {
e.innerHTML = event;
})
.catch(function (error) {
.catch((error) => {
console.log(error);
});
});
```

### `splitContentWithParity(content = "", separator = "", splitTag = "", evenClass = "", oddClass = "")`
### `splitContentWithParity(content = "", separator = "", splitTag = "", oddClass = "", evenClass = "")`

Split content with parity

Expand All @@ -161,11 +180,11 @@ to
```javascript
const animaEles = document.body.querySelectorAll(".animEles");
animaEles.forEach((e) => {
Pikajs.splitContent(e.innerHTML, "", "em", "even", "odd")
.then(function (event) {
Pikajs.splitContentWithParity(e.innerHTML, "", "em", "odd", "even")
.then((event) => {
e.innerHTML = event;
})
.catch(function (error) {
.catch((error) => {
console.log(error);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022 The original author or authors
Copyright (c) 2023 Leonard Woo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
53 changes: 26 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
# Pika JS

![GitHub](https://img.shields.io/github/license/leonardwoo/pika-js?style=flat-square)
[![npm (tag)](https://img.shields.io/npm/v/@leonardwoo/pika-js/latest?style=flat-square)](https://www.npmjs.com/package/@leonardwoo/pika-js)

## Introduction

A function toolkit.

## CDN

- [jsDelivr](https://www.jsdelivr.com/package/npm/@leonardwoo/pika-js)
- [unpkg](https://unpkg.com/@leonardwoo/pika-js)

## Browser Use
<p align="center">
<a href="https://github.com/leonardwoo/pika-js" target="_blank">
<img alt="PikaJS" src="https://projects.l6d.me/images/pika2.svg" width="150" />
</a>
</p>

<p align="center">
A javascript toolkit that includes DOM processing, string validation, etc.
</p>

<p align="center">
<a href="https://github.com/leonardwoo/pika-js/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/leonardwoo/pika-js?style=flat-square" alt="License">
</a>
<a class="text-decoration-none" href="https://srl.cx/fZlMml7f">
<img src="https://img.shields.io/npm/v/@leonardwoo/pika-js?style=flat-square" alt="Latest Release">
</a>
<a class="text-decoration-none" href="https://srl.cx/fZlMml7f">
<img src="https://img.shields.io/npm/dt/@leonardwoo/pika-js?style=flat-square" alt="Total Downloads">
</a>
</p>

## Used

### Release Version

```html
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
Expand All @@ -21,18 +31,7 @@ A function toolkit.
<script async src="https://cdn.jsdelivr.net/npm/@leonardwoo/pika-js/dist/pika.min.js"></script>
```

OR

```html
<link rel="dns-prefetch" href="https://unpkg.com">
<link rel="preconnect" href="https://unpkg.com" />
<link rel="preconnect" href="https://unpkg.com" crossorigin />
<script async src="https://unpkg.com/@leonardwoo/pika-js/dist/pika.min.js"></script>
```

## Development Version

**Development version only for testing**
### Development Version

```html
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
Expand Down
2 changes: 1 addition & 1 deletion dist/pika.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 450f452

Please sign in to comment.