Giter Site home page Giter Site logo

divakarmanivel / blacktie.js Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 188 KB

BlackTie is a framework to build cross-platform and cross-device HTML/CSS/JavaScript applications that have the look and feel of a native app. Create seamless applications with minimal effort from scratch or power your existing application by simply integrating BlackTie.js into it. Create standalone applications using just notepad or any text editor of your choice!

Home Page: https://divakarmanivel.github.io/blacktie.js/

License: MIT License

JavaScript 52.59% CSS 44.01% HTML 3.40%
javascript framework cordova webapp cross-platform cross-device hacktoberfest

blacktie.js's Introduction

BlackTie.js logo

BlackTie is a framework to build cross-platform and cross-device HTML/CSS/JavaScript applications that have the look and feel of a native app. Create seamless applications with minimal effort from scratch or power your existing application by simply integrating BlackTie.js into it. Create standalone applications using just notepad or any text editor of your choice!

Anybody can create beautiful looking applications using BlackTie.js.

Browser and Device Support

BlackTie aims to create applications that are compatible with all browsers and devices. Every feature in the framework is tested on multiple browsers and devices.

Setup

For a live demo, visit BlackTie.js on desktop or mobile.

Demo

Copy all files from www/js, www/css and www/fonts to your applications www folder. Add these lines in the head tag of index.html as:

<head>
..
<!-- BlackTie CSS -->
<link rel="stylesheet" type="text/css" href="./css/blacktie.css" />
<!-- Font-Family CSS -->
<link href='./css/font-family.css' rel='stylesheet' type='text/css'>
..
</head>

Add these lines before closing body tag of index.html as:

<body>
..
<!-- BlackTie -->
<script src="./js/blacktie.js" type="text/javascript"></script>
</body>

Usage

Initialize BlackTie and create an instance in your index.js file

var demo = blacktie.init();

Add a div element inside the body element of index.html

<body>
    <div id="container">
    ..
    //app body content goes here
    ..
    </div>
</body>

The following features are available in BlackTie framework

Hamburger navigation menu

To add a hamburger menu setup BlackTie and add this code above the container element of index.html. It should look like this.

<body>
    <ul id="ham-menu">
    <li class="ham-item"><a href="#">Item one</a></li>
    <li class="ham-item"><a href="#">Item two</a></li>
    <li class="ham-item"><a href="#">Item three</a></li>
    <li class="ham-item"><a href="#">Item four</a></li>
    </ul>

    //All other content must come under the container div element below this ul tag.
    <div id="container">
    ..
    //app body content goes here
    ..
    </div>
</body>

Then in your index.js file, call hammenu to initialize the Hamburger navigation.

demo.hammenu();

Debugging

Logs a message to console

var msg = "This is a message!";
demo.log(msg);

UI

Shows an elegant notification message. Leave 'type' as blank for default notification

demo.notify("This is a default notification");

demo.notify("This is an alert notification","alert");

demo.notify("This is an error notification","error");

demo.notify("This is a success notification","success");

Sets the content of the containing body element

var content = "<p>This is the content!</p>";
demo.setContent(content);

Sets the style of the target element. Use '#elementID' for an element with id and '.class' for elements in a class

var style = '{"backgroundColor":"Red", "color":"White"}';
demo.setStyle(style, "#classID");

OR

demo.setStyle(style, ".className");

Returns a DOM element which has star ratings (maximum 10 star rating)

var rating = demo.createStarCard("Blacktie" ,"./images/logo.png" ,5);

Adds DOM element to containing body

demo.addElement(rating);

Opens a page in the containing body

var url = "./home.html";
demo.openPage(url);

Shows a loading element

demo.showLoading();

Hides the loading element

demo.hideLoading();

Network

Opens an oauth connection to a service

var baseurl = "https://mygoogleendpoint/";
var tokenurl = "users";
var clientid = "my_id";
var apikey = "my_key";
var scope = "";
var responsetype = "token"; //It can also be "code"
var other = ""; //Any other payloads
var callback = function(){};
demo.openGoogleOauth(baseurl, tokenurl, clientid, apikey, scope, responsetype, other, callback);

Sends a get or post request

var url = "https://myurl";
var data = {
	date: payload
};    
var headers = {
	Authorization: sometokenhere
};
var callback = function(){};    
demo.sendRequest(url, method, data, headers, callback);

Storage

Stores a <key,vaue> pair to localStorage

demo.setItem(key, value);

Gets the value for a specified key in localStorage

demo.getItem(key);

Stores a <key,vaue> pair to sessionStorage

demo.setVal(key, value);

Gets the value for a specified key in sessionStorage

demo.getVal(key);

Contribution

I welcome pull requests from all! Thanks in advance! Visit our Contributions page for more information.

Code of Conduct

Visit our Code of Conduct page for an overview on our ground rules.

License

Created and Maintained by Divakar Manivel. Licensed under MIT.

blacktie.js's People

Contributors

divakarmanivel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

rajkumarpb

blacktie.js's Issues

not loading demo.openPage on certain situations correctly

Expected Behavior

load view correctly

Current Behavior

loading demo.openPage in this situation loads but scrolled down

Possible Solution

Steps to Reproduce (for bugs)

  1. Look at https://www.tetsiapp.com/testing
  2. Then click on menu, top left corner.
  3. Then click on "Windows".
  4. Click on first blue button (first "Leer Tetsi").
  5. Down end of page, and click "Volver a Tetsis".
  6. Look bug.

Context

I want go back using button or go back with hardware button on android.

Your Environment

how works

how works hammenu? it is posible to click a link and open independent html into container. or i have to clone index html?

Update readme

You should make a better readme. Explain what blacktie does, and why it can be better than alternatives.
Explain what it doesn't do. Give a brief explanation of what cordova is and why it does exist.

menu issue on back button in chrome

Expected Behavior

I want to appear closed menu when go to a menu page and go back.

Current Behavior

When press on menu, then on a menu entry and go back with Chrome menu behaviour is unexpected.

Possible Solution

I don´t get explanation.

Steps to Reproduce (for bugs)

https://www.tetsiapp.com

  1. Look at https://www.tetsiapp.com
  2. Then click on menu, top left corner.
  3. Then click on "Tetsis".
  4. Go back with Chrome, and look menu behaviour.

Context

I want, press back, and load page good.

Your Environment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.