Site Tools


onny:notizen:programmierung

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
onny:notizen:programmierung [2022/03/08 11:26] – [wordpress] 46.223.163.98onny:notizen:programmierung [2023/02/25 15:12] 10.100.0.1
Line 176: Line 176:
 </code> </code>
 ===== javascript ===== ===== javascript =====
 +
 split up javascript files split up javascript files
 +
 <code javascript> <code javascript>
 var MODULE = (function (my) { var MODULE = (function (my) {
Line 192: Line 194:
 }(MODULE || {})); }(MODULE || {}));
 </code> </code>
-jquery select by attribute content+ 
 +on document ready 
 <code javascript> <code javascript>
-$( "tr[data-id='"+data[station]["stationid"]+"']" ).remove(); +document.addEventListener("DOMContentLoaded", function() { 
-</code> +  your_function(...);
-jquery select dynamicly loaded ajax elements +
-<code javascript> +
-$('body').on('click','.btn + :not([class=disabled])', function() { +
-  var link = $(this).attr('src'); +
-  load_page(link);+
 }); });
 +
 </code> </code>
-jquery set background color + 
-<code javascript> +change content text 
-$(this).parent().css("background-color", "yellow"); +
-</code> +
-print mixed objects +
-<code javascript> +
-console.log('%d: %s', i, value); +
-</code> +
-javascript document ready +
-<code javascript> +
-$(document).ready(function(){ +
-  console.log('ready'); +
-}); +
-</code> +
-vanilla js change content text+
 <code javascript> <code javascript>
     var webgl_field = document.getElementById('webgl');     var webgl_field = document.getElementById('webgl');
Line 226: Line 214:
     }     }
 </code> </code>
-vanilla js ajax post form+ 
 +ajax post form 
 <code javascript> <code javascript>
     document.getElementById('form').onsubmit = function (evt) {     document.getElementById('form').onsubmit = function (evt) {
Line 244: Line 234:
     }     }
 </code> </code>
-vanilla js change style element+ 
 +change style element 
 <code javascript> <code javascript>
     function show_create_post() {     function show_create_post() {
Line 257: Line 249:
  
 trim string to max length trim string to max length
 +
 <code javascript> <code javascript>
 var string = string.substring(0,100); var string = string.substring(0,100);
 </code> </code>
  
-vanilla js onclick class element+onclick class element 
 <code javascript> <code javascript>
 document.getElementsByClassName('navbar-burger')[0].onclick = function(){ document.getElementsByClassName('navbar-burger')[0].onclick = function(){
   console.log('ready');   console.log('ready');
 }; };
 +</code>
 +
 +onclick on all class elements
 +
 +<code javascript>
 +# old: var anchors = document.getElementsByClassName('wp-block-navigation-item__content');
 +let allCheckBox = document.querySelectorAll('.shapes')
 +
 +  allCheckBox.forEach((checkbox) => { 
 +  checkbox.addEventListener('change', (event) => {
 +    if (event.target.checked) {
 +      console.log(event.target.value)
 +    }
 +  })
 +})
 +</code>
 +
 +remove class from element
 +
 +<code javascript>
 +var element = document.getElementsByClassName('wp-block-navigation__responsive-container')[0];
 +element.classList.remove("is-menu-open");
 +</code>
 +
 +get url and pathname
 +
 +<code javascript>
 +console.log(window.location.url)
 +console.log(window.location.pathname)
 +</code>
 +
 +querySelector
 +
 +<code javascript>
 +var multicolumnHeadline = document.querySelector('div.multicolumn ul li:nth-child(1) h3').textContent;
 +</code>
 +
 +querySelectorAll
 +
 +<code javascript>
 +var productAccordion = document.querySelectorAll('div.product__accordion');
 +productAccordion[1].style.display = "none";
 </code> </code>
 ==== vuejs ==== ==== vuejs ====
Line 703: Line 739:
 </code> </code>
  
-print setting text inside template+add custom javascript js 
 <code php> <code php>
-<?php echo get_option('fachwerksauna_footer-text'); ?>+function twentytwentytwo_enqueue_custom_js() { 
 +    wp_enqueue_script('custom', get_stylesheet_directory_uri().'/inc/js/main.js'); 
 +
 + 
 +add_action( 'wp_enqueue_scripts', 'twentytwentytwo_enqueue_custom_js' );
 </code> </code>
 ===== sql ===== ===== sql =====
Line 741: Line 782:
  
 ==== mysql ==== ==== mysql ====
- 
-Dump database 
-<code bash> 
-mysqldump -u root -p Tutorials > tut_backup.sql 
-</code> 
- 
-Backup everything 
-<code bash> 
-mysqldump -u root -p --all-databases > alldb.sql 
-</code> 
- 
-Import database 
-<code> 
-mysql> CREATE DATABASE wordpress; 
-sudo mysql -u root wordpress < wordpress.sql 
-</code> 
- 
-Setup 
-<code bash> 
-systemctl stop mysqld 
-mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql 
-systemctl start mysqld 
-mysql_secure_installation 
-</code> 
  
 delete specific row delete specific row
Line 776: Line 793:
 </code> </code>
  
-==== postgresql ==== +adjust permissions to table 
- +<code sql
-drop database +CREATE USER 'ninja'@'http.pi' IDENTIFIED BY '****'; 
-<code bash+GRANT ALL PRIVILEGES ON ninja.* TO 'ninja'@'http.pi' identified by '123'; 
-sudo -u postgres -i +GRANT ALL PRIVILEGES ON ninja.* TO 'ninja'@'http.pi'; 
-dropdb onlyoffice+FLUSH PRIVILEGES;
 </code> </code>
  
-list databases +update statement
-<code> +
-psql# \l +
-</code>+
  
-dump database +<code sql
-<code> +UPDATE wp_options SET option_value = 'info@example.org' WHERE option_name = 'admin_email';
-pg_dump -U gitlab gitlabhq_production > /tmp/gitlab.pgsql+
 </code> </code>
  
-dump all 
-<code> 
-pg_dumpall > /tmp/dump_file_name.tar 
-</code> 
- 
-import database 
-<code> 
-psql# CREATE DATABASE gitlabhq_production; 
-psql -U gitlab gitlabhq_production < gitlab.pgsql 
-</code> 
- 
-create and delete user 
-<code> 
-DROP ROLE gitlab; 
-CREATE USER gitlab WITH PASSWORD '5V0hD0KWX81g5dhKGHsbqU4a'; 
-</code> 
- 
-grant permissions 
-<code> 
-ALTER USER gitlab SUPERUSER; 
-CREATE DATABASE gitlabhq_production OWNER gitlab; 
-ALTER DATABASE gitlabhq_production OWNER TO gitlab; 
-</code> 
onny/notizen/programmierung.txt · Last modified: 2023/11/07 15:40 by 127.0.0.1