Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Kutu() {
- this.genislik = 50;
- this.yukseklik = 50;
- this.id = '';
- this.arkaplan = 'red';
- this.yazi = '';
- this.yaziBoyutu = 40;
- this.yaziRengi = '';
- this.x = 0;
- this.y = 0;
- this.ciz = function () {
- var div = document.getElementById(this.id);
- if (div) {
- div.id = this.id;
- div.style.width = this.genislik + 'px';
- div.style.height = this.yukseklik + 'px';
- div.style.position = 'absolute';
- div.style.top = this.y + 'px';
- div.style.left = this.x + 'px';
- div.style.fontSize = this.yaziBoyutu + 'px';
- div.style.textAlign = 'center';
- div.style.backgroundColor = this.arkaplan;
- div.style.color = this.yaziRengi;
- div.innerText = this.yazi;
- div.value = this.deger;
- div.onclick = this.islem;
- } else {
- div = document.createElement('div');
- div.id = this.id;
- div.style.width = this.genislik + 'px';
- div.style.height = this.yukseklik + 'px';
- div.style.position = 'absolute';
- div.style.top = this.y + 'px';
- div.style.textAlign = 'center';
- div.style.left = this.x + 'px';
- div.style.fontSize = this.yaziBoyutu + 'px';
- div.style.backgroundColor = this.arkaplan;
- div.style.color = this.yaziRengi;
- div.innerText = this.yazi;
- div.onclick = this.islem;
- //div.addEventListener('click', function() {
- // islem();
- //});
- document.body.appendChild(div);
- }
- }
- this.sil = function () {
- var element = document.getElementById(this.id);
- element.parentNode.removeChild(element);
- }
- this.tiklanamazYap = function () {
- var element = document.getElementById(this.id);
- element.onclick = null;
- }
- this.yaziGizle = function () {
- var element = document.getElementById(this.id);
- element.innerText = '';
- }
- this.yaziGoster = function () {
- var element = document.getElementById(this.id);
- element.innerText = this.deger;
- }
- this.islem;
- }
- function TextKutusu() {
- this.genislik = 100;
- this.yukseklik = 50;
- this.id = '';
- var _deger = '';
- this.deger = function(arg) {
- var element = document.getElementById(this.id);
- if (arg) {
- _deger = arg;
- if (element) {
- element.value = arg;
- }
- }
- if (element) {
- _deger = element.value;
- }
- return _deger;
- };
- this.yazi = '';
- this.x;
- this.y;
- this.islem;
- this.ciz = function () {
- var txtbox = document.createElement('textarea');
- txtbox.style.height = this.genislik;
- txtbox.style.width = this.yukseklik;
- txtbox.style.position = 'absolute';
- txtbox.id = this.id;
- txtbox.value = this.deger();
- txtbox.style.top = this.y+'px';
- txtbox.style.left = this.x+'px';
- txtbox.innerText = this.yazi;
- txtbox.onchange = this.islem;
- document.body.appendChild(txtbox);
- }
- }
- function Buton() {
- this.genislik = 80;
- this.yukseklik = 30;
- this.id = '';
- this.yazi = '';
- this.x;
- this.y;
- this.islem;
- this.ciz = function() {
- var btn = document.createElement('button');
- btntext = document.createTextNode(this.yazi);
- btn.style.width = this.genislik+'px';
- btn.style.height = this.yukseklik + 'px';
- btn.style.position = 'absolute';
- btn.text = this.yazi;
- btn.style.top = this.y+'px';
- btn.style.left = this.x+'px';
- btn.onclick = this.islem;
- btn.appendChild(btntext);
- document.body.appendChild(btn);
- }
- }
- var araclar = {
- islemBagla: function(func, args) {
- return function() { func(args); };
- },
- sayiyaDonustur: function(deger){
- return parseInt(deger);
- },
- yaziyaDonustur: function(deger){
- return deger.toString();
- },
- sayfayiYenile: function() {
- location.reload();
- },
- rasgeleSayiUret: function(altDeger,ustDeger){
- return Math.ceil((Math.random() * (ustDeger-altDeger)) + altDeger);
- },
- objeBul: function(id) {
- var element = document.getElementById(id);
- if (element.tagName == 'div') {
- var kutu = new Kutu();
- kutu.id = element.id;
- kutu.genislik = element.style.width;
- kutu.yukseklik = element.style.height;
- kutu.x = element.style.left;
- kutu.y = element.style.top;
- kutu.arkaplan = element.style.backgroundColor;
- kutu.yazi = element.innerText;
- kutu.yaziBoyutu = element.style.fontSize;
- kutu.yaziRengi = element.style.color;
- return kutu;
- }
- else if (element.tagName =='textarea') {
- var txt = new TextKutusu();
- txt.id = element.id;
- txt.deger = element.value;
- txt.genislik = element.style.width;
- txt.yukseklik = element.style.height;
- txt.yazi = element.innerText;
- txt.x = element.style.left;
- txt.y = element.style.top;
- return txt;
- }
- else if (element.tagName == 'button') {
- var btn = new Buton();
- btn.id = element.id;
- btn.genislik = element.style.width;
- btn.yukseklik = element.style.height;
- btn.yazi = element.innerText;
- btn.x = element.style.left;
- btn.y = element.style.top;
- return btn;
- }
- },
- zamaniGetir: function() {
- var zaman = new Date();
- var tamSaat = zaman.getHours() + ':' + zaman.getMinutes() + ':' + zaman.getSeconds();
- return tamSaat;
- },
- saatGetir: function() {
- var zaman = new Date();
- return zaman.getHours();
- },
- dakikaGetir: function() {
- var zaman = new Date();
- return zaman.getMinutes();
- },
- saniyeGetir: function() {
- var zaman = new Date();
- return zaman.getSeconds();
- }
- }
- var renkler = {
- siyah: 'black',
- beyaz: 'white',
- kirmizi: 'red',
- mavi: 'blue',
- sari: 'yellow',
- kahverengi: 'brown',
- yesil: 'green',
- gri: 'grey',
- turuncu: 'orange',
- mor: 'purple'
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement