Fadak.IR Fadak Solutions
English Русский العربية فارسی
Articles Management Studies Language


/ Coumputer / Programming

JavaScript Libraries and Frameworks Tutorial


      Carousel, Slider, Gallery
      Displaying images
      Datepicker
      Display
      Condition in single line
      Submitting a form on 'Enter' with jQuery
      Latex in D3.js
      Focus
      Ajax
         Ajax with jquery
         $.ajax
         Ajax simple
   E-Book
   Javascript Editor
   Javascript WYSIWYG editor
   TinyMCE Javascript WYSIWYG editor
      Plugins
      Shortcut keys TinyMCE
      Crack TinyMCE 5.x
      Directionality in TinyMCE 5.x
   Scalable Vector Graphics (SVG)
   The Five Best Data Visualization Libraries
   Maps & Geographic information
   D3.js Cheatsheet
      d3.js quick reference sheet
         Attributes/Styles
         Classes
         Link/Href
         Properties
         Axis
         Time parsing/formatting
         Color
         General Update Pattern
         Transition
      D3.js Reference
   JQuery
      Other
      Datepicker - TimeTable - Calendar
      Other
         checkCodeMeli

Carousel, Slider, Gallery

Owl Carousel
Splide
Swiper
Slick

Displaying images

Fancybox
Slick Carousel

Datepicker

https://code-boxx.com/simple-datepicker-pure-javascript-css/

Display

function myFunction() {
var x = document.getElementById("Create");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}

Condition in single line

(lemons) ? alert("please give me a lemonade") : alert("f condition is FALSE");
if (lemons) document.write("foo gave me a bar");
lemons && document.write("foo gave me a bar");
a == 10 ? alert("true") : alert("false");
var something = (Boolean_expression) ? trueValueHardware : falseATRON;
(i === 0 ? "true" : "false")

Submitting a form on 'Enter' with jQuery

$('.input').keypress(function (e) {
if (e.which == 13) {
$('form#login').submit();
return false; //<---- Add this line
}
});

Latex in D3.js

Edit fiddle - JSFiddle - Code Playground

Focus

var div = document.getElementById('counts');
function onBlur() {
console.log("onBlur");
};
function onFocus(){
console.log("onFocus");
};
if (/*@cc_on!@*/false) { // check for Internet Explorer
div.onfocusin = onFocus;
div.onfocusout = onBlur;
} else {
div.onfocus = onFocus;
div.onblur = onBlur;
}

div.addEventListener('focus', onFocus, false); // does not work, focus does not bubble
div.addEventListener('blur', onBlur, false); // does not work, blur does not bubble

div.addEventListener('focusin', onFocus, false); // works when input is focused, as the event bubbles
div.addEventListener('focusout', onBlur, false); // works when input loose focus, as the event bubbles

function handler(event) {
console.log(event.type)
}

Планирование: setTimeout и setInterval

Ajax

Ajax with jquery

</ script type="text/javascript" src="http://fadak.ir/cmi/assets/jquery-3.3.1.min.js"></ /script>

</ button type=\"button\" onclick=\"ajax('#example".$row['ID']."')\">Edit example

</ script>
function ajax(form){
var data = $(form).serialize();
$.post('example_template1.php',data,function(data,status){
if(status=='success'){
alert(data);
}else{
alert('В процессе отправки произошла ошибка :(');
}
})
}
</ /script>

$.ajax

$.ajax, $.get, $.post, $.getScript, $.getJson differences in jquery

$.ajax() Performs an asynchronous HTTP (Ajax) request basically this is a method of jquery which internally uses xmlhttprequest object of JavaScript as asynchronous communicator which supports cross browser also.
There is lots of confusion in some of the function of jquery like $.ajax, $.get, $.post, $.getScript, $.getJSON that what is the difference among them which is the best, which is the fast, which to use and when so below is the description of them to make them clear and to get rid of this type of confusions.
$.get() function is a shorthand Ajax function, which is equivalent to below expression, Uses some limited criteria like Request type is GET. In $.get() function there is no any error callback only you can track succeed callback and there no standard setting supported like beforeSend, statusCode, mimeType etc, if you want to customize use $.ajax().
get: function(url, data, callback, type) {
if ($.isFunction(data)) {
callback = data;
data = null;
}
return $.ajax({
type: "GET",
url: url,
data: data,
success: callback,
dataType: type
});
}
$.post() function is a shorthand Ajax function, which is equivalent to below expression, Uses some limited criteria like Request type is POST. In $.post() function there is also no any error callback only you can track succeed callback and there no standard setting supported like beforeSend, statusCode, mimeType etc, if you want it use $.ajax().
post: function(url, data, callback, type) {
if ($.isFunction(data)) {
callback = data;
data = {};
}
return $.ajax({
type: "POST",
url: url,
data: data,
success: callback,
dataType: type
});
}
$.getScript() function is a shorthand Ajax function (internally use $.get() with data type JSON), which is equivalent to below expression, Uses some limited criteria like Request type is GET and data Type is script.
$.getJSON() function is a shorthand Ajax function (internally use $.get() with data type script), which is equivalent to below expression, Uses some limited criteria like Request type is GET and data Type is json.getScript: function(url, callback) {
return $.get(url, null, callback, "script");
}
getJSON: function(url, data, callback) {
return $.get(url, data, callback, "json");
}And in both of the function ($.getScript(), $.getJSON()) there is also no any error callback only you can track succeed callback and there no standard setting supported like beforeSend, statusCode, mimeType etc, if you want it use $.ajax().

Ajax simple

</input type="text" onkeyup="showHint(this.value)"/>
</span id="txtHint"></span/>
</script/>
function showHint(str) {
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xhttp.open("GET", "gethint.php?q="+str, true);
xhttp.send();
}
</script/>

XMLHttpRequest POST, формы и кодировка

form serialize javascript (no framework) - Stack Overflow

E-Book

Online Interactive JavaScript (JS) Cheat Sheet
ECMAScript® 2019 Language Specification
Eloquent JavaScript
JSON.stringify() - JavaScript | MDN

Javascript Editor

JavaScript Tester online
Online Javascript Editor
JSFiddle - Code Playground

Javascript WYSIWYG editor

WYSIWYG HTML Editor with Collaborative Rich Text Editing

NuGet Gallery | TinyMCE 5.10.2

TinyMCE Javascript WYSIWYG editor

TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL.

Plugins

TinyMCE | Add Plugins to TinyMCE

Shortcut keys TinyMCE

These are the shortcuts currently in TinyMCE:

(ctrl on Mac = cmd)

Crack TinyMCE 5.x

Add this style for remove messages:
<//style>
.tox-statusbar__branding {display:none!important;}
.tox-notifications-container {display:none!important;}
<///style>

Directionality in TinyMCE 5.x

Add right to left in 5.x
<//script>
tinymce.init({selector:'textarea',
plugins: "directionality",
toolbar: "ltr rtl alignleft aligncenter alignright alignjustify",
file_picker_callback: function (callback, value, meta) {
browseFiles(value, meta.filetype, function (fileUrl) {
callback(fileUrl);
});
}
});
<///script>

Example

<///!DOCTYPE html>
<///html>
<///style>
.tox-statusbar__branding {display:none!important;}
.tox-notifications-container {display:none!important;}
<///style>
<//head>
<///script src='tinymce.min.js'>
<///script>
tinymce.init({
selector: '#texta',
//doctype : "<///html dir=rtl>",
spellchecker_language: "fa",
height: 600,
browser_spellcheck: true,
content_css: 'editor.css',
plugins: "paste directionality code searchreplace lists advlist wordcount table link image spellchecker",
toolbar: "formatselect|link unlink image|bullist numlist|ltr alignjustify rtl|code",
contextmenu: false,
});
<///script>
<///head>
<///textarea id="texta" name="mytextarea"><///textarea>

Scalable Vector Graphics (SVG)

Scalable Vector Graphics (SVG)
D3JS Wiki
Gallery D3 Wiki

The Five Best Data Visualization Libraries

D3. GitHub stars: 79,937. D3
React-vis. GitHub stars: 4,612
Chart. js. GitHub stars: 40,141
VX. GitHub stars: 5,263
Rechart. GitHub stars: 10,229

Maps & Geographic information

ArcGIS API for JavaScript | ArcGIS for Developers

D3.js Cheatsheet

d3.js quick reference sheet

Attributes/Styles

Attributes/Styles - initialization

var svgWrapper = d3.select("body")
.append("svg")
.attr("id", "viz")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom);

var container = svgWrapper.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.style("pointer-events", "all");

Attributes/Styles - circle

selection.attr("r", style.r)
.attr("fill", style.fill)
.attr("stroke", style.color)
.attr("stroke-width", style["stroke-width"])

Classes

selection.classed('my-class', true);

Link/Href

In SVG

selection.select('text')
.text(function(d) {
return d.name;
})
.attr("xlink:href", function(d){
return d.url;});

In HTML

selection
.append('a')
.attr('href', function(d) {
return d.url;
})
.text(function(d) {
return d.name;
});

Properties

var id = d3.select("#id").property("value");
d3.select("input").property("value", d3.event.keyCode);

Axis

var xAxis = d3.svg.axis()
.scale(_xScale)
.orient("bottom")
.ticks(4)
.tickFormat(d3.time.format('%d %b %I%p')) //14 Feb 12AM
.tickSize(5);

Time parsing/formatting

var parseDate = d3.time.format("%Y-%m-%dT%H:%M:%SZ").parse,
formatDate = d3.time.format("%d %b %H:%M:%S"),
formatDateForQuery = d3.time.format("%Y-%m-%dT%H:%M:%SZ"),
formatTime = d3.time.format("%H:%M:%S");

Color

Custom color ordinal scale

var myCategory20Colors = [
0x1f77b4, 0xaec7e8,
0xff7f0e, 0xffbb78,
0x2ca02c, 0x98df8a,
0xd62728, 0xff9896,
0x9467bd, 0xc5b0d5,
0x8c564b, 0xc49c94,
0xe377c2, 0xf7b6d2,
0xbcbd22, 0xdbdb8d,
0x17becf, 0x9edae5
].map(function(x) {
var value = x + "";
return d3.rgb(value >> 16, value >> 8 & 0xff, value & 0xff).toString();
});
var myCategory20 = d3.scale.ordinal().range(myCategory20Colors);
console.log(myCategory20("x"), myCategory20("y"));
// #1f77b4 #aec7e8

General Update Pattern

function update(data) {
// DATA JOIN
// Join new data with old elements, if any.
var text = svg.selectAll("text")
.data(data);
// UPDATE
// Update old elements as needed.
text.attr("class", "update");
// ENTER
// Create new elements as needed.
text.enter().append("text")
.attr("class", "enter")
.attr("x", function(d, i) { return i * 32; })
.attr("dy", ".35em");
// ENTER + UPDATE
// Appending to the enter selection expands the update selection to include
// entering elements; so, operations on the update selection after appending to
// the enter selection will apply to both entering and updating nodes.
text.text(function(d) { return d; });

// EXIT
// Remove old elements as needed.
text.exit().remove();
}

Transition

Chaining transition

function endall(transition, callback) {
if (transition.size() === 0) {
callback()
}
var n = 0;
transition
.each(function() {
++n;
})
.each("end", function() {
if (!--n) callback.apply(this, arguments);
});
}
selection.transition()
.attr("cx", xMap)
.attr("cy", yMap)
.call(endall, function() {
console.log("all loaded");
// do your next transition
});

Online jQuery Cheat Sheet
javascript - Invoke a callback at the end of a transition - Stack Overflow

D3.js Reference

D3.js Playground
Stacked-to-Grouped Bars / D3 / Observable
D3.js - Fullstack D3 and Data Visualization
Useful JQuery, D3.js and AngularJS Cheat-Sheets (HD) - Codemio - A Software Developer's Blog
D3js Cheatsheet
How to create jaw dropping Data Visualizations on the web with D3.js?
D3.js vs NumPy vs Pandas | What are the differences?
SVG Group Element and D3.js | DashingD3js.com
Введение в d3.js | Frontender Magazine
bar chart with D3.js - JSFiddle
D3.js Tutorial: Building Interactive Bar Charts with JavaScript | @RisingStack
D3.js 5 documentation — DevDocs
D3.js - Data-Driven Documents
Scrimba - Playlist D3.js tutorial series
Bar Chart in D3 v5 - bl.ocks.org
Data Visualization - List of D3 Examples - 2018
Creating a simple bar chart
Learn D3.js for free | Scrimba.com
d3noob’s Blocks - bl.ocks.org
آموزش D3.js
آموزش D3 - دریافت داده‌ها - لایو گوگل
آموزش D3 - کلیات - لایو گوگل
Mike Bostock’s Blocks - bl.ocks.org
Basic Chart - Grouped Bar Chart | DashingD3js.com
D3.js Axis API
Create Axes in D3.js
Plunker
Comparison of JavaScript charting libraries
Bar Chart in D3 v5 - bl.ocks.org
آموزش D3.js
Learn D3.js in 5 minutes – freeCodeCamp.org
Learn D3.js for free | Scrimba.com
d3.treemap() non hierarchical data - JSFiddle
D3.js - методы получения внешних данных - YouTube
D3.js tutorial - 10 - Loading External Data - YouTube
انواع نمودارها (1) - جادوبی
آموزش D3 - کلیات - لایو گوگل
D3 Tutorial Table of Contents | DashingD3js.com

JQuery

jQuery Cheat Sheet
jQuery Cheat Sheet | OverAPI.com
Top 10 jQuery Cheat Sheet - TemplateToaster Blog
Online jQuery Cheat Sheet
mbeaudru/modern-js-cheatsheet: Cheatsheet for the JavaScript knowledge you will frequently encounter in modern projects.

Attribute | jQuery API Documentation

$('td[name="tcol1"]') // Matches exactly 'tcol1'
$('td[name^="tcol"]' ) // Matches those that begin with 'tcol'
$('td[name$="tcol"]' ) // Matches those that end with 'tcol'
$('td[name*="tcol"]' ) // Matches those that contain 'tcol'

Use PHP to get tags within a set tag id, class or other from a Website

Use this JavaScript code (with jQuery) (I'm trying to make it simple but you'll do better if you learn well) :

// To get the content from a single HTML tag
var theID = "predefined";
var theContent = $("#" + theID).text(); // Or .html() if you want the whole content

// To POST the extracted content to your PHP page in order to write to your mySQL db
$.ajax({
type: "POST",
url: "http://www.myapp.com/mypage.php",
data: { id: theID, content: theContent },
success: function(response){ // just in case you need a response from your PHP stuff
alert(response);
}
});

Other

CodeMirror

datatables - Google Search

jspreadsheets - Best JavaScript Data Grids and Spreadsheets for React, Angular, Vue and Svelte.

Grider - Grider is a jQuery plugin to simplify the Master details forms

ngReactGrid - Best JavaScript Data Grids and Spreadsheets for React, Angular, Vue and Svelte.

Importabular : 5kb javascript spreadsheet component

Datepicker - TimeTable - Calendar

jalali-date-picker · GitHub Topics · GitHub

Shamsi | npm.io

Persian Web Toolkit

Other

XMLHttpRequest.send() - Web APIs | MDN

javascript - Send POST data using XMLHttpRequest - Stack Overflow

jquery - AJAX Post Implementation in Pure Javascript - Stack Overflow

Get all Elements in a Form using JavaScript | bobbyhadz

php - Alternative to jQuery's serialize()? - Stack Overflow

jquery - AJAX Post Implementation in Pure Javascript - Stack Overflow

checkCodeMeli

قطعه کد چک صحت کد ملی در Java Script

//function checkCodeMeli(code)
//{
//
// var L=code.length;
// if(L<8 || parseInt(code,10)==0) return false;
// code=('0000'+code).substr(L+4-10);
// if(parseInt(code.substr(3,6),10)==0) return false;
// var c=parseInt(code.substr(9,1),10);
// var s=0;
// for(var i=0;i<9;i++)
// s+=parseInt(code.substr(i,1),10)*(10-i);
// s=s%11;
// return (s<2 && c==s) || (s>=2 && c==(11-s));
// return true;
// }


Articles
Digital Media
Humanities
IT Management
Coumputer
Miscellaneous
Product & Services
About Fadak
Management
Contemporary Management Journal
Managerial Verses
Photography Quotes
Photo is written
Management Researcher Bank
Management articles titles
Educational Resources (Seminary & University)
Studies
Observatory - Personalities
Observatory - Cultural
Observatory - Academic
Observatory - Media
Observatory - scientific events
Language
Dictionary
Russian Language Test
Russian Proverb
English Proverb
Four language sentences
logo-samandehi
About | Contact With Us | Privacy Policy | Terms | Cookies Policy |
Version (Pre-Alpha) 2000-2022 CMS Fadak. ||| Version : 5.2 ||| By: Fadak Solutions Old Version